Skip to content

Commit

Permalink
Respect otel security env var
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGustafsson committed Jan 2, 2025
1 parent 11f4e7d commit ae9df9a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions internal/otelutil/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ func Init(ctx context.Context, target string, insecure bool) (func(context.Conte
// NOTE: otlptracegrpc.New accepts config via OTEL_EXPORTER_OTLP_ENDPOINT and
// friends. That behavior does not seem to be configurable. For now, let's
// just keep it undocumented
exporter, err := otlptracegrpc.New(ctx,
otlptracegrpc.WithInsecure(),

options := []otlptracegrpc.Option{
otlptracegrpc.WithEndpoint(target),
)
}

if insecure {
options = append(options, otlptracegrpc.WithInsecure())
}

exporter, err := otlptracegrpc.New(ctx, options...)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit ae9df9a

Please sign in to comment.