Skip to content

Commit

Permalink
refactor: early returns
Browse files Browse the repository at this point in the history
Signed-off-by: Niklas Treml <[email protected]>
  • Loading branch information
niklastreml committed Oct 29, 2024
1 parent da9e6dd commit 6949727
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/sparrow/metrics/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,13 @@ func newGRPCExporter(ctx context.Context, config *Config) (sdktrace.SpanExporter
otlptracegrpc.WithEndpoint(config.Url),
otlptracegrpc.WithHeaders(headers),
}
if config.Tls.Enabled {
if tlsCfg != nil {
opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(tlsCfg)))
}
} else {

if !config.Tls.Enabled {
opts = append(opts, otlptracegrpc.WithInsecure())
return otlptracegrpc.New(ctx, opts...)
}
if tlsCfg != nil {
opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(tlsCfg)))
}

return otlptracegrpc.New(ctx, opts...)
Expand Down

0 comments on commit 6949727

Please sign in to comment.