Skip to content

It is no longer possible to collect scrape metrics from multiple scrape managers #13507

@dashpole

Description

@dashpole

What did you do?

Context: open-telemetry/opentelemetry-collector-contrib#30934

The OpenTelemetry collector can create multiple "prometheus receivers", which each has its own scrape manager. After #12958 if we pass prometheus.DefaultRegisterer to the scrape manager, we get duplicate registration errors. Thankfully (or, sadly), we aren't using the scrape metrics right now, so we can pass a no-op registerer. But we would like to be able to use these metrics in the future.

What did you expect to see?

No error when creating multiple scrapemanagers with the same registerer.

It looks like promhttp handles this by checking for an already registered error: https://github.com/prometheus/client_golang/blob/d69fe9a80254b8a262bb071cad63595fcbff6dab/prometheus/promhttp/http.go#L260, and using the existing instrument, if it is found.

What did you see instead? Under which circumstances?

N/A

System information

N/A

Prometheus version

v0.49.1

Prometheus configuration file

N/A

Alertmanager version

N/A

Alertmanager configuration file

N/A

Logs

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions