-
Notifications
You must be signed in to change notification settings - Fork 86
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
OpenTelemetrySpanExt::set_parent
does not update trace ID in OtelData
#25
Comments
The trace id stored in the builder is primarily used to maintain a consistent trace id for the span's children when no parent context is set (for example a new root tracing span that has not yet ended and has no external parent). See example usage here which maintains a stable trace state for child spans: tracing-opentelemetry/src/tracer.rs Lines 119 to 136 in 5ce1b10
It is ignored if there is a parent span context, so it shouldn't cause issues in practice, but it should be safe to assign it to the new parent span context's trace id, or to tracing-opentelemetry/src/span_ext.rs Lines 120 to 131 in 5ce1b10
|
…okio-rs#25) Signed-off-by: David Mládek <david.mladek.cz@gmail.com>
Bug Report
Version
Platform
Linux DESKTOP 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Description
I used this code to create a span and manually change the parent as if I had a remote context to put there:
I have noticed that the
OtelData
associated with the span has different trace IDs inbuilder
andparent_cx
. That is because the span was created with no active span andOpenTelemetryLayer::on_new_span
created a trace ID. But when a parent context is added, I think this trace ID should be deleted as it should not be used. All other spans with parents also haveNone
as their trace ID in the builder.I do not believe the ID is actually used anywhere, but I think it would be safer to remove it because that would make it harder to misuse this. Unless that would break some guarantee, e.g. that the builder should never change.
The text was updated successfully, but these errors were encountered: