-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
tail_sampling drops otel.library.name
span attribute
#13642
Comments
This is tricky: we are re-assembling the spans for a trace in a new ResourceSpans object, which likely came from different sources and with differing instrumentation libraries. We could reorganize things in a single pdata.Traces with several ResourceSpans inside them, one for each unique Resource+InstrumentationLibrary, but I feel like this would be highly inefficient. I'm leaving this open so that we can hear other people's opinions. @ryepup, would you be willing to perform the mentioned changes and check the performance difference? |
@jpkrohling As a workaround, is there a processor that can access the InstrumentationScope information and set it as an attribute on each individual Span before the span gets to the Tail Sampling Processor? We, for example, are reliant on Instrumentation Library information in order to classify the Span in a custom exporter component we've developed. |
Could you check whether the transform processor can read the instrumentation scope? |
@jpkrohling if i'm not mistaken, it looks like this was recently updated to have access to this scope, at least via the OTTL? Update: looks like this isn't yet in a released version (currently at |
Isn't this precisely what the component should be doing? If a sampler is losing information on spans that are not dropped that seems like a problem. |
im also wondering if this is less that the span attribute drops, and more that the telemetry loses view of the instrumentation scope itself when being tail-sampled this is a tough tradeoff for us, because we'd like to do some trace-specific sampling at the tail, but then it means that we'll lose instrumentation granularity when the traces are assembled |
That's true. I'm not sure what the original engineer had in mind when this component was written, but I believe they decided to gain some performance by avoiding the extra processing of reorganizing this data. I would be open to reviewing a PR with a proposal to change the current behavior. Bonus points if it could include a benchmark so that we can understand what we are giving up in terms of performance. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This caused major confusion and issues exporting traces & APM data to Datadog. It appears that Operation names & APM metrics We were able to solve this by Implementing the DatdogProcessor but i would love to see this get fixed so operation name in traces and metrics line up again. |
@roryharness, agree, this would be great to have. From my previous message:
|
@roryharness out of curiosity - what was your setup to retain the otel library name while tail sampling? |
The workaround we implemented was to add a custom span processor that is used by the SDK in code. This span processor takes the instrumentation library name and creates a Span Attribute on each Span with the value:
It is not elegant but it works for now. If you really really need the data to be there by the time it gets to tail_sampling... |
thanks @paychex-ssmithrand - i was able to do the same, but uncovering some other interesting behaviors through this experiment for context, i'm using the tailsampling processor similarly to @roryharness - i'm collecting spans (from the python OTEL SDK) through the Collector, passing them into a pipeline with the however the spans themselves appear to be missing some span level metadata after passing through the # SDK level
name = "my-custom-span-name"
with tracer.start_as_current_span(name):
...
# After tail sampling, the span name in the vendor shows as:
opentelemetry.internal obviously this is dependent on the way that datadog (the vendor) parses these spans, but I'm trying to better understand which span attributes/metadata is being lost in the |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Can you open an issue for that? I could probably look into that myself. |
Hello everyone! I have prepared a fix for this problem. This fix was already tested in the production environment under load 1k rps and all looks good. Please review and add comments! I will be happy to contribute to this project! PR: #25117 |
I reviewed this and looks good to me, but you might need to sort out the CLA check. |
…info (#25117) **Description:** Added saving instrumentation library information. Fix issue: #13642 How solved: 1. Add saving information about instrumentation scope for traces: processor/tailsamplingprocessor/processor.go:307 2. Sampled spans will now be put into the previous version of the instrumentation scope: processor/tailsamplingprocessor/processor.go:435 **Testing:** on production with high load. Unit tests in progress **Documentation:** no documentation changes
Fixed by #25117 |
Describe the bug
Spans that pass through a
tail_sampling
processor (evenalways_sample
) have theirotel.library.name
attribute removed.Steps to reproduce
Create an otel-collector configured with two receivers, one that does
tail_sampling
and one that doesn't. Send a trace to each, usinggo.opentelemetry.io/otel
. I've packaged this up with docker-compose in a gist.docker-compose up
What did you expect to see?
Both traces have a
otel.library.name
attribute that matches the name given toTracerProvider.Tracer
What did you see instead?
The trace that went through a pipeline with
tail_sampling
did not have anotel.library.name
What version did you use?
dockerized
otel/opentelemetry-collector-contrib:0.58.0
What config did you use?
https://gist.github.com/ryepup/d70eebd8b0e6bb1a4578ac7c06a842cf#file-otel-yaml
Environment
Seen in dockerized local development on osx and linux-based kubernetes on azure.
Additional context
My production code is passing through https://github.com/grafana/agent, but the problem is reproducible without that layer.
Other span attributes seem unaffected, even when added via another processor.
The text was updated successfully, but these errors were encountered: