-
Notifications
You must be signed in to change notification settings - Fork 47
feat: add tracer.startActiveSpan() #54
feat: add tracer.startActiveSpan() #54
Conversation
Since this isn't in the spec and we have the problem for the suppress instrumentation system, can we even merge this in the API ? |
2775dd7
to
ba070ae
Compare
According to spec this functionality may be offered by a separate operation, would this not be it? #14 (comment) I'm ignorant to the suppress instrumentation problem though. |
Its our system to avoid exporting loop to "stop" instrumentation from generating spans which is an additional "operation/API" too but we've been asked to either add it to the spec or package it as a seperate npm package.
Looks like the spec acknowledge it indeed so this should be fine to add |
8b4e002
to
d43f446
Compare
What is the problem regarding suppress instrumentation here? Isn't this API is just a helper around exiting APIs? |
Codecov Report
@@ Coverage Diff @@
## main #54 +/- ##
==========================================
- Coverage 94.66% 90.31% -4.35%
==========================================
Files 40 40
Lines 506 537 +31
Branches 80 92 +12
==========================================
+ Hits 479 485 +6
- Misses 27 52 +25
Continue to review full report at Codecov.
|
22116c0
to
81151c8
Compare
No there is no technical problem. I think @vmarchaud was using it as an example of a feature that we implemented without spec and got pushback from the TC. |
Why is this WIP? |
It is not ready to be merged in its current state, and am still requesting comments/direction, e.g.: #54 (comment) |
8fcd56f
to
997ccaa
Compare
3a119c5
to
56f11e2
Compare
b77b2e2
to
8eb602d
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.
lgtm, tests are failing though
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.
A test for NoopTracer
to verify that fn is actually called correct and return value is passed through would be nice.
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.
lgtm
58cf7eb
to
18b2ae3
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.
Hopefully the comment I left can help you with your sinon stub typing
Thanks! 🙏 |
In the end it was still broken, sinon types + overloads don't play nicely as per DefinitelyTyped/DefinitelyTyped#36436 But was able to work around it with |
a0e97b5
to
2faa083
Compare
Add a helper method that starts a new and sets it in the currently active (or otherwise specified) context and calls a given function passing it the created span as first argument. This method is not strictly part of the spec, but the spec does allow (encourage?) it to be added for convenience: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#span-creation For best UX, this method has overloads such that it can take in name,fn or name,opts,fn or name,opts,ctx,fn as args. These overloads caused some issues with sinon.stub in the proxy-tracer test but was able to work around it by use of "any". A link to the gh issue was added as a comment in said test. Signed-off-by: naseemkullah <naseem@transit.app> Co-authored-by: Gerhard Stöbich <deb2001-github@yahoo.de> Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
2faa083
to
81fd6a9
Compare
Thanks for the help everyone! |
adds helper function tracer.startActiveSpan() which creates a new span and activates it in the current Context