Skip to content

Does pure OTel tracing work without tracing package? #278

@RolandColored

Description

@RolandColored

Bug description

I'm running request-tracing with opentelemetry_0_31 flag and doing pure OTel tracing so far. But I struggle to get outgoing requests properly annotated with a trace id.

To Reproduce

let tracer = global::tracer("foobar");
let url = format!("{service_url}/endpoint");

tracer.in_span("fetch_foo", async |_cx| {
    let client = ClientBuilder::new(reqwest::Client::new())
        .with(TracingMiddleware::default())
        .build();
    let response = client.get(&url)...
});

Expected behavior

OTel headers should be injected into the HTTP headers, but none to be found.

Environment

Linux & Mac

Additional context

I debugged into otel.rs - fn inject_opentelemetry_context_into_request and noticed that call to

let context = Span::current().context();

yields a None span. Span references the tracing package, which is not configured in my case. So I wonder if the tracing package is actually a hard requirement?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions