Skip to content

trace directive does not set traceparent header by default #7139

@Jiehong

Description

@Jiehong

Hello,

I'm trying to use the trace directive, but it's doing less than it should.

Eg:

:8081 {
  handle /hello {
  tracing {
    span app
  }
  respond 200 "hi"
  }
}

Looking at the spec for open telemetry traceparent header: https://www.w3.org/TR/trace-context/#traceparent-header

I'd expect:

  • generate a new traceparent if not present in the incoming request (it does!)
  • use the incoming traceparent header and create a new span id (it does!)
  • the traceparent header is returned in the http response (it does not)

So, using caddy as the front gateway, I do no receive a traceparent, but it does not send a traceparent header to backends behind.

The workaround is to write that header myself for each handler, hard-coding the flag:

:8081 {
  handle /hello {
  tracing {
    span app
  }
  header traceparent 00-{http.vars.trace_id}-{http.vars.span_id}-01
  respond 200 "hi"
  }
}

I'd expect tracing to automatically set the traceparent header in the header (to have it in the response, or to have it in the request sent via reverse_proxy)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions