-
Notifications
You must be signed in to change notification settings - Fork 795
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
feat: introduce ended property on Span #625
feat: introduce ended property on Span #625
Conversation
Codecov Report
@@ Coverage Diff @@
## master #625 +/- ##
==========================================
+ Coverage 93.35% 96.01% +2.66%
==========================================
Files 202 203 +1
Lines 7869 8718 +849
Branches 708 771 +63
==========================================
+ Hits 7346 8371 +1025
+ Misses 523 347 -176
|
f9640fc
to
a41215c
Compare
Is that something we should have the spec add? As far as I know, the span processors are supposed to rely only on the public I’m generally confused by the existence of the ReadableSpan type. The spec seems to assume that the exporters will be able to access all of the properties of the span, but it explicitly states that the span should not export properties other than its span context I can’t find any mention of I don’t know how other SIGs reconcile this, but my gut feeling is that they do the same thing we do, which is exporters/processors just assume the sdk span type and not the api type In order to make our Span spec compliant, we will have to remove all |
Good catch! There seems to be an inconsistency in existing code of I think the wording in spec is only regarding API not processor/exporter interface. If an exporter gets only the |
As far as I know, and we just went through this with the xhr plugin, the plugins/exporters/spanprocessors should use the public api only because a third party tracer could be used which has a different implementation of Span. |
@Flarna according to @mayurkale22 the export pipeline is tightly coupled with sdk, so it should be safe to use properties that are on our Span, but not in the public interface. If a third party sdk is plugged in, they will have to provide their own export pipeline. edit: @mayurkale22 please confirm if you can |
AFAIK our SDK implementation is tightly coupled with export pipeline. If you're interested writing your own sdk, you get complete freedom on export pipeline. Reg. this PR I would wait for the specs issue to get approved and merged: open-telemetry/opentelemetry-specification#373 |
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.
Giving my approval to this since in the current spec the export pipeline is tightly coupled with the SDK.
In the future I would like to propose a more clear separation of the SDK and the export pipeline so that it is easier to plug third party components without requiring them to replace the full SDK.
Looking closer into this I noticed that it's needed to update also According to spec a I tried to correct this but it turns out that we can create a The label |
bb7e25e
to
8f2997a
Compare
Is there a spec issue created for that? |
I expect open-telemetry/opentelemetry-specification#373 covers this. |
689a2c0
to
caeb0bc
Compare
Add a getter to Span and ReadableSpan to allow checking if the span is ended without using a private field or rely on internals like span.duration[0] < 0. Refs: open-telemetry/opentelemetry-java#693 Refs: open-telemetry/opentelemetry-java#697
caeb0bc
to
28bbad2
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
@dyladan @mayurkale22 Is there any chance to move this forward? |
This is all within the export pipeline which I have been informed by spec is an SDK-only concern so we can use non-API methods and properties within the export pipeline. This means we can just add a property/method to our span. One side-effect of this is that it will tightly couple the export pipeline to our span implementation, which we have avoided so far. This may make it more difficult for a third party SDK implementation to take advantage of our export pipeline, but does not explicitly violate spec. I think given all of that, we can move forward with this. |
@dyladan So in short I should remove the changes in API (span.ts and NoopSpan.ts) but keep the rest as it is? |
yes |
@mayurkale22 let me know if that is an issue for you |
Merged master and reverted API changes. |
Are you planning to update this in separate PR? |
As @dyladan requested to remove the changes from API as they are not part of the spec it's not possible to use this within plugins. If they have the need to detect if a span is already ended they have to store it somewhere else. Unfortunately this is what the spec requires... |
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
Looks like this is good to merge, just wanted to check with @dyladan on waiting-for-spec label. |
Which problem is this PR solving?
Allows a
SpanProcessor
andSpanExporter
to check if aSpan
is ended or not.Short description of the changes
Add a getter to
Span
andReadableSpan
to allow checking if the span is ended without using a private field or rely on internals likespan.duration[0] < 0
.Refs: open-telemetry/opentelemetry-java#693
Refs: open-telemetry/opentelemetry-java#697