-
Notifications
You must be signed in to change notification settings - Fork 96
Exporting TracerBase as a separate @opencensus/nodejs-base package #495
Exporting TracerBase as a separate @opencensus/nodejs-base package #495
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea of splitting out the complexity of the CLS based tracer and giving the option of fully manual spans.
I left a few comments. I think we should wait for @mayurkale22 to come back Monday to get this approved and merged.
}, | ||
"dependencies": { | ||
"@opencensus/core": "^0.0.11", | ||
"@opencensus/instrumentation-all": "^0.0.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need this dependency if no plugins are pulled in by default?
@@ -33,7 +33,7 @@ enum HookState { | |||
*/ | |||
export class PluginLoader { | |||
/** The tracer */ | |||
private tracer: Tracer; | |||
private tracer: Tracer|TracerBase; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just be TracerBase
since Tracer
inherits from it? Same below.
packages/opencensus-nodejs/README.md
Outdated
rootSpan.end(); | ||
}); | ||
``` | ||
For manual insturmentation see the `@opencensus/nodejs-base` package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if someone wants both automatic and manual instrumentation? I would think they would be able to do it by using the @opencensus/nodejs
package as well? Maybe we should still have the doc above, but mention that if you only want manual instrumentation to see the @opencensus/nodejs-base
package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point, I'll revert it and add the extra context.
275eca0
to
5665abe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the build. Also update CHANGELOG.md
# of contributors, see the revision history in source control. | ||
|
||
Google LLC | ||
CESAR Team (www.cesar.org.br) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove "CESAR Team" and if you want add "Netflix".
|
||
For automatic insturmentation see the `@opencensus/nodejs` package. | ||
|
||
### Manually Instrument an Application |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/Instrument/Instrumenting
to maintain consistency.
@@ -0,0 +1,2 @@ | |||
fixes: | |||
- "::packages/opencensus-nodejs/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/opencensus-nodejs/opencensus-nodejs-base
?
@@ -0,0 +1,132 @@ | |||
/** | |||
* Copyright 2018, OpenCensus Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/2018/2019
packages/opencensus-nodejs/README.md
Outdated
@@ -61,6 +63,8 @@ tracing.tracer.startRootSpan(rootSpanOptions, (rootSpan) => { | |||
}); | |||
``` | |||
|
|||
For manual only instrumentation see the `@opencensus/nodejs-base` package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to add link for the @opencensus/nodejs-base
package.
"extend": "^3.0.2", | ||
"require-in-the-middle": "^4.0.0" | ||
"@opencensus/nodejs-base": "^0.0.11", | ||
"@opencensus/instrumentation-all": "^0.0.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Move @opencensus/instrumentation-all
above @opencensus/nodejs-base
to keep the ordering intact.
@mayurkale22 thanks for the review. I'm trying to fix the build for days now and I couldn't figure out what's happening. It was passing on my machine earlier, now with a clean copy, I can least reproduce it. I feel it's more a mono repo thing and I'm missing something. Any chance you have a hint? |
@mayurkale22 I could figure out, both CI and your comments are fixed now. |
Codecov Report
@@ Coverage Diff @@
## master #495 +/- ##
=========================================
- Coverage 94.97% 94.68% -0.3%
=========================================
Files 145 145
Lines 10091 10231 +140
Branches 882 870 -12
=========================================
+ Hits 9584 9687 +103
- Misses 507 544 +37
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, added a few comments.
package.json
Outdated
@@ -6,6 +6,7 @@ | |||
"types": "build/src/index.d.ts", | |||
"repository": "census-instrumentation/opencensus-node", | |||
"scripts": { | |||
"fix": "lerna run fix", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, I would prefer to do this kind of (unrelated) changes in separate PR, just to keep PR clean and small. :)
describe('start()', () => { | ||
let aTracingBase: core.Tracing; | ||
const tracing = new TracingBase(); | ||
// tslint:disable:no-any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please remove this TSLint rule flag?
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2018, OpenCensus Authors | |||
* Copyright 2019, OpenCensus Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, we don't update the copyright header when we touch the file.
@mayurkale22 thanks, fixed and separate PR opened for |
Just wondering: What do you think about renaming this package to either |
I also don't like the current name, but wouldn't it be worst to have two different naming concepts in the same project? I would keep the current naming convention in OpenCensus and fix it in OpenTelemetry. |
Ok makes sense. |
For OpenTelemetry, I don't even think we need
Or even more building block philosophy:
|
I will merge this later today, if no other comments from either @draffensperger or @justindsmith |
@mayurkale22 can we also cut a release when it's merged? |
Sure, I would like to include #503 and #510 (if possible #454). FYI (Release Milestone) : https://github.com/census-instrumentation/opencensus-node/milestone/3. I will cut a release later tomorrow. Is that ok? |
Perfect, thanks! |
The release (0.0.12) is completed for @opencensus/* packages. PTAL. |
As
@opencensus/nodejs
exports a Tracing instance as default, which also initializes CLS I would like to propose a new@opencensus/nodejs-base
package to avoid breaking change for existing customers. The existing@opencensus/nodejs
become a thin layer on the new@opencensus/nodejs-base
after this change.The alternative solution would be to only export
Tracing
andTracingBase
classes and let the user initialize them. It would also require to start CLS only whenTracing
is initialized instead of the current global instance. This would be a breaking change.This PR is related to #484