-
Notifications
You must be signed in to change notification settings - Fork 3
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
Sampled TraceId produces recorded spans #13
Comments
Hi @Steffen911, thanks for reporting this issue! Yes, I think you're right that we should use However, I'm not sure if that will solve the problem you're encountering. In that line, we create a context for the newly created span. But said span was created using Do give it a try! If it solves the problem, I'm happy to merge it. |
Hey @unflxw, I'll open the PR for the parentContext, because I think it would be the correct setup anyway. It doesn't seem to fix the issue though based on my local experiments. It seems that the TraceFlags aren't interpreted when creating the span in https://github.com/appsignal/opentelemetry-instrumentation-bullmq/blob/main/src/instrumentation.ts#L474 as the resulting span has a Do you have any other ideas what it could be? |
I added #14, but it doesn't seem to address this issue. |
I think the default sampling behavior is to sample all traces, which is what you're seeing, regardless of the trace flags. I think you may need to configure OpenTelemetry to use the |
@unflxw Thank you so much! That was actually the perfect hint. We used a TraceIDRatioBasedSampler in all of our services which overwrote the ParentBasedSampler (which seems to be the default). So not using the TraceIDRatioBasedSampler fixed it for us. |
What happened
We added sampling to our application to reduce the total amount of spans ingested. We use head based sampling and make the decision on the producer side. We use the new
useProducerSpanAsConsumerParent
flag which means that we'd expect that the sample decision propagates down to the consumer spans. In our case, we still see consumer spans in our observability tool, even though the TraceFlag is set to00
. We validate the latter using thetraceparent
on the job opts.What we expect to happen
When the TraceFlags on the producerContext are set to
00
we expect the same thing on the consumer, i.e. the trace should be excluded from recording, if the producerContext is to be used.Solution approach
@unflxw I think the root cause might be that we still use the consumerContext as active here: https://github.com/appsignal/opentelemetry-instrumentation-bullmq/blob/main/src/instrumentation.ts#L511. Perhaps we should use the
parentContext
variable in this row as well?The text was updated successfully, but these errors were encountered: