You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-23 22:34:47 +02:00
Example demonstrating how to use `SetTextMapPropagator` with a composite propagator Related Issue: Closes #6571 Co-authored-by: Damien Mathieu <42@dmathieu.com>
21 lines
474 B
Go
21 lines
474 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package propagation_test
|
|
|
|
import (
|
|
"go.opentelemetry.io/otel"
|
|
"go.opentelemetry.io/otel/propagation"
|
|
)
|
|
|
|
func ExampleSetTextMapPropagator() {
|
|
// Create a new composite text map propagator.
|
|
propagator := propagation.NewCompositeTextMapPropagator(
|
|
propagation.TraceContext{},
|
|
propagation.Baggage{},
|
|
)
|
|
|
|
// Set it as the global text map propagator.
|
|
otel.SetTextMapPropagator(propagator)
|
|
}
|