Skip to content

Empty trace_id when misconfiguring the opentelemetry version #135

@luca-iachini

Description

@luca-iachini

Hi, thanks for the tracing-actix-web crate.

I ran into an issue that I wanted to share. It involves a misconfiguration between the feature flag enabling opentelemetry in tracing-actix-web and the opentelemetry dependency in my project. The project compiled fine, and the application ran without errors, but the trace_id was always empty.

The issue seems to arise from global::set_text_map_propagator(TraceContextPropagator::new()) configuring the propagator for the main application but not for the internal dependency used by tracing-actix-web. It is easy to reproduce this issue by modifying one of the examples in this crate to use a different opentelemetry version than the one specified by the feature flag enabled for tracing-actix-web. In that case, tracing-actix-web uses the NoopTextMapPropagator instead of the one configured in the application.

Because there are no warnings or compile-time errors, it took me a while to figure this out. It would be great if there were a way to detect or prevent this kind of misconfiguration at compile time. Alternatively, adding a note in the documentation would help users who are encountering this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions