From 0981a9802961a9c70751c0a23bcc95e3de750df0 Mon Sep 17 00:00:00 2001 From: Paulin Todev Date: Wed, 8 May 2024 11:04:57 +0100 Subject: [PATCH] Set OTel metrics telemetry level to "detailed". --- docs/sources/reference/components/otelcol.processor.batch.md | 1 + internal/component/otelcol/auth/auth.go | 2 ++ internal/component/otelcol/connector/connector.go | 2 ++ internal/component/otelcol/exporter/exporter.go | 2 ++ internal/component/otelcol/extension/extension.go | 2 ++ internal/component/otelcol/processor/processor.go | 2 ++ internal/component/otelcol/receiver/prometheus/prometheus.go | 2 ++ internal/component/otelcol/receiver/receiver.go | 2 ++ 8 files changed, 15 insertions(+) diff --git a/docs/sources/reference/components/otelcol.processor.batch.md b/docs/sources/reference/components/otelcol.processor.batch.md index 79190c5e55..3885e41444 100644 --- a/docs/sources/reference/components/otelcol.processor.batch.md +++ b/docs/sources/reference/components/otelcol.processor.batch.md @@ -128,6 +128,7 @@ information. ## Debug metrics +* `processor_batch_batch_send_size_bytes` (histogram): Number of bytes in batch that was sent. * `processor_batch_batch_send_size_ratio` (histogram): Number of units in the batch. * `processor_batch_metadata_cardinality_ratio` (gauge): Number of distinct metadata value combinations being processed. * `processor_batch_timeout_trigger_send_ratio_total` (counter): Number of times the batch was sent due to a timeout trigger. diff --git a/internal/component/otelcol/auth/auth.go b/internal/component/otelcol/auth/auth.go index 22a802f911..63adfa6c38 100644 --- a/internal/component/otelcol/auth/auth.go +++ b/internal/component/otelcol/auth/auth.go @@ -18,6 +18,7 @@ import ( "github.com/grafana/alloy/syntax" "github.com/prometheus/client_golang/prometheus" otelcomponent "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" otelextension "go.opentelemetry.io/collector/extension" sdkprometheus "go.opentelemetry.io/otel/exporters/prometheus" "go.opentelemetry.io/otel/sdk/metric" @@ -140,6 +141,7 @@ func (a *Auth) Update(args component.Arguments) error { TracerProvider: a.opts.Tracer, MeterProvider: metric.NewMeterProvider(metric.WithReader(promExporter)), + MetricsLevel: configtelemetry.LevelDetailed, ReportStatus: func(*otelcomponent.StatusEvent) {}, }, diff --git a/internal/component/otelcol/connector/connector.go b/internal/component/otelcol/connector/connector.go index 5f82255a99..a7511f8b49 100644 --- a/internal/component/otelcol/connector/connector.go +++ b/internal/component/otelcol/connector/connector.go @@ -17,6 +17,7 @@ import ( "github.com/grafana/alloy/internal/util/zapadapter" "github.com/prometheus/client_golang/prometheus" otelcomponent "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" otelconnector "go.opentelemetry.io/collector/connector" otelextension "go.opentelemetry.io/collector/extension" sdkprometheus "go.opentelemetry.io/otel/exporters/prometheus" @@ -149,6 +150,7 @@ func (p *Connector) Update(args component.Arguments) error { TracerProvider: p.opts.Tracer, MeterProvider: metric.NewMeterProvider(metric.WithReader(promExporter)), + MetricsLevel: configtelemetry.LevelDetailed, ReportStatus: func(*otelcomponent.StatusEvent) {}, }, diff --git a/internal/component/otelcol/exporter/exporter.go b/internal/component/otelcol/exporter/exporter.go index 1bee106879..96eb1dab26 100644 --- a/internal/component/otelcol/exporter/exporter.go +++ b/internal/component/otelcol/exporter/exporter.go @@ -17,6 +17,7 @@ import ( "github.com/grafana/alloy/internal/util/zapadapter" "github.com/prometheus/client_golang/prometheus" otelcomponent "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" otelexporter "go.opentelemetry.io/collector/exporter" otelextension "go.opentelemetry.io/collector/extension" sdkprometheus "go.opentelemetry.io/otel/exporters/prometheus" @@ -173,6 +174,7 @@ func (e *Exporter) Update(args component.Arguments) error { TracerProvider: e.opts.Tracer, MeterProvider: metric.NewMeterProvider(metricOpts...), + MetricsLevel: configtelemetry.LevelDetailed, ReportStatus: func(*otelcomponent.StatusEvent) {}, }, diff --git a/internal/component/otelcol/extension/extension.go b/internal/component/otelcol/extension/extension.go index 195894feca..c18e1a3337 100644 --- a/internal/component/otelcol/extension/extension.go +++ b/internal/component/otelcol/extension/extension.go @@ -16,6 +16,7 @@ import ( "github.com/grafana/alloy/internal/util/zapadapter" "github.com/prometheus/client_golang/prometheus" otelcomponent "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" otelextension "go.opentelemetry.io/collector/extension" sdkprometheus "go.opentelemetry.io/otel/exporters/prometheus" "go.opentelemetry.io/otel/sdk/metric" @@ -116,6 +117,7 @@ func (e *Extension) Update(args component.Arguments) error { TracerProvider: e.opts.Tracer, MeterProvider: metric.NewMeterProvider(metric.WithReader(promExporter)), + MetricsLevel: configtelemetry.LevelDetailed, ReportStatus: func(*otelcomponent.StatusEvent) {}, }, diff --git a/internal/component/otelcol/processor/processor.go b/internal/component/otelcol/processor/processor.go index 0781b04576..414909d582 100644 --- a/internal/component/otelcol/processor/processor.go +++ b/internal/component/otelcol/processor/processor.go @@ -17,6 +17,7 @@ import ( "github.com/grafana/alloy/internal/util/zapadapter" "github.com/prometheus/client_golang/prometheus" otelcomponent "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" otelextension "go.opentelemetry.io/collector/extension" otelprocessor "go.opentelemetry.io/collector/processor" sdkprometheus "go.opentelemetry.io/otel/exporters/prometheus" @@ -135,6 +136,7 @@ func (p *Processor) Update(args component.Arguments) error { TracerProvider: p.opts.Tracer, MeterProvider: metric.NewMeterProvider(metric.WithReader(promExporter)), + MetricsLevel: configtelemetry.LevelDetailed, ReportStatus: func(*otelcomponent.StatusEvent) {}, }, diff --git a/internal/component/otelcol/receiver/prometheus/prometheus.go b/internal/component/otelcol/receiver/prometheus/prometheus.go index 2567630d72..fcdf7de4cd 100644 --- a/internal/component/otelcol/receiver/prometheus/prometheus.go +++ b/internal/component/otelcol/receiver/prometheus/prometheus.go @@ -20,6 +20,7 @@ import ( "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/storage" otelcomponent "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" otelreceiver "go.opentelemetry.io/collector/receiver" metricNoop "go.opentelemetry.io/otel/metric/noop" traceNoop "go.opentelemetry.io/otel/trace/noop" @@ -126,6 +127,7 @@ func (c *Component) Update(newConfig component.Arguments) error { // TODO(tpaschalis): expose tracing and logging statistics. TracerProvider: traceNoop.NewTracerProvider(), MeterProvider: metricNoop.NewMeterProvider(), + MetricsLevel: configtelemetry.LevelDetailed, ReportStatus: func(*otelcomponent.StatusEvent) {}, }, diff --git a/internal/component/otelcol/receiver/receiver.go b/internal/component/otelcol/receiver/receiver.go index 30c136ecfc..72cd49ad28 100644 --- a/internal/component/otelcol/receiver/receiver.go +++ b/internal/component/otelcol/receiver/receiver.go @@ -17,6 +17,7 @@ import ( "github.com/grafana/alloy/internal/util/zapadapter" "github.com/prometheus/client_golang/prometheus" otelcomponent "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/extension" otelreceiver "go.opentelemetry.io/collector/receiver" sdkprometheus "go.opentelemetry.io/otel/exporters/prometheus" @@ -133,6 +134,7 @@ func (r *Receiver) Update(args component.Arguments) error { TracerProvider: r.opts.Tracer, MeterProvider: metric.NewMeterProvider(metricOpts...), + MetricsLevel: configtelemetry.LevelDetailed, ReportStatus: func(*otelcomponent.StatusEvent) {}, },