-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Thanos, Prometheus and Golang version used:
thanos, version 0.29.0 (branch: HEAD, revision: 194e1fadf4302341a0c70c28c0e3f3c658616c19)
build user: root@a0c7bba6c208
build date: 20221103-14:28:25
go version: go1.19.3
platform: linux/amd64
Object Storage Provider: GCP
What happened:
When tracing was configured with:
---
config:
client_type: grpc
compression: gzip
endpoint: localhost:4317
insecure: true
type: OTLP
and the process was running with env var OTEL_TRACES_SAMPLER="alwaysoff"
traces continued to be emitted.
What you expected to happen:
The OTLP SDK should respond to env vars like OTEL_TRACES_SAMPLER
and OTEL_TRACES_SAMPLER_ARG
as detailed in
https://opentelemetry.io/docs/reference/specification/sdk-environment-variables/#general-sdk-configuration
How to reproduce it (as minimally and precisely as possible):
Run thanos 0.29.0 with --tracing.config-file=/etc/thanos/tracing.yml
and tracing.yaml
of
---
config:
client_type: grpc
compression: gzip
endpoint: localhost:4317
insecure: true
type: OTLP
Anything else we need to know:
It appears that the sampler is hard coded as tracesdk.ParentBased(tracesdk.TraceIDRatioBased(1.0))
and tracesdk.WithSampler
As documented in https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#WithSampler:
This option overrides the Sampler configured through the OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG environment variables. If this option is not used and the sampler is not configured through environment variables or the environment contains invalid/unsupported configuration, the TracerProvider will use a ParentBased(AlwaysSample) Sampler by default.
Since the effective behavior of the sampler where ParentBased(tracesdk.TraceIDRatioBased(1.0))
is equivalent to ParentBased(AlwaysSample)
, removing the sampler in the code will have no effective change in the default behavior, but would allow env var configuration to occur.