mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Update deprecated otel functions
Use new `noop.NewTracerProvider` function. Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
parent
9e90b90eb3
commit
d91ebffb30
|
@ -32,6 +32,7 @@ import (
|
|||
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
"google.golang.org/grpc/credentials"
|
||||
|
||||
"github.com/prometheus/prometheus/config"
|
||||
|
@ -87,7 +88,7 @@ func (m *Manager) ApplyConfig(cfg *config.Config) error {
|
|||
if cfg.TracingConfig.Endpoint == "" {
|
||||
m.config = cfg.TracingConfig
|
||||
m.shutdownFunc = nil
|
||||
otel.SetTracerProvider(trace.NewNoopTracerProvider())
|
||||
otel.SetTracerProvider(noop.NewTracerProvider())
|
||||
level.Info(m.logger).Log("msg", "Tracing provider uninstalled.")
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
config_util "github.com/prometheus/common/config"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
|
||||
"github.com/prometheus/prometheus/config"
|
||||
)
|
||||
|
@ -105,7 +105,7 @@ func TestUninstallingTracerProvider(t *testing.T) {
|
|||
}
|
||||
|
||||
require.NoError(t, m.ApplyConfig(&cfg))
|
||||
require.NotEqual(t, trace.NewNoopTracerProvider(), otel.GetTracerProvider())
|
||||
require.NotEqual(t, noop.NewTracerProvider(), otel.GetTracerProvider())
|
||||
|
||||
// Uninstall by passing empty config.
|
||||
cfg2 := config.Config{
|
||||
|
@ -114,7 +114,7 @@ func TestUninstallingTracerProvider(t *testing.T) {
|
|||
|
||||
require.NoError(t, m.ApplyConfig(&cfg2))
|
||||
// Make sure we get a no-op tracer provider after uninstallation.
|
||||
require.Equal(t, trace.NewNoopTracerProvider(), otel.GetTracerProvider())
|
||||
require.Equal(t, noop.NewTracerProvider(), otel.GetTracerProvider())
|
||||
}
|
||||
|
||||
func TestTracerProviderShutdown(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue