From 77cbe2892fa93fc7d50e0ee18d0037c5e00b57db Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Wed, 17 Jul 2024 16:26:44 -0700 Subject: [PATCH 1/3] [batchprocessor] Update metric units --- processor/batchprocessor/documentation.md | 8 ++++---- .../internal/metadata/generated_telemetry.go | 8 ++++---- processor/batchprocessor/metadata.yaml | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/processor/batchprocessor/documentation.md b/processor/batchprocessor/documentation.md index 32833a7a90b..18c0d15f831 100644 --- a/processor/batchprocessor/documentation.md +++ b/processor/batchprocessor/documentation.md @@ -12,7 +12,7 @@ Number of units in the batch | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Histogram | Int | +| {units} | Histogram | Int | ### otelcol_processor_batch_batch_send_size_bytes @@ -28,7 +28,7 @@ Number of times the batch was sent due to a size trigger | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {times} | Sum | Int | true | ### otelcol_processor_batch_metadata_cardinality @@ -36,7 +36,7 @@ Number of distinct metadata value combinations being processed | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | false | +| {combinations} | Sum | Int | false | ### otelcol_processor_batch_timeout_trigger_send @@ -44,4 +44,4 @@ Number of times the batch was sent due to a timeout trigger | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {times} | Sum | Int | true | diff --git a/processor/batchprocessor/internal/metadata/generated_telemetry.go b/processor/batchprocessor/internal/metadata/generated_telemetry.go index 554da0686db..f7b24e293d3 100644 --- a/processor/batchprocessor/internal/metadata/generated_telemetry.go +++ b/processor/batchprocessor/internal/metadata/generated_telemetry.go @@ -71,7 +71,7 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ProcessorBatchBatchSendSize, err = builder.meter.Int64Histogram( "otelcol_processor_batch_batch_send_size", metric.WithDescription("Number of units in the batch"), - metric.WithUnit("1"), metric.WithExplicitBucketBoundaries([]float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000}...), + metric.WithUnit("{units}"), metric.WithExplicitBucketBoundaries([]float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000}...), ) errs = errors.Join(errs, err) builder.ProcessorBatchBatchSendSizeBytes, err = builder.meter.Int64Histogram( @@ -83,13 +83,13 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ProcessorBatchBatchSizeTriggerSend, err = builder.meter.Int64Counter( "otelcol_processor_batch_batch_size_trigger_send", metric.WithDescription("Number of times the batch was sent due to a size trigger"), - metric.WithUnit("1"), + metric.WithUnit("{times}"), ) errs = errors.Join(errs, err) builder.ProcessorBatchMetadataCardinality, err = builder.meter.Int64ObservableUpDownCounter( "otelcol_processor_batch_metadata_cardinality", metric.WithDescription("Number of distinct metadata value combinations being processed"), - metric.WithUnit("1"), + metric.WithUnit("{combinations}"), ) errs = errors.Join(errs, err) _, err = builder.meter.RegisterCallback(builder.observeProcessorBatchMetadataCardinality, builder.ProcessorBatchMetadataCardinality) @@ -97,7 +97,7 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ProcessorBatchTimeoutTriggerSend, err = builder.meter.Int64Counter( "otelcol_processor_batch_timeout_trigger_send", metric.WithDescription("Number of times the batch was sent due to a timeout trigger"), - metric.WithUnit("1"), + metric.WithUnit("{times}"), ) errs = errors.Join(errs, err) return &builder, errs diff --git a/processor/batchprocessor/metadata.yaml b/processor/batchprocessor/metadata.yaml index b0d2458c9b4..05b526f0479 100644 --- a/processor/batchprocessor/metadata.yaml +++ b/processor/batchprocessor/metadata.yaml @@ -14,21 +14,21 @@ telemetry: processor_batch_batch_size_trigger_send: enabled: true description: Number of times the batch was sent due to a size trigger - unit: "1" + unit: "{times}" sum: value_type: int monotonic: true processor_batch_timeout_trigger_send: enabled: true description: Number of times the batch was sent due to a timeout trigger - unit: "1" + unit: "{times}" sum: value_type: int monotonic: true processor_batch_batch_send_size: enabled: true description: Number of units in the batch - unit: "1" + unit: "{units}" histogram: value_type: int bucket_boundaries: [10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000] @@ -42,7 +42,7 @@ telemetry: processor_batch_metadata_cardinality: enabled: true description: Number of distinct metadata value combinations being processed - unit: "1" + unit: "{combinations}" sum: value_type: int async: true From 3f4dac40f293dc57c83d19d405c654d70b216785 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Wed, 17 Jul 2024 16:43:00 -0700 Subject: [PATCH 2/3] Fix expected units in tests --- .../batchprocessor/batch_processor_test.go | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/processor/batchprocessor/batch_processor_test.go b/processor/batchprocessor/batch_processor_test.go index 856ea6e48a5..36ce38d57d7 100644 --- a/processor/batchprocessor/batch_processor_test.go +++ b/processor/batchprocessor/batch_processor_test.go @@ -236,7 +236,7 @@ func TestBatchProcessorSentBySize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -255,7 +255,7 @@ func TestBatchProcessorSentBySize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -270,7 +270,7 @@ func TestBatchProcessorSentBySize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, @@ -362,7 +362,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -381,7 +381,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -396,7 +396,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_timeout_trigger_send", Description: "Number of times the batch was sent due to a timeout trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -411,7 +411,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, @@ -625,7 +625,7 @@ func TestBatchMetricProcessorBatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -644,7 +644,7 @@ func TestBatchMetricProcessorBatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -659,7 +659,7 @@ func TestBatchMetricProcessorBatchSize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, @@ -1005,7 +1005,7 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -1024,7 +1024,7 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -1039,7 +1039,7 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, From 3b0235baf2337eafba2b0eea99f4bfee5da74cc0 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Fri, 19 Jul 2024 11:23:56 -0700 Subject: [PATCH 3/3] Add changelog --- .chloggen/batchprocessor_metric_units.yaml | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .chloggen/batchprocessor_metric_units.yaml diff --git a/.chloggen/batchprocessor_metric_units.yaml b/.chloggen/batchprocessor_metric_units.yaml new file mode 100644 index 00000000000..a611ce94026 --- /dev/null +++ b/.chloggen/batchprocessor_metric_units.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: batchprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Update units for internal telemetry + +# One or more tracking issues or pull requests related to the change +issues: [10652] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: []