Skip to content

Service discovery is the responsibility of Prometheus #178

Closed

Description

@brian-brazil

https://github.com/siimon/prom-client#default-labels-segmented-by-registry indicates that this library has functionality to allow setting target labels. This is an anti-pattern in Prometheus as that's the role of service discovery/relabelling, and a client library should not facilitate this anti-pattern. This functionality should be removed.

Activity

  1. SimenB commented on Mar 26, 2018

    @SimenB
    Contributor

    It came from #83 (feature request) and #137 (PR), cc @goofballLogic @nwest1 thoughts?

  2. nwest1 commented on Mar 26, 2018

    @nwest1
    Contributor

    Thanks for the mention -

    Bottom-line, this simplified the code necessary to emit metrics. If it was removed, it would mean more complexity and repetition in our own code, and no (easy) ability to label default metrics in a way we would expect.

    Due to timelines/prioritization this was a feature we found useful - especially when not having access to modify prometheus config.

    Would a note about the recommended approach be sufficient here without a full removal?

  3. brian-brazil commented on Mar 26, 2018

    @brian-brazil
    Author

    Would a note about the recommended approach be sufficient here without a full removal?

    This is such a common misunderstanding of the Prometheus architecture that it should be removed. You should switch to relabelling for this.

  4. benny-medflyt commented on Jan 14, 2019

    @benny-medflyt

    I would like to point out that there is a legitimate use case for using prom-client's default labels feature:

    When using node cluster node, it can be used to apply a "worker" label with the worker id. This cannot be done outside of prom-client using regular prometheus relabeling.

    All of the official prometheus client libraries are for languages that are multi-threaded (rather than multi-process), so they don't need this feature.

  5. brian-brazil commented on Jan 14, 2019

    @brian-brazil
    Author

    The Python client's multi-process mode handles this internally. Instrumentation shouldn't have to care how exposition is done.

  6. benny-medflyt commented on Jan 14, 2019

    @benny-medflyt

    The Python client's multi-process mode handles this internally. Instrumentation shouldn't have to care how exposition is done.

    I would be happy if prom-client would also handle this internally and automatically 👍

  7. forresthopkinsa commented on Sep 1, 2021

    @forresthopkinsa

    Is there support for the multi-target pattern in this library? It doesn't seem like there's any way to pass parameters into exporters with this client, and that can be a blocker for certain setups

  8. jdmarshall commented on Jul 13, 2025

    @jdmarshall
    Contributor

    We had to roll our own for OTEL to handle PM2 instance-IDs to avoid count clobbering. I agree that process per core languages struggle with disambiguation. #687 speeds this code up quite a bit. I’m happy to double down on this feature.

    All of the official prometheus client libraries are for languages that are multi-threaded (rather than multi-process), so they don't need this feature.

    Exactly. Prometheus and OTEL are both actively hostile to NodeJS, Bun. Ruby, Python and they didn’t need to be. But here we are doing our best.

    I'd also like to know how the committee imagines you distinguish telemetry data between two different versions of your product if you don't include those versions in all of your telemetry. I think the committee might be engaging in 'design by committee' behavior here.

  9. jdmarshall commented on Jul 16, 2025

    @jdmarshall
    Contributor

    Achtually... The current page on Prometheus naming and labeling does not mention any of the concerns listed in this bug report.

    https://prometheus.io/docs/practices/naming/

    I personally don't much like carrying open bugs that I wontfix and prefer to close them. I think maybe this one counts as such if you want to tidy up a bit @zbjornson @SimenB

  10. jdmarshall commented on Aug 20, 2026

    @jdmarshall
    Contributor

    So to reiterate, don't label your data with threadId or you're going to have a bad time when the accountants see the bill.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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