-
Notifications
You must be signed in to change notification settings - Fork 896
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
Trace SDK: Provide definitions for readable and read/write span. #669
Trace SDK: Provide definitions for readable and read/write span. #669
Conversation
linkcheck repeatedly failed with HTTP 429 for github.com, markdown should be clean 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.
Thanks! The change looks good and clears up what read, vs read/write span are well for me.
Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
I went ahead and spiked a PoC for |
@carlosalberto @bogdandrutu Anything I should do here? |
Note that this PR is now linked to #158 which is required-for-ga. |
@open-telemetry/specs-approvers @open-telemetry/specs-trace-approvers This PR is waiting for reviews. |
|
||
A readable span interface MUST provide a method called `getInstrumentationLibrary` (or similar), | ||
that returns the `InstrumentationLibrary` information held by the `Tracer` that created the span. | ||
* **Read/write span**: A span interface satisfies this requirement of being a |
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.
Is this really needed? This may make user to do hacks. Imagine we have this interface in the OnStart, they know that the object we return implements both, OnEnd we return only read, then they will guess is the same interface and may do a cast to the ReadWrite interface.
My suggestion is that Span is the write interface and ReadableSpan is the read interface, if access required to both we should pass both interfaces. Maybe I am to "evil" and think of possible hacks and abuses, but I've seen all of these happening in my previous life :)
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 could pass a wrapper object that only implements the readable interface to protect against that.
I think we can mention passing the read-only and write-only interface separately as an allowed implementation option for read/write span 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.
@Oberon00 suggested I do that hack when I need to mutate the span in OnEnd
:) I think there is a need to be able to mutate spans globally before export (usually to use other tags as signals to user-defined domain-specific tags) so hope we can find a way. The issue we were worried about is the ordering between OnEnd
and export
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.
More importantly, spans are already ended at that point and can't be modified anyway. #669 (comment)
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.
@bogdandrutu I incorporated the "read/write implemented as two separate objects" option in 0b9709d.
|
||
A readable span interface MUST provide a method called `getInstrumentationLibrary` (or similar), | ||
that returns the `InstrumentationLibrary` information held by the `Tracer` that created the span. | ||
* **Read/write span**: A span interface satisfies this requirement of being a |
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.
@Oberon00 suggested I do that hack when I need to mutate the span in OnEnd
:) I think there is a need to be able to mutate spans globally before export (usually to use other tags as signals to user-defined domain-specific tags) so hope we can find a way. The issue we were worried about is the ordering between OnEnd
and export
Pinging @open-telemetry/specs-approvers @open-telemetry/specs-trace-approvers as I am also interested in this PR getting merged. |
@iNikem It would be cool if you had time to submit a review yourself. Grey checkmarks also mean something 😃 |
Thinking some more about the original intention of @anuraaga in #663 , @bogdandrutu comment about ReadableSpan vs SpanData about this use-case and how What Anuraag and I want is a composable, external function Exporters, on the other hand, are off the critical path. If we update spec to make it explicit that there can be a chain/pipeline of exporters, and that they can be a place for data enrichment, that would solve the underlying issue in #663 |
Yeah, the SpanProcessor is not well-suited for computing additional attributes. @anuraaga said he'd create a new issue/PR for this (#669 (comment)). What is more, OnEnd can only get a read-only span (a ended + writeable span is not a thing #669 (comment)). I think OnStart should be able to write to the Span, so that the SpanProcessor can capture some things from the current context. E.g. a thread name, a current request ID (many web frameworks offer a way to access the current web request via a global function), etc. |
Yeah I've been waiting to confirm the direction of this one before filing another issue about enriching spans, whether using processor or exporter to avoid confusion as they are related topics. So hoping for a merge :-) |
I also agree that it is better to get this basic readable vs read+write definitions sorted out before making follow-up changes. I'm also hoping for a merge. 😃 @carlosalberto if you approve of this PR, I think it is ready to be merged. I don't think we need to wait for @bogdandrutu anymore as I think I resolved all his comments and he hasn't responded for 10 days. I will also post a request for reviews on gitter. |
@Oberon00 I think the section describing the option to have a Read/Write Span as (two) separate objects might not be clear enough for newcomers ;) But we can work on it if/as/when needed, so I'm ok with the current PR. Lets wait till EOD to give a last opportunity for @bogdandrutu to comment. |
I agree that this section has become rather convoluted. I have an idea in mind where we would not list parameters for callbacks one by one but rather just say which operations they must be able to do. But I'd prefer to do that in a follow up if possible. |
Resolves #663 "Allow for global processing of spans in SpanProcessor".
Required for #158 "Describe proto.Span class".
, may additionally be writable.Also clean up related wording for span exporters that couldn't decide whether they want to work for different kinds of telemetry data or only spans (they work only for spans).