| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package b3_test |
| 5 |
|
| 6 |
import ( |
| 7 |
"go.opentelemetry.io/otel" |
| 8 |
|
| 9 |
"go.opentelemetry.io/contrib/propagators/b3" |
| 10 |
) |
| 11 |
|
| 12 |
func ExampleNew() { |
| 13 |
p := b3.New() |
| 14 |
// Register the B3 propagator globally. |
| 15 |
otel.SetTextMapPropagator(p) |
| 16 |
} |
| 17 |
|
| 18 |
func ExampleNew_injectEncoding() { |
| 19 |
// Create a B3 propagator configured to inject context with both multiple |
| 20 |
// and single header B3 HTTP encoding. |
| 21 |
p := b3.New(b3.WithInjectEncoding(b3.B3MultipleHeader | b3.B3SingleHeader)) |
| 22 |
otel.SetTextMapPropagator(p) |
| 23 |
} |