Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Proof of Design Implementation of a first design proposal for opencensus-nodejs #1

Closed
wants to merge 48 commits into from

Conversation

fabiogomessilva
Copy link
Member

Tracing class
Tracer class
Plugin Loader class
http plugin
mongodb-core plugin
Simple exporters to zipkin and stackdriver - no buffer
Allways sample strategy

silva-fabio and others added 30 commits March 20, 2018 11:42
Op 30

See merge request opencensus/opencensus-node!1
…ving class files Span.ts, Trace.ts and Tracer.ts to trace/model
…ving class files Span.ts, Trace.ts and Tracer.ts to trace/model
Merge 'Op 31.v2' into 'dev'

See merge request opencensus/opencensus-node!3
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@tags07 tags07 requested review from kjin, ofrobots and bogdandrutu March 29, 2018 21:44
@fabiogomessilva
Copy link
Member Author

I signed it!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

Adapted tests for dev

See merge request opencensus/opencensus-node!9
@fabiogomessilva
Copy link
Member Author

I would like just to emphasize that code comments on classes and methods were not prioritized for this first v0 version. We know they are needed and important. They will be added along the way in the next sprints to come.

@djonathascardoso
Copy link
Member

I signed it!

1 similar comment
@eldreygalindo
Copy link
Contributor

I signed it!

@luanamartinssantos
Copy link
Member

I signed it.

@eduardoemery
Copy link
Contributor

I signed it!

2 similar comments
@djonathas
Copy link

I signed it!

@fabiogomessilva
Copy link
Member Author

I signed it!

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

Copy link
Contributor

@kjin kjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working through it... some initial comments.


import { Tracing } from './trace/tracing';

module.exports = new Tracing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer export = new Tracing() to match usage of the import keyword.

export class ConsoleLogExporter implements Exporter {

writeTrace(root: RootSpan) {
let rootStr: string = ( `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the format of these log lines aren't consistent, can you normalize the padding and log messages here?

let result:string[] = [];

result.push(rootStr)
result.push(`${spansStr.join("")}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: join already returns a string.

private translateSpan(span) {
return {
"name": span.name,
"kind": "SPAN_KIND_UNSPECIFIED",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind should be specified here if possible.

export class StackdriverOptions implements ExporterOptions {
projectId: string;

constructor(projectId: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to have a class for an options object.

public writeTrace(root: RootSpan) {
// Builds span data
let spanList = []
root.spans.forEach(span => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can use const spanList = root.spans.map(span => this.translate(span))

}

// TODO: Rename to "flushBuffer" and "publish"
private sendTrace(projectId, authClient, resource) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit -- it looks like this can be a static function.

Also, what is the justification for renaming to flushBuffer or publish? I think sendTrace is fine.

});

// write data to request body
let spansJson: string[] = spans.map((span)=> JSON.stringify(span));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: JSON.stringify the entire string rather than individual spans.

return ns / 1e6
}

public get hrtime() : [number, number] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is unused?

const EVENT_EMITTER_METHODS: Array<keyof EventEmitter> =
['addListener', 'on', 'once', 'prependListener', 'prependOnceListener'];

class AsyncHooksNamespace implements CLSNamespace {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to keep in mind -- the Trace Agent's async_hooks implementation is going to change over time.

@fabiogomessilva
Copy link
Member Author

fabiogomessilva commented Apr 3, 2018 via email

justindsmith pushed a commit to justindsmith/opencensus-node that referenced this pull request Aug 15, 2018
The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
kjin pushed a commit that referenced this pull request Aug 17, 2018
The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach #1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach #2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
kjin pushed a commit to kjin/opencensus-node that referenced this pull request Aug 24, 2018
…on#93)

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
kjin pushed a commit to kjin/opencensus-node that referenced this pull request Aug 24, 2018
…on#93)

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
kjin pushed a commit to kjin/opencensus-node that referenced this pull request Aug 24, 2018
…on#93)

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants