beam-telemetry / cowboy_telemetry

Telemetry instrumentation for Cowboy
Apache License 2.0
30 stars 9 forks source link

attach spans to the request span #12

Closed RoadRunnr closed 2 years ago

RoadRunnr commented 2 years ago

The REAME says:

The telemetry handlers are executed from the cowboy connection process, not from the request process.

That mean the request process has no access to the span context. How am I then supposed to add subspans to the request span?

RoadRunnr commented 2 years ago

found it, would be nice to add this to the doc.

In the request handler, do this to restore the opentelemetry context:

    Ctx = opentelemetry_process_propagator:fetch_parent_ctx(),
    otel_ctx:attach(Ctx),
josevalim commented 2 years ago

This is specific to open telemetry, but I bet a pull request for docs there would be welcome.