Skip to content

[service] Internal counter metrics now have a _total suffix in Prometheus #12458

@jade-guiton-dd

Description

@jade-guiton-dd

Component(s)

service

What happened?

Describe the bug

Between v0.118.0 and v0.120.0, the name of internal counter metrics exposed through the Prometheus endpoint gained a _total suffix, breaking the stability of internal metrics.

Steps to reproduce

Exercise the OTLP receiver (sending a span for example) with an explicitly configured Prometheus reader.

What did you expect to see?

Old output on the Prometheus endpoint:

# HELP otelcol_receiver_accepted_spans Number of spans successfully pushed into the pipeline. [alpha]
# TYPE otelcol_receiver_accepted_spans counter
otelcol_receiver_accepted_spans{receiver="otlp/1",service_instance_id="dfcfad0f-6d19-4340-9d76-1e0df4883526",service_name="otelcol",service_version="0.118.0",transport="grpc"} 123

What did you see instead?

New output on the Prometheus endpoint:

# HELP otelcol_receiver_accepted_spans_total Number of spans successfully pushed into the pipeline. [alpha]
# TYPE otelcol_receiver_accepted_spans_total counter
otelcol_receiver_accepted_spans_total{otel_scope_name="go.opentelemetry.io/collector/receiver/receiverhelper",otel_scope_version="",receiver="otlp/1",transport="grpc"} 123

Collector version

v0.120.0

OpenTelemetry Collector configuration

service:
  telemetry:
    metrics:
      readers:
        - pull:
            exporter:
              prometheus:
                host: '0.0.0.0'
                port: 8888

Additional context

This was reported by Jon Bates on the CNCF Slack.

I believe this was introduced by #11611. The previous code for instantiating the Prometheus exporter explicitly added the WithoutCounterSuffixes option, but the new code now relies on the go-contrib config module to instantiate it based on the user's config.

While the default telemetry config has a Prometheus reader with the corresponding without_type_suffix: true option set, I believe that setting your own list of readers without specifying without_type_suffix will make it default to false, adding the _total suffix to counter metrics.

A workaround is to add without_type_suffix: true to the prometheus: section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:servicebugSomething isn't workingcollector-telemetryhealthchecker and other telemetry collection issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions