0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-04-01 02:42:35 -05:00

more explicit errors

This commit is contained in:
Archimedes Trajano 2024-07-28 19:25:13 -04:00
parent 12704e8839
commit 43f6a39aa1

View file

@ -62,13 +62,17 @@ func newOpenTelemetryWrapper(
}
protocol := os.Getenv("OTEL_EXPORTER_OTLP_PROTOCOL")
var traceExporter sdktrace.SpanExporter
if protocol == "http/protobuf" {
traceExporter, err := otlptracehttp.New(ctx)
traceExporter, err = otlptracehttp.New(ctx)
if err != nil {
return ot, fmt.Errorf("creating HTTP trace exporter error: %w", err)
}
} else {
traceExporter, err := otlptracegrpc.New(ctx)
}
if err != nil {
return ot, fmt.Errorf("creating trace exporter error: %w", err)
traceExporter, err = otlptracegrpc.New(ctx)
if err != nil {
return ot, fmt.Errorf("creating GRPC trace exporter error: %w", err)
}
}
ot.propagators = autoprop.NewTextMapPropagator()