Merge pull request #6874 from thaJeztah/rm_deprecated_otel_envs

util/tracing: remove fallbacks for OTEL_TRACE_PARENT, OTEL_TRACE_STATE
This commit is contained in:
Tõnis Tiigi
2026-06-22 23:57:29 -07:00
committed by GitHub
2 changed files with 3 additions and 22 deletions

View File

@@ -14,23 +14,13 @@ func init() {
func initContext(ctx context.Context) context.Context {
// open-telemetry/opentelemetry-specification#740
parent := os.Getenv("TRACEPARENT")
state := os.Getenv("TRACESTATE")
parent := os.Getenv("TRACEPARENT") // https://www.w3.org/TR/trace-context/#traceparent-header
state := os.Getenv("TRACESTATE") // https://www.w3.org/TR/trace-context/#tracestate-header
if parent != "" {
tc := propagation.TraceContext{}
return tc.Extract(ctx, &textMap{parent: parent, state: state})
}
// deprecated: removed in v0.11.0
// previously defined in https://github.com/open-telemetry/opentelemetry-swift/blob/4ea467ed4b881d7329bf2254ca7ed7f2d9d6e1eb/Sources/OpenTelemetrySdk/Trace/Propagation/EnvironmentContextPropagator.swift#L14-L15
parent = os.Getenv("OTEL_TRACE_PARENT")
state = os.Getenv("OTEL_TRACE_STATE")
if parent == "" {
return ctx
}
tc := propagation.TraceContext{}
return tc.Extract(ctx, &textMap{parent: parent, state: state})
return ctx
}

View File

@@ -15,15 +15,6 @@ func Environ(ctx context.Context) []string {
var env []string
// deprecated: removed in v0.11.0
// previously defined in https://github.com/open-telemetry/opentelemetry-swift/blob/4ea467ed4b881d7329bf2254ca7ed7f2d9d6e1eb/Sources/OpenTelemetrySdk/Trace/Propagation/EnvironmentContextPropagator.swift#L14-L15
if tm.parent != "" {
env = append(env, "OTEL_TRACE_PARENT="+tm.parent)
}
if tm.state != "" {
env = append(env, "OTEL_TRACE_STATE="+tm.state)
}
// open-telemetry/opentelemetry-specification#740
if tm.parent != "" {
env = append(env, "TRACEPARENT="+tm.parent)