opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

[processor/batch] processor ID missing from the metadata_cardinality metric

Open alanhe opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug

When having more than one batchers, for example:

processors:
  batch/1:
    send_batch_max_size: 10000
    timeout: 10s
    metadata_keys: ["label1"]
    metadata_cardinality_limit: 0
  batch/2:
    send_batch_max_size: 10000
    timeout: 10s
    metadata_keys: ["label2"]
    metadata_cardinality_limit: 0

The metric is like:

otelcol_processor_batch_metadata_cardinality{service_instance_id="3bb678ea-b864-48a3-bc7f-ca8d5e0f9915",service_name="XXX",service_version="dev"} 1

It's not clear which value it is.

What did you expect to see?

I want to have the processor label in the metric, and display them in two lines:

# HELP otelcol_processor_batch_metadata_cardinality Number of distinct metadata value combinations being processed
# TYPE otelcol_processor_batch_metadata_cardinality gauge
otelcol_processor_batch_metadata_cardinality{service_instance_id="3bb678ea-b864-48a3-bc7f-ca8d5e0f9915",service_name="XXX",service_version="dev", processor="batch/1"} 1
otelcol_processor_batch_metadata_cardinality{service_instance_id="3bb678ea-b864-48a3-bc7f-ca8d5e0f9915",service_name="XXX",service_version="dev", processor="batch/2"} 1

From the code, https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/batchprocessor/metrics.go#L97 It can take the value from either processor.

What version did you use? v0.95.0

alanhe avatar Mar 04 '24 08:03 alanhe

It happens in v0.99.0 still.

alanhe avatar May 11 '24 04:05 alanhe

Came across this bug as I was making the change https://github.com/open-telemetry/opentelemetry-collector/pull/10233. The measurement for this metric doesn't add the attributes that other metrics do

codeboten avatar May 28 '24 16:05 codeboten

Submitted a fix for this in https://github.com/open-telemetry/opentelemetry-collector/pull/10245

codeboten avatar May 28 '24 17:05 codeboten