Skip to content

Commit

Permalink
fix memory leak from global MeterProvider
Browse files Browse the repository at this point in the history
Kubernetes-commit: b42f8d32b52776b1331c4dc8d898aae92ca4dfe3
  • Loading branch information
dashpole authored and k8s-publishing-bot committed Aug 28, 2024
1 parent 70ed6fd commit 81a2f90
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/server/options/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import (
"net"

"github.com/spf13/pflag"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/metric/noop"
"go.opentelemetry.io/otel/sdk/resource"
"go.opentelemetry.io/otel/semconv/v1.12.0"
"google.golang.org/grpc"
Expand All @@ -48,6 +50,12 @@ var (
codecs = serializer.NewCodecFactory(cfgScheme)
)

func init() {
// Prevent memory leak from OTel metrics, which we don't use:
// https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5190
otel.SetMeterProvider(noop.NewMeterProvider())
}

func init() {
install.Install(cfgScheme)
}
Expand Down

0 comments on commit 81a2f90

Please sign in to comment.