From 17eb5679e95f28abf4656d9184f0c168bf6ff1c2 Mon Sep 17 00:00:00 2001 From: Brett Lawson <> Date: Wed, 7 Aug 2024 11:25:24 -0700 Subject: [PATCH] ING-876: Fixed potential panic due to nil tracer. --- cmd/gateway/main.go | 6 ++---- go.mod | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index 1ba087c..be6b2f5 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -25,13 +25,11 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.4.0" - "go.opentelemetry.io/otel/trace" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) @@ -105,8 +103,8 @@ func initTelemetry( enableMetrics bool, traceEverything bool, ) ( - trace.TracerProvider, - metric.MeterProvider, + *sdktrace.TracerProvider, + *sdkmetric.MeterProvider, error, ) { res, err := resource.New(ctx, diff --git a/go.mod b/go.mod index e4b477a..86e1c25 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,6 @@ require ( go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk v1.28.0 go.opentelemetry.io/otel/sdk/metric v1.28.0 - go.opentelemetry.io/otel/trace v1.28.0 go.uber.org/zap v1.27.0 golang.org/x/exp v0.0.0-20240716175740-e3f259677ff7 golang.org/x/mod v0.19.0 @@ -82,6 +81,7 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect