-
Notifications
You must be signed in to change notification settings - Fork 878
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
Instrumenter SpanOmitter #10436
Instrumenter SpanOmitter #10436
Conversation
what is your specific use case? (because we have a couple different alternative solutions floating around, e.g. open-telemetry/opentelemetry-java#6197)
Would |
I don't get this.
Would replacing Line 80 in 34e0eb6
BooleanSupplier or Predicate satisfy this?If you want to suppress span creation this way I'd imagine that toggling it per Instrumenter by adding a SpanOmitter isn't the most convenient way. Perhaps it would make sense to have a global predicate that is applied to all instrumenters that based on the instrumentation name, span kind, context etc. decides whether span should be created? This way you wouldn't need to separately modify instrumenters to have them participate in this. You could have rules that say drop all INTERNAL spans or drop all spans from okhttp instrumentation and modify these at runtime.
|
Hi, thanks for the feedback!
I think if samplers had access to the scope, as mentioned in that issue, it could work because my use case is about being able to toggle on/off a single auto-instrumentation (although there might be some other details needed with that approach that I'm ignoring right now, but overall it looks like it should work). So I'm looking forward to those changes, although it seems like it would require involving changes in the spec, so I'm a little worried about how long it would take.
I think so, but we would also need some setter in the InstrumenterBuilder to provide my own and evaluate it after the existing SpanSuppressor.
I think a concrete example might help better illustrate the idea of what I'm looking for, so let's take this okhttp auto-instrumentation for example, the only way Android users have to configure its behavior is through the OkHttpInstrumentationConfig config object, which is later used internally to build the okhttp instrumenter here. The
That sounds promising, I wasn't aware of that flag, though now that I think about it, it looks like it could be the simplest way to accomplish what I'm looking for. I'll take a deeper look at it today and run some tests to be sure, thanks!
I think this may be related to the issue that Trask shared above about making these decisions on samplers that are scope-aware. I guess the scope name could be enough for a global predicate to make a decision on what passes and what doesn't. |
Update: I think by using the |
Closing this issue as these changes are no longer needed. |
An approach to allow suppressing Spans for an Instrumenter instance.
Example usage:
The provided
SpanOmitter
s allow to either continue with the Span creation or not, and their decision can be changed at any point at runtime. This is useful to allow for remote config instrumentation filtering for example.By the way, I think
SpanSuppressor
could have been a better name but it was already taken.