OpenCensus ConstantSampler::ALWAYS_PARENT makes the sample value always 1 if no parent
#17,358 opened on Jul 15, 2021
Repository metrics
- Stars
- (27,997 stars)
- PR merge metrics
- (Avg merge 8d) (378 merged PRs in 30d)
Description
Title: OpenCensus ConstantSampler::ALWAYS_PARENT makes the sample value always 1 if no parent
Description:
According to opencensus proto, the sample value will be off when setting ConstantSampler::ALWAYS_PARENT and there is no parent.
But here ConstantSampler::ALWAYS_PARENT and ConstantSampler::ALWAYS_ON have the same treatment.
Repro steps:
Enable envoy's tracing envoy.config.trace.v3.OpenCensusConfig and observe the TRACEPARENT in the log.
Admin and Stats Output:
No need.
Config:
config in lds.yaml:
access_log:
- name: envoy.access_loggers.file
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: /var/log/access.log
log_format:
text_format: "[%START_TIME%] balabala... \"%REQ(TRACEPARENT)%\"\n"
...
tracing:
provider:
name: envoy.tracers.opencensus
typed_config:
"@type": type.googleapis.com/envoy.config.trace.v3.OpenCensusConfig
trace_config:
constant_sampler:
decision: ALWAYS_PARENT
stdout_exporter_enabled: false
stackdriver_exporter_enabled: false
zipkin_exporter_enabled: false
ocagent_exporter_enabled: false
incoming_trace_context: ["TRACE_CONTEXT"]
outgoing_trace_context: ["TRACE_CONTEXT"]
Logs:
[2021-07-15T05:41:32.635Z] balabala... "00-22c7440c663b46660a15d376b2771b3b-fac98c165e9c09ea-01"
The last two letters in envoy's newly added TRACEPARENT are always 01.
https://www.w3.org/TR/trace-context/#examples-of-http-traceparent-headers
Call Stack:
No need.