-
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
Cleaning up context on reusable carriers before or after injection #1811
Comments
Totally agreed.
If we agree that only outmost instrumentation should inject its CLIENT SpanContext into the carrier, then the requirement above does not actually apply to the nested instrumentations. Because they should not call |
I think we have to discuss approaches for context injection on the nested spans. I'm writing this under the assumption we're creating specs that can be implemented with auto-instrumentation. More here: #1783 (comment) |
Maybe things that don't need new context like circuit-breaking should not even need a span and can be expressed as an event? And maybe this way can we stay consistent:
Logical CLIENT calls in this case don't really need to follow HTTP instrumentation - they wrap multiple underlying HTTP calls instead. And they don't inject context. Also, they are not always feasible to the instrument and in most cases (no retries/redirects) replicate what happens on |
[just as a tangent: I was surprised to find recently in /~https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/2727 that reusing HTTP requests is supported by most of the 20+ Java http client libraries that we instrument] I agree that we need a way to identify if we are in a nested CLIENT span, for a couple of reasons:
It sounds like there are at least a couple of options to accomplish this:
Maybe we can focus initially on
|
It sounds like unless there is a bug in instrumentation, last write should always win. If at all possible, we should go with last write wins, and write OpenTelemetry instrumentation with that in mind. I am worried that other solutions add more state and conditional rules, which make it difficult for end users to reason about what their system is doing. Is there any situation, outside of instrumentation being written or applied in an incoherent manner, where last write wins would not be the correct solution? |
Please take a look at #1767, open-telemetry/opentelemetry-java-instrumentation#440 - there could be legit cases when it happens and there is double-instrumentation (native library + auto). I think we all have different ideas of what's HTTP (gRPC, etc) instrumentation and we first need to start with clarifications. I believe here are some ideas I heard:
Then there are different ideas of what's more useful to users
And then there are different problems
So I think we need to build clarity around this within semantic convention WG and try to come up with a proposal that is
I will publish my way of thinking around it based on my experience with native instrumentation of .NET HTTP client in pre-OTel era which is up and running for years. |
I agree that we need to define the conventions for having layered client and server spans. I look forwards to your thoughts. I think there is a lack of clarity around how we should be instrumenting these types of layered systems. In general, I am concerned about adding complexity. In particular, I'm concerned about control mechanisms that allow instrumentation authors to suppress instrumentation coming from other libraries. I'd rather we extend the semantic conventions to provide a consistent language for configuring instrumentation, and allow the end user control over what information is emitted, rather than give instrumentation authors tools for messing around with instrumentation they did not write. Ideally, our solution for managing configuration can be implemented in languages which do not use the agent approach. And agents are aware of the configuration mechanism that the end user has access to, so there aren't multiple types of control mechanisms fighting with each other. Related note: I think I need a better understanding about the cases where "double instrumentation" is unavoidable. It feels like higher level instrumentation should defer to lower level instrumentation rather than re-implement it, and if the lower-level client is pluggable then every type of client which is plugged in should provide instrumentation. I get that reality has edge cases, but it feels like we should try our best to avoid ladling on any complexity we can avoid. |
@tedsuo For me the simplest case of "unavoidable double instrumentation" is this:
Both parties (developer and library) want to create a CLIENT span and propagate it across the wire. I am not alone in the opinion that in this case library (meaning lower level or nested span) should back off. |
The discussion here doesn't really have much to do with the original issue topic/title anymore. Maybe you could copy to #1767 or create a new issue so that others can find this discussion? |
@tedsuo @iNikem @Oberon00, good point, I'll close this issue and link to corresponding issues (#1747 too), it seems inevitable that we have to clear context before making calls for the majority of cases. |
What are you trying to achieve?
Context: #1767 #1783 open-telemetry/opentelemetry-java-instrumentation#440 open-telemetry/opentelemetry-java-instrumentation#903
I'd like to create some clarity around context propagation (for HTTP for now). It also helps when multiple multiple instrumentations in the process for an HTTP request. I think it makes more sense (in terms of supportability and least surprise to users) to always pick outer instrumentation, i.e manual user instrumentation always wins.
However, propagator spec mentions that
context
should be stripped from the request if it can be reused between tries, which means that inner instrumentation always wins.I'd like to get community opinion on if it is really a desired behavior
It was introduced in #147 and there is no reasoning/explanation, so above are my assumptions.
Additional context.
It not very common to reuse HTTP requests between retries, but e.g. golang http client allows that and there are likey other clients/cases where it happens.
The text was updated successfully, but these errors were encountered: