mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 12:36:16 -04:00
http.vars.trace_id placeholder
This commit is contained in:
parent
58527b688a
commit
c43b2d482b
1 changed files with 8 additions and 1 deletions
|
@ -10,7 +10,9 @@ 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.
|
||||
|
||||
The trace ID is added to [access logs](/docs/caddyfile/directives/log) as the standard `traceID` field.
|
||||
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.
|
||||
|
||||
|
||||
|
||||
## Syntax
|
||||
|
||||
|
@ -24,6 +26,8 @@ tracing {
|
|||
|
||||
[Placeholders](/docs/caddyfile/concepts#placeholders) may be used in span names; keep in mind that tracing happens as early as possible, so only request placeholders may be used, and not response placeholders.
|
||||
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment variables
|
||||
|
@ -41,6 +45,8 @@ export OTEL_EXPORTER_OTLP_HEADERS="myAuthHeader=myToken,anotherHeader=value"
|
|||
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://my-otlp-endpoint:55680
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
Here is a **Caddyfile** example:
|
||||
|
@ -51,6 +57,7 @@ example.com {
|
|||
tracing {
|
||||
span api
|
||||
}
|
||||
request_header X-Trace-Id {http.vars.trace_id}
|
||||
reverse_proxy localhost:8081
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue