envoyproxy/envoy

OpenCensus ConstantSampler::ALWAYS_PARENT makes the sample value always 1 if no parent

Open

#17.358 geöffnet am 15. Juli 2021

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)C++ (5.373 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (27.997 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T) (378 gemergte PRs in 30 T)

Beschreibung

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.

https://github.com/envoyproxy/envoy/blob/v1.19.0/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc#L358

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.

Contributor Guide