Skip to content

Commit

Permalink
Add missing GRPC header (#165)
Browse files Browse the repository at this point in the history
Problem: F5 telemetry service requires the presence of the `X-F5-OTEL` header set to `GRPC`.

Solution: Rather than having users of the library set this value, set it by default in the exporter.
  • Loading branch information
sjberman authored Jul 18, 2024
1 parent 2525d8a commit 17e7492
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/telemetry/span_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ func CreateOTLPSpanProvider(options ...otlptracegrpc.Option) SpanProvider {

// newOTLPExporter creates a new gRPC OTLP exporter.
func newOTLPExporter(ctx context.Context, options ...otlptracegrpc.Option) (*otlptrace.Exporter, error) {
traceClient := otlptracegrpc.NewClient(options...)
defaultOptions := []otlptracegrpc.Option{
otlptracegrpc.WithHeaders(map[string]string{
"X-F5-OTEL": "GRPC",
}),
}

traceClient := otlptracegrpc.NewClient(append(defaultOptions, options...)...)
exp, err := otlptrace.New(ctx, traceClient)
if err != nil {
return nil, fmt.Errorf("failed to create OTLP exporter: %w", err)
Expand Down

0 comments on commit 17e7492

Please sign in to comment.