Skip to content

otlp writer: colons (':') in metric names replaced with underscores ('_') #15199

@xieziheng1

Description

@xieziheng1

What did you do?

When using the OTLP collector to scrape metrics from a Prometheus /federate API endpoint and write them to a central Prometheus instance via otlphttp, the metric names are unexpectedly modified.
Steps:

  1. Set up an OTLP collector with a prometheusreceiver configured to scrape the /federate API of an existing Prometheus instance.
  2. Configure the OTLP collector to write metrics to a central Prometheus instance using the otlphttp exporter.
  3. Observe the metric names in the central Prometheus instance.

What did you expect to see?

Metric names should be preserved exactly as they appear in the source Prometheus instance, including any colons (':') in the names.

What did you see instead? Under which circumstances?

Colons (':') in metric names are replaced with underscores ('_').
Example:
Original metric name: node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate
Modified metric name: node_namespace_pod_container_container_cpu_usage_seconds_total_sum_rate

System information

No response

Prometheus version

prometheus, version 3.0.0-beta.0 (branch: HEAD, revision: 91608c002f08039c7c0f5a3fbebaf2cf78c3b1f2)
  build user:       root@9c2eedf0b49d
  build date:       20240910-19:12:25
  go version:       go1.23.1
  platform:         linux/arm64
  tags:             netgo,builtinassets,stringlabels

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions