-
Notifications
You must be signed in to change notification settings - Fork 894
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
Span processor clarifications #1135
Span processor clarifications #1135
Conversation
specification/trace/sdk.md
Outdated
and the export-friendly span data representation to the configured | ||
`SpanExporter` as soon as they are finished. | ||
|
||
Typically, the simple processor will be most suitable for use in testing and/or |
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.
it may be used in production for adding attributes like here: https://medium.com/opentelemetry/opentelemetry-beyond-getting-started-5ac43cd0fe26#ffbb:~:text=Custom%20attributes%20in%20code%20scopes
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.
In Java this has become the most common span processor as exporters use async functions to send data instead of relying on a background thread. Not how the spec was designed probably, but if it works.
CC @anuraaga
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 for your valuable feedback on this section as well as the batch processor one, @Oberon00. Do you think more should be added to clarify that while these statements may "typically" be true, it also depends on language implementation? I'm not sure how much detail to get into here.
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.
thank you for PR. I added comment on one more scenario for processor. Current edit may mislead
Thanks for the quick response! I will add that further clarification. |
@@ -287,16 +287,17 @@ invocations. The span processors are invoked only when | |||
[`IsRecording`](api.md#isrecording) is true. | |||
|
|||
Built-in span processors are responsible for batching and conversion of spans to | |||
exportable representation and passing batches to exporters. | |||
exportable representation and passing batches to exporters or alternatives to |
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.
Not sure if a GA spec should point to an experimental spec, thoughts?
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 zPages are implemented as a span processor, not something that receives data through a span processor.
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.
Would it be true then to say "and passing batches to exporters or other span processors," or are there still other alternatives?
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.
Also, to @reyang's point, I am not even sure referring to zPages specifically makes sense here. My only goal is to have a clear and universal definition of span processors in this sentence. Reading this section, I was confused by the fact that span processors were defined as "responsible for... passing batches to exporters" but then a few lines down, exporters were described as optional.
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 don't see a problem referring to experimental feature as it makes the point that this is an extensibility point in SDK that can be useful for purposes including experimentation with the new features.
specification/trace/sdk.md
Outdated
and the export-friendly span data representation to the configured | ||
`SpanExporter` as soon as they are finished. | ||
|
||
Typically, the simple processor will be most suitable for use in testing and/or |
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.
In Java this has become the most common span processor as exporters use async functions to send data instead of relying on a background thread. Not how the spec was designed probably, but if it works.
CC @anuraaga
@@ -287,16 +287,17 @@ invocations. The span processors are invoked only when | |||
[`IsRecording`](api.md#isrecording) is true. | |||
|
|||
Built-in span processors are responsible for batching and conversion of spans to | |||
exportable representation and passing batches to exporters. | |||
exportable representation and passing batches to exporters or alternatives to |
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 zPages are implemented as a span processor, not something that receives data through a span processor.
Typically, the batching processor will be more suitable for production environments | ||
than the simple processor. |
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.
Depends on the language, e.g. in Java exporters do batching themselves sometimes. But typically, I think that BatchSpanProcessor should be the expected scenario, yes.
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 how it's written. Wdyt @Oberon00?
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 the PR's wording is fine here 👍
Each processor registered on `TracerProvider` is a start of a pipeline that consists | ||
of one or more span processors and, optionally, one or more exporters. The SDK MUST | ||
allow ending each pipeline with an individual exporter. | ||
|
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 this paragraph. Or do you know what is meant by it? AFAIK the TracerProvider must allow the registration of multiple SpanProcessors, but each built-in span processor only supports a single exporter.
Each processor registered on `TracerProvider` is a start of a pipeline that consists | |
of one or more span processors and, optionally, one or more exporters. The SDK MUST | |
allow ending each pipeline with an individual exporter. |
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 definitely need some better description of the possible compositions of SpanProcessors
and SpanExporters
. E.g. we MUST indicate somewhere that there should be a SpanProcessor
before each SpanExporter
(purely from methods signatures point of view). We also MUST stress and clearly describe that multiple registered SpanProcessor
are "siblings" and do NOT call each other. All this has already created some confusion in the past.
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 support removing this paragraph. We don't need to specify that pipelines end in exporters, just that the two builtin span processors end in exporters. The metric SDK hasn't thus far mentioned support for multiple processors, and why should we? It's possible to define a multi-processor that calls a series of individual processors. Should the default trace SDK include a builtin multi-processor? I suppose they should if it's common to implement multiple trace exporters with different processor settings, but that does not sound common. Wouldn't you prefer to have a single processor call multiple exporters? Why do we need to specify these things?
multiple registered SpanProcessor are "siblings" and do NOT call each other
If you only specify SDK support for a single processor, this problem vanishes. Potentially you can also specify a multi-processor and/or a multi-exporter, but are you sure these are commonly needed?
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.
For what it's worth, as someone relatively new to OpenTelemetry concepts, it was helpful to me to have a textual description of the span processor pipeline in addition to the diagram that also exists in this section. There may be some additional nuance that needs to be added, but having some form of this paragraph seems like a good idea to me.
Co-authored-by: Christian Neumüller <[email protected]>
Co-authored-by: Christian Neumüller <[email protected]>
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.
This PR does not solve existing problems with the current description, but it is a nice cleanup. Thank you! :)
I have attempted to address @SergeyKanzhelev's requested change. Please let me know if more clarification is needed there. Thanks to all who have submitted feedback. I think there are a few things that are potentially outside the scope of this PR, but I have tried to incorporate fixes that are straightforward. One outstanding question I have: does the overall definition of span processors (see discussion on ln. 290) need to be further fixed? |
@rachelleahklein thanks again for the PR. The only outstanding feedback from me is to position simple span processor scenarios as dangerous, but valid for production (not as exceptions). |
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.
This is an improvement to the wording without semantical change. Thank you!
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.
Thank's for the clarifications @rachelleahklein!
specification/trace/sdk.md
Outdated
and the export-friendly span data representation to the configured | ||
`SpanExporter` as soon as they are finished. | ||
|
||
Typically, the simple processor will be most suitable for use in testing; it should be used with |
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.
Not sure this should be mentioned here.
We have production systems running using SimpleProcessors. In those systems, the OpenTelemetry SDK uses SimpleProcessor and exports the span as they arrive, without any batching.
The export may be done to some agent, which in turn may do batching.
Or Export could be done to the actual backend, to enable scenarios like "Live telemetry". Eg in Azure: https://docs.microsoft.com/azure/azure-monitor/app/live-stream
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.
Added couple suggestions. @anuraaga, @cijothomas are these suggestions looks OK for you?
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.
Thank you for adding more suggestions, @SergeyKanzhelev. I have incorporated the first (though happy to revert or refine if there are further comments).
The second is still open and I'm hoping @Oberon00 or others can help clarify a more accurate version.
Thank you all!
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
custom attributes should be added to individual spans based on code scopes. | ||
|
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.
custom attributes should be added to individual spans based on code scopes. | |
custom attributes should be added to individual spans based on code scopes. Simple processors | |
might also be used for scenarios where the callback needs to be called before sampling. For | |
example, z-pages can be implemented this way. | |
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.
This is wrong though. The simple processor is also not invoked for DROPped spans.
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.
hm, I'm referring to the sampled flag as oppose to the recorded flag. Recorded, but sampled out spans should not make it to the batch processor, correct? Recorded will be processed by simple processors. dropped will not reach either
Co-authored-by: Sergey Kanzhelev <[email protected]>
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
I don't seem to be able to reopen this PR, but I still do hope to work on it and get it approved. It sounds like there are some clarifications that people have found helpful. Please let me know if there is any further feedback I can address. Thank you. |
Built-in span processors are responsible for batching and conversion of spans to | ||
exportable representation and passing batches to exporters. | ||
exportable representation and passing batches to exporters or alternatives to |
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 are mixing 2 different things in this sentence:
- What is a SpanProcessor, and how can this be used to interact with the SDK.
- The SpanProcessor in general does not need to batch or talk to the exporter, it is a simple "hook" that allows custom processors to interact with the Span lifetime events (on start and on end). For example somebody can implement a processor that tracks all the active requests (one of the functionality that we want to offer in the zPages). Others can implement different other functionality.
- What are the "built-in" SpanProcessors.
- We will provide 2 flavors of SpanProcessors (Simple/Batch) that are able to batch (or not in case of simple), transform the Spans in an "exportable" format, and call the "exporter".
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Changes
This PR attempts to clarify information about span processors in the Trace SDK spec. It contains:
Related issues
The need for clarification in the spec came to my attention when it was mentioned in this ticket: open-telemetry/opentelemetry-ruby#397.