From 969269333dfd17dc81bf876493fe64c6dfcd58e0 Mon Sep 17 00:00:00 2001 From: shinigami-777 Date: Fri, 1 Nov 2024 01:46:35 +0530 Subject: [PATCH 1/5] added meter provider in telemetery settings Signed-off-by: shinigami-777 --- cmd/collector/app/handler/otlp_receiver.go | 6 ++++-- cmd/collector/app/handler/zipkin_receiver.go | 6 ++++-- pkg/telemetery/settings.go | 9 +++++++++ plugin/storage/grpc/factory.go | 4 +++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cmd/collector/app/handler/otlp_receiver.go b/cmd/collector/app/handler/otlp_receiver.go index fb54d931bf8..8331265e55a 100644 --- a/cmd/collector/app/handler/otlp_receiver.go +++ b/cmd/collector/app/handler/otlp_receiver.go @@ -28,6 +28,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/collector/app/flags" "github.com/jaegertracing/jaeger/cmd/collector/app/processor" "github.com/jaegertracing/jaeger/pkg/config/tlscfg" + "github.com/jaegertracing/jaeger/pkg/telemetery" "github.com/jaegertracing/jaeger/pkg/tenancy" ) @@ -68,15 +69,16 @@ func startOTLPReceiver( // TODO this could be wired into changing healthcheck.HealthCheck logger.Info("OTLP receiver status change", zap.Stringer("status", ev.Status())) } + settings := telemetery.InitializeNewMeterProvider() otlpReceiverSettings := receiver.Settings{ TelemetrySettings: component.TelemetrySettings{ Logger: logger, TracerProvider: nooptrace.NewTracerProvider(), // TODO wire this with jaegerlib metrics? LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noopmetric.NewMeterProvider() + return settings.MeterProvider }, - MeterProvider: noopmetric.NewMeterProvider(), + MeterProvider: settings.MeterProvider, }, } diff --git a/cmd/collector/app/handler/zipkin_receiver.go b/cmd/collector/app/handler/zipkin_receiver.go index 983ee4bd2a5..54c4d0d970f 100644 --- a/cmd/collector/app/handler/zipkin_receiver.go +++ b/cmd/collector/app/handler/zipkin_receiver.go @@ -19,6 +19,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/collector/app/flags" "github.com/jaegertracing/jaeger/cmd/collector/app/processor" + "github.com/jaegertracing/jaeger/pkg/telemetery" "github.com/jaegertracing/jaeger/pkg/tenancy" ) @@ -62,15 +63,16 @@ func startZipkinReceiver( CORS: options.HTTP.CORS, // TODO keepAlive not supported? }) + settings := telemetery.InitializeNewMeterProvider() receiverSettings := receiver.Settings{ TelemetrySettings: component.TelemetrySettings{ Logger: logger, TracerProvider: nooptrace.NewTracerProvider(), // TODO wire this with jaegerlib metrics? LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noopmetric.NewMeterProvider() + return settings.MeterProvider }, - MeterProvider: noopmetric.NewMeterProvider(), + MeterProvider: settings.MeterProvider, }, } diff --git a/pkg/telemetery/settings.go b/pkg/telemetery/settings.go index eef11f4a77f..0aa4d78fe04 100644 --- a/pkg/telemetery/settings.go +++ b/pkg/telemetery/settings.go @@ -6,6 +6,7 @@ package telemetery import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" "go.uber.org/zap" @@ -19,6 +20,7 @@ type Setting struct { Metrics metrics.Factory ReportStatus func(*componentstatus.Event) Host component.Host + MeterProvider metric.MeterProvider } func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) { @@ -40,3 +42,10 @@ func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) { hc.Set(hcStatus) } } + +func InitializeNewMeterProvider() *Setting { + meterProvider := metric.NewMeterProvider() + return &Setting{ + MeterProvider: meterProvider, + } +} diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index b5ceac8a3aa..4e2cf6bcc7d 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -26,6 +26,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/bearertoken" "github.com/jaegertracing/jaeger/pkg/metrics" + "github.com/jaegertracing/jaeger/pkg/telemetery" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" @@ -238,7 +239,8 @@ func getTelset(logger *zap.Logger, tracerProvider trace.TracerProvider) componen TracerProvider: tracerProvider, // TODO needs to be joined with the metricsFactory LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noopmetric.NewMeterProvider() + settings := telemetery.InitializeNewMeterProvider() + return settings.MeterProvider }, } } From 53dbac9f57f6b9d218a2e98de23d7297fa8516eb Mon Sep 17 00:00:00 2001 From: shinigami-777 Date: Sat, 2 Nov 2024 18:35:27 +0530 Subject: [PATCH 2/5] added LeveledMeterProvider Signed-off-by: shinigami-777 --- cmd/collector/app/handler/otlp_receiver.go | 6 ++---- cmd/collector/app/handler/zipkin_receiver.go | 6 ++---- .../internal/extension/jaegerquery/server.go | 3 ++- cmd/query/app/server_test.go | 10 ++++++---- pkg/telemetery/settings.go | 20 +++++++------------ plugin/storage/grpc/factory.go | 4 +--- 6 files changed, 20 insertions(+), 29 deletions(-) diff --git a/cmd/collector/app/handler/otlp_receiver.go b/cmd/collector/app/handler/otlp_receiver.go index 8331265e55a..fb54d931bf8 100644 --- a/cmd/collector/app/handler/otlp_receiver.go +++ b/cmd/collector/app/handler/otlp_receiver.go @@ -28,7 +28,6 @@ import ( "github.com/jaegertracing/jaeger/cmd/collector/app/flags" "github.com/jaegertracing/jaeger/cmd/collector/app/processor" "github.com/jaegertracing/jaeger/pkg/config/tlscfg" - "github.com/jaegertracing/jaeger/pkg/telemetery" "github.com/jaegertracing/jaeger/pkg/tenancy" ) @@ -69,16 +68,15 @@ func startOTLPReceiver( // TODO this could be wired into changing healthcheck.HealthCheck logger.Info("OTLP receiver status change", zap.Stringer("status", ev.Status())) } - settings := telemetery.InitializeNewMeterProvider() otlpReceiverSettings := receiver.Settings{ TelemetrySettings: component.TelemetrySettings{ Logger: logger, TracerProvider: nooptrace.NewTracerProvider(), // TODO wire this with jaegerlib metrics? LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return settings.MeterProvider + return noopmetric.NewMeterProvider() }, - MeterProvider: settings.MeterProvider, + MeterProvider: noopmetric.NewMeterProvider(), }, } diff --git a/cmd/collector/app/handler/zipkin_receiver.go b/cmd/collector/app/handler/zipkin_receiver.go index 54c4d0d970f..983ee4bd2a5 100644 --- a/cmd/collector/app/handler/zipkin_receiver.go +++ b/cmd/collector/app/handler/zipkin_receiver.go @@ -19,7 +19,6 @@ import ( "github.com/jaegertracing/jaeger/cmd/collector/app/flags" "github.com/jaegertracing/jaeger/cmd/collector/app/processor" - "github.com/jaegertracing/jaeger/pkg/telemetery" "github.com/jaegertracing/jaeger/pkg/tenancy" ) @@ -63,16 +62,15 @@ func startZipkinReceiver( CORS: options.HTTP.CORS, // TODO keepAlive not supported? }) - settings := telemetery.InitializeNewMeterProvider() receiverSettings := receiver.Settings{ TelemetrySettings: component.TelemetrySettings{ Logger: logger, TracerProvider: nooptrace.NewTracerProvider(), // TODO wire this with jaegerlib metrics? LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return settings.MeterProvider + return noopmetric.NewMeterProvider() }, - MeterProvider: settings.MeterProvider, + MeterProvider: noopmetric.NewMeterProvider(), }, } diff --git a/cmd/jaeger/internal/extension/jaegerquery/server.go b/cmd/jaeger/internal/extension/jaegerquery/server.go index 46bcfc4cc87..02bc5df0f6a 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server.go @@ -100,7 +100,8 @@ func (s *server) Start(ctx context.Context, host component.Host) error { ReportStatus: func(event *componentstatus.Event) { componentstatus.ReportStatus(host, event) }, - Host: host, + Host: host, + LeveledMeterProvider: s.telset.LeveledMeterProvider, } s.server, err = queryApp.NewServer( diff --git a/cmd/query/app/server_test.go b/cmd/query/app/server_test.go index fbc7360483f..a1510bda0b9 100644 --- a/cmd/query/app/server_test.go +++ b/cmd/query/app/server_test.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/confignet" "go.opentelemetry.io/collector/config/configtls" + noopmetric "go.opentelemetry.io/otel/metric/noop" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" "go.uber.org/zap" @@ -49,10 +50,11 @@ var testCertKeyLocation = "../../../pkg/config/tlscfg/testdata" func initTelSet(logger *zap.Logger, tracerProvider *jtracer.JTracer, hc *healthcheck.HealthCheck) telemetery.Setting { return telemetery.Setting{ - Logger: logger, - TracerProvider: tracerProvider.OTEL, - ReportStatus: telemetery.HCAdapter(hc), - Host: componenttest.NewNopHost(), + Logger: logger, + TracerProvider: tracerProvider.OTEL, + ReportStatus: telemetery.HCAdapter(hc), + Host: componenttest.NewNopHost(), + LeveledMeterProvider: noopmetric.NewMeterProvider(), } } diff --git a/pkg/telemetery/settings.go b/pkg/telemetery/settings.go index 0aa4d78fe04..5b1a3ea774e 100644 --- a/pkg/telemetery/settings.go +++ b/pkg/telemetery/settings.go @@ -6,6 +6,7 @@ package telemetery import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" "go.uber.org/zap" @@ -15,12 +16,12 @@ import ( ) type Setting struct { - Logger *zap.Logger - TracerProvider trace.TracerProvider - Metrics metrics.Factory - ReportStatus func(*componentstatus.Event) - Host component.Host - MeterProvider metric.MeterProvider + Logger *zap.Logger + TracerProvider trace.TracerProvider + Metrics metrics.Factory + ReportStatus func(*componentstatus.Event) + Host component.Host + LeveledMeterProvider func(_ configtelemetry.Level) metric.MeterProvider } func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) { @@ -42,10 +43,3 @@ func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) { hc.Set(hcStatus) } } - -func InitializeNewMeterProvider() *Setting { - meterProvider := metric.NewMeterProvider() - return &Setting{ - MeterProvider: meterProvider, - } -} diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index 4e2cf6bcc7d..b5ceac8a3aa 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -26,7 +26,6 @@ import ( "github.com/jaegertracing/jaeger/pkg/bearertoken" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" @@ -239,8 +238,7 @@ func getTelset(logger *zap.Logger, tracerProvider trace.TracerProvider) componen TracerProvider: tracerProvider, // TODO needs to be joined with the metricsFactory LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - settings := telemetery.InitializeNewMeterProvider() - return settings.MeterProvider + return noopmetric.NewMeterProvider() }, } } From 332c21f4fa38fc0506921044e7228fe8a52e2e19 Mon Sep 17 00:00:00 2001 From: shinigami-777 Date: Thu, 7 Nov 2024 20:52:31 +0530 Subject: [PATCH 3/5] used Leveledmeterprovider setting in query server Signed-off-by: shinigami-777 --- cmd/query/app/server.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/query/app/server.go b/cmd/query/app/server.go index 043fe978d3c..97e150d99ab 100644 --- a/cmd/query/app/server.go +++ b/cmd/query/app/server.go @@ -150,9 +150,7 @@ func createGRPCServer( component.TelemetrySettings{ Logger: telset.Logger, TracerProvider: telset.TracerProvider, - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, + LeveledMeterProvider: telset.LeveledMeterProvider, }, grpcOpts...) } @@ -221,8 +219,7 @@ func createHTTPServer( component.TelemetrySettings{ Logger: telset.Logger, TracerProvider: telset.TracerProvider, - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() + LeveledMeterProvider: telset.LeveledMeterProvider, }, }, handler, From 3c9e58d2b91c5f89fdad3cad0c47a8f7762c5569 Mon Sep 17 00:00:00 2001 From: shinigami-777 Date: Thu, 7 Nov 2024 21:00:15 +0530 Subject: [PATCH 4/5] error resolved Signed-off-by: shinigami-777 --- cmd/query/app/server.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/query/app/server.go b/cmd/query/app/server.go index 97e150d99ab..6e1ff1c11e3 100644 --- a/cmd/query/app/server.go +++ b/cmd/query/app/server.go @@ -148,8 +148,8 @@ func createGRPCServer( ctx, telset.Host, component.TelemetrySettings{ - Logger: telset.Logger, - TracerProvider: telset.TracerProvider, + Logger: telset.Logger, + TracerProvider: telset.TracerProvider, LeveledMeterProvider: telset.LeveledMeterProvider, }, grpcOpts...) @@ -217,10 +217,9 @@ func createHTTPServer( ctx, telset.Host, component.TelemetrySettings{ - Logger: telset.Logger, - TracerProvider: telset.TracerProvider, + Logger: telset.Logger, + TracerProvider: telset.TracerProvider, LeveledMeterProvider: telset.LeveledMeterProvider, - }, }, handler, ) From c9a75e7e90f5b7a4f06c2e280e090a6b54e994ad Mon Sep 17 00:00:00 2001 From: shinigami-777 Date: Fri, 8 Nov 2024 11:55:00 +0530 Subject: [PATCH 5/5] propagated leveledmeterprovider setting Signed-off-by: shinigami-777 --- cmd/all-in-one/main.go | 6 ++++++ cmd/query/app/server.go | 3 --- cmd/query/app/server_test.go | 14 +++++++++----- cmd/query/app/token_propagation_test.go | 6 ++++++ cmd/query/main.go | 6 ++++++ cmd/remote-storage/app/server_test.go | 15 +++++++++++++++ cmd/remote-storage/main.go | 6 ++++++ pkg/telemetery/settings.go | 2 +- .../storage/integration/remote_memory_storage.go | 6 ++++++ 9 files changed, 55 insertions(+), 9 deletions(-) diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go index e5718a2afff..fb2e162f477 100644 --- a/cmd/all-in-one/main.go +++ b/cmd/all-in-one/main.go @@ -14,6 +14,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" _ "go.uber.org/automaxprocs" "go.uber.org/zap" @@ -161,6 +164,9 @@ by default uses only in-memory database.`, TracerProvider: tracer.OTEL, Metrics: queryMetricsFactory, ReportStatus: telemetery.HCAdapter(svc.HC()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } // query querySrv := startQuery( diff --git a/cmd/query/app/server.go b/cmd/query/app/server.go index 6e1ff1c11e3..70dcecd86f4 100644 --- a/cmd/query/app/server.go +++ b/cmd/query/app/server.go @@ -17,9 +17,6 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/config/configgrpc" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/health" diff --git a/cmd/query/app/server_test.go b/cmd/query/app/server_test.go index a1510bda0b9..62f682930c3 100644 --- a/cmd/query/app/server_test.go +++ b/cmd/query/app/server_test.go @@ -21,7 +21,9 @@ import ( "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/confignet" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/config/configtls" + "go.opentelemetry.io/otel/metric" noopmetric "go.opentelemetry.io/otel/metric/noop" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" @@ -50,11 +52,13 @@ var testCertKeyLocation = "../../../pkg/config/tlscfg/testdata" func initTelSet(logger *zap.Logger, tracerProvider *jtracer.JTracer, hc *healthcheck.HealthCheck) telemetery.Setting { return telemetery.Setting{ - Logger: logger, - TracerProvider: tracerProvider.OTEL, - ReportStatus: telemetery.HCAdapter(hc), - Host: componenttest.NewNopHost(), - LeveledMeterProvider: noopmetric.NewMeterProvider(), + Logger: logger, + TracerProvider: tracerProvider.OTEL, + ReportStatus: telemetery.HCAdapter(hc), + Host: componenttest.NewNopHost(), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } } diff --git a/cmd/query/app/token_propagation_test.go b/cmd/query/app/token_propagation_test.go index 81ec248e4c6..2ccd7007a49 100644 --- a/cmd/query/app/token_propagation_test.go +++ b/cmd/query/app/token_propagation_test.go @@ -17,6 +17,9 @@ import ( "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/confignet" + "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap/zaptest" "github.com/jaegertracing/jaeger/cmd/internal/flags" @@ -89,6 +92,9 @@ func runQueryService(t *testing.T, esURL string) *Server { Logger: flagsSvc.Logger, TracerProvider: jtracer.NoOp().OTEL, ReportStatus: telemetery.HCAdapter(flagsSvc.HC()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } server, err := NewServer(context.Background(), querySvc, nil, &QueryOptions{ diff --git a/cmd/query/main.go b/cmd/query/main.go index 1e8197d3e3f..a9ea57f726b 100644 --- a/cmd/query/main.go +++ b/cmd/query/main.go @@ -12,6 +12,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" _ "go.uber.org/automaxprocs" "go.uber.org/zap" @@ -108,6 +111,9 @@ func main() { Logger: logger, TracerProvider: jt.OTEL, ReportStatus: telemetery.HCAdapter(svc.HC()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } server, err := app.NewServer(context.Background(), queryService, metricsQueryService, queryOpts, tm, telset) if err != nil { diff --git a/cmd/remote-storage/app/server_test.go b/cmd/remote-storage/app/server_test.go index 292266dd9ce..ae8361c1145 100644 --- a/cmd/remote-storage/app/server_test.go +++ b/cmd/remote-storage/app/server_test.go @@ -13,6 +13,9 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" "google.golang.org/grpc" @@ -45,6 +48,9 @@ func TestNewServer_CreateStorageErrors(t *testing.T) { telset := telemetery.Setting{ Logger: zap.NewNop(), ReportStatus: func(*componentstatus.Event) {}, + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } f := func() (*Server, error) { return NewServer( @@ -116,6 +122,9 @@ func TestNewServer_TLSConfigError(t *testing.T) { telset := telemetery.Setting{ Logger: zap.NewNop(), ReportStatus: telemetery.HCAdapter(healthcheck.New()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } storageMocks := newStorageMocks() _, err := NewServer( @@ -324,6 +333,9 @@ func TestServerGRPCTLS(t *testing.T) { telset := telemetery.Setting{ Logger: flagsSvc.Logger, ReportStatus: telemetery.HCAdapter(flagsSvc.HC()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } server, err := NewServer( serverOptions, @@ -373,6 +385,9 @@ func TestServerHandlesPortZero(t *testing.T) { telset := telemetery.Setting{ Logger: flagsSvc.Logger, ReportStatus: telemetery.HCAdapter(flagsSvc.HC()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } server, err := NewServer( &Options{GRPCHostPort: ":0"}, diff --git a/cmd/remote-storage/main.go b/cmd/remote-storage/main.go index 0289a1bee5f..0707c105d6b 100644 --- a/cmd/remote-storage/main.go +++ b/cmd/remote-storage/main.go @@ -10,6 +10,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" _ "go.uber.org/automaxprocs" "go.uber.org/zap" @@ -70,6 +73,9 @@ func main() { telset := telemetery.Setting{ Logger: svc.Logger, ReportStatus: telemetery.HCAdapter(svc.HC()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } server, err := app.NewServer(opts, storageFactory, tm, telset) if err != nil { diff --git a/pkg/telemetery/settings.go b/pkg/telemetery/settings.go index 5b1a3ea774e..0323ca1bcda 100644 --- a/pkg/telemetery/settings.go +++ b/pkg/telemetery/settings.go @@ -21,7 +21,7 @@ type Setting struct { Metrics metrics.Factory ReportStatus func(*componentstatus.Event) Host component.Host - LeveledMeterProvider func(_ configtelemetry.Level) metric.MeterProvider + LeveledMeterProvider func(configtelemetry.Level) metric.MeterProvider } func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) { diff --git a/plugin/storage/integration/remote_memory_storage.go b/plugin/storage/integration/remote_memory_storage.go index 7ac8d90551f..6a64f67e01c 100644 --- a/plugin/storage/integration/remote_memory_storage.go +++ b/plugin/storage/integration/remote_memory_storage.go @@ -10,6 +10,9 @@ import ( "time" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" "go.uber.org/zap/zaptest" "google.golang.org/grpc" @@ -51,6 +54,9 @@ func StartNewRemoteMemoryStorage(t *testing.T) *RemoteMemoryStorage { telset := telemetery.Setting{ Logger: logger, ReportStatus: telemetery.HCAdapter(healthcheck.New()), + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return noopmetric.NewMeterProvider() + }, } server, err := app.NewServer(opts, storageFactory, tm, telset) require.NoError(t, err)