This module provides integration with OpenTelemetry tracing facilities. It is implemented
as caddyhttp.MiddlewareHandler
and can be chained into a list of other handlers.
When enabled, it propagates an existing tracing context or will init a new one otherwise.
It is based on https://github.com/open-telemetry/opentelemetry-go
.
It can be configured using environment variables defined by spec.
IMPORTANT: Please, consider the version of https://github.com/open-telemetry/opentelemetry-go. Some parts of the specification may be not implemented yet.
Required by module environment variables are: OTEL_EXPORTER_OTLP_PROTOCOL/OTEL_EXPORTER_OTLP_TRACES_PROTOCOL and OTEL_PROPAGATORS.
If neither OTEL_EXPORTER_OTLP_INSECURE nor OTEL_EXPORTER_OTLP_SPAN_INSECURE is provided, then:
- If OTEL_EXPORTER_OTLP_CERTIFICATE or OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE are specified they will be used for TLS.
- Else if both OTEL_EXPORTER_OTLP_CERTIFICATE and OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE are not specified, then default
TLS with the default
tls.Config
config will be used for an exporter.
For the exporter configuration details, please see spec .
Example:
export OTEL_EXPORTER_OTLP_HEADERS="myAuthHeader=myToken"
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_PROPAGATORS=tracecontext,baggage
export OTEL_EXPORTER_OTLP_SPAN_INSECURE=false
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=localhost:12345
Here is an example of Caddyfile:
handle /myHanlder {
opentelemetry {
span_name my-span
}
reverse_proxy 127.0.0.1:8081
}
Please check span naming guideline .