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:
parent
12704e8839
commit
43f6a39aa1
1 changed files with 9 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue