-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API/SDK usage based on current implementation #194
Comments
3/4. Would be needed to enable/disable/load specific plugins for the NodeTracer, so yeah the PR is needed |
Per SIG and 41112dd, scopeManager is a required option. I think explicitly mentioning scopeManager eliminates the require for log, throw or swallow stuff. But personally, I would prefer optional param. |
What if we made it an optional param with a default value of I know we discussed the global tracer stuff at length, but I personally would prefer something like this: 1. const { tracer } = require('@opentelemetry/basic-tracer');
2. const { NoopScopeManager } = require('@opentelemetry/scope-base');
3.
4. // This specifies a scopeManager to show how to configure the tracer
5. // but if no call to `start` were made it would retain its default NoopScopeManager
6. tracer.start({scopeManager: new NoopScopeManager()});
7.
8. doWork();
9.
10. function doWork() {
11. const span = tracer.startSpan('doWork');
12. ... // same as Mayur's example above In that case the basic tracer would be given a definite value of scope manager by default, but it could be overridden in the call to That said, I'm open to the |
Looking at this I'd definitely like to add some global static methods so getTracer() won't have to be used so often. I'll do a similar exercise with a toy http server and share the code here. |
@bg451 I'm interested to see your suggested approach but wouldn't a |
@mayurkale22 I kind of like the approach of explicitly having to define a ScopeManager as it removes ambiguity. I think the same question will arise with the exporter where we could default to ConsoleExporter. |
I think both approach is good and I prefer to make it optional (in the long term run). |
Agreed. |
Signed-off-by: Naseem <[email protected]>
I tried to put one simple example together to get the initial feeling of current APIs and BasicTracer SDK.
Some key observations:
NoopScopeManager
) See line # 7.NodeTracer
, I should not have to manually pass the parent span it should fetch it internally fromgetCurrentSpan()
- from the current context. See line # 16-18.opentelemetry.getTracer().start()
? See line # 32.Any thoughts?
The text was updated successfully, but these errors were encountered: