tracing: Add spanID field to access logs and http.vars.span_id placeholder

Signed-off-by: YifanYang6 <yifanyang6@link.cuhk.edu.cn>
This commit is contained in:
YifanYang6 2024-10-30 18:29:08 +08:00
parent 0afde921eb
commit 10fd59ff4f
No known key found for this signature in database
GPG key ID: 86B83E0E00CD68AC

View file

@ -10,7 +10,7 @@ When enabled, it will propagate an existing trace context or initialize a new on
It uses [gRPC](https://github.com/grpc/) as an exporter protocol and W3C [tracecontext](https://www.w3.org/TR/trace-context/) and [baggage](https://www.w3.org/TR/baggage/) as propagators. It uses [gRPC](https://github.com/grpc/) as an exporter protocol and W3C [tracecontext](https://www.w3.org/TR/trace-context/) and [baggage](https://www.w3.org/TR/baggage/) as propagators.
The trace ID is added to [access logs](/docs/caddyfile/directives/log) as the standard `traceID` field. Additionally, the `{http.vars.trace_id}` placeholder is made available, for example to add the ID to a (`request_header`)[request_header] to pass it to your app. The trace ID and span ID are added to [access logs](/docs/caddyfile/directives/log) as the standard `traceID` and `spanID` fields. Additionally, the `{http.vars.trace_id}` and `{http.vars.span_id}` placeholders are available; for example, you can use them in a [`request_header`](request_header) to pass the IDs to your app.