Skip to content

Commit

Permalink
add b3 propagator
Browse files Browse the repository at this point in the history
Followup to #221
  • Loading branch information
gernest committed May 5, 2024
1 parent 602f53e commit 636606d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/stretchr/testify v1.9.0
github.com/swaggo/swag v1.16.3
go.opentelemetry.io/contrib/exporters/autoexport v0.51.0
go.opentelemetry.io/contrib/propagators/b3 v1.26.0
go.opentelemetry.io/otel v1.26.0
go.opentelemetry.io/otel/sdk v1.26.0
go.opentelemetry.io/otel/sdk/metric v1.26.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"go.opentelemetry.io/contrib/exporters/autoexport"
"go.opentelemetry.io/contrib/propagators/b3"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/propagation"
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
Expand Down Expand Up @@ -55,7 +56,8 @@ func NewTelemetry(cfg *Config) (*Telemetry, error) {
sdktrace.WithBatcher(spanExporter),
)
otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{},
propagation.Baggage{}, b3.New()))

metricsReader, err := autoexport.NewMetricReader(context.Background())
if err != nil {
Expand Down

0 comments on commit 636606d

Please sign in to comment.