Skip to content

[Bug]: opentelemetry-appender-tracing (with experimental_use_tracing_span_context enabled) + axum-tracing-opentelemetry integration issue #2803

@Rudo2204

Description

@Rudo2204

What happened?

opentelemetry-appender-tracing (with experimental_use_tracing_span_context enabled #2438) failed to export trace_id when ingerating with with axum-tracing-opentelemetry's middlewares.

Context: I wanted to integrate my loco-rs app with axum-tracing-opentelemetry to get more telemetry data out of request & response. I followed the example in loco-extras (it's outdated at the moment), and managed to get it working. However when the middlewares from axum-tracing-opentelemetry are added, trace_id is no longer being exported.

Minimal repo with steps to reproduce the issue: https://github.com/Rudo2204/loco_otel_integration_issue (please read the steps in README file)

I don't think there is a problem with opentelemetry-appender-tracing, rather it likely has something to do with
tracing-opentelemetry-instrumentation-sdk creating a new span and setting trace_id to tracing::field::Empty? They seem to use a hack to get the trace_id from handler if needed.

OpenTelemetry API Version (i.e version of opentelemetry crate)

0.28.0

OpenTelemetry SDK Version (i.e version of opentelemetry_sdk crate)

0.28.0

What Exporter(s) are you seeing the problem on?

OTLP

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions