Skip to content

Commit

Permalink
ensure metric level none disables metric readers
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten committed Nov 5, 2024
1 parent b2996cd commit 408f904
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {

views := disableHighCardinalityMetrics()

readers := cfg.Telemetry.Metrics.Readers
if cfg.Telemetry.Metrics.Level == configtelemetry.LevelNone {
readers = []config.MetricReader{}
}

sdk, err := config.NewSDK(
config.WithContext(ctx),
config.WithOpenTelemetryConfiguration(
Expand All @@ -145,7 +150,7 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {
Processors: cfg.Telemetry.Logs.Processors,
},
MeterProvider: &config.MeterProvider{
Readers: cfg.Telemetry.Metrics.Readers,
Readers: readers,
Views: views,
},
TracerProvider: &config.TracerProvider{
Expand Down

0 comments on commit 408f904

Please sign in to comment.