Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: NewSDK can return valid TracerProvider #4741

Merged
5 changes: 5 additions & 0 deletions config/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
for _, processor := range cfg.opentelemetryConfig.TracerProvider.Processors {
sp, err := spanProcessor(cfg.ctx, processor)
if err == nil {
opts = append(opts, sdktrace.WithSpanProcessor(sp))

Check warning on line 33 in config/trace.go

View check run for this annotation

Codecov / codecov/patch

config/trace.go#L33

Added line #L33 was not covered by tests
} else {
errs = append(errs, err)
}
Expand Down Expand Up @@ -94,6 +94,11 @@
if err != nil {
return nil, err
}
// ParseRequestURI leaves the Host field empty when no
// scheme is specified (i.e. localhost:4317). This check is
// here to support the case where a user may not specify a
// scheme. The code does its best effort here by using
// otlpConfig.Endpoint as-is in that case
pellared marked this conversation as resolved.
Show resolved Hide resolved
if u.Host != "" {
opts = append(opts, otlptracegrpc.WithEndpoint(u.Host))
} else {
Expand All @@ -109,7 +114,7 @@
switch *otlpConfig.Compression {
case compressionGzip:
opts = append(opts, otlptracegrpc.WithCompressor(*otlpConfig.Compression))
case compressionNone:

Check warning on line 117 in config/trace.go

View check run for this annotation

Codecov / codecov/patch

config/trace.go#L117

Added line #L117 was not covered by tests
// none requires no options
default:
return nil, fmt.Errorf("unsupported compression %q", *otlpConfig.Compression)
Expand Down