You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After creating the span, was hoping someone else might have a better method for getting this context into the logs, the traces themselves seem to be working well.
The text was updated successfully, but these errors were encountered:
ShovelJockey
changed the title
trace_id is set only on FmtSpan::CLOSE not FmtSpan::NEW in logs
Setting trace and span id in logs.
Mar 22, 2024
If you set up you subscriber/formatter to print span attributes, then all logs after that record call should have your trace_id printed in them. That said this seems more like a question about tracing itself rather than about tracing-opentelemetry?
It's true this crate could probably create something to make this easier on users so that you wouldn't have to resort to manually appending the trace ID.
Apologies I am fairly new to setting up tracing, with many libraries working together its quite unclear where I should be trying to make these changes. Additionally trying to set ids in tracing seems to be an issue stumping alot of people from what I have seen from searching around.
Creating a custom formatter seems to be the best maybe, but so far seem to running into issues with this effecting the otlp exporter/pipeline.
Please close if this seems too off topic for this crate.
I am attempting to implement otel tracing with axum, I found a hacky method that seemed to work for some span events like close but not for new with:
span.record("trace_id", tracing_id::find_trace_id_from_tracing(&span));
After creating the span, was hoping someone else might have a better method for getting this context into the logs, the traces themselves seem to be working well.
The text was updated successfully, but these errors were encountered: