Skip to content

Specify target labels for relabeling via /clients #85

Open

Description

@elliot-resdiary

The /clients endpoint's labels field would be the ideal way to provide static target-based labels for relabeling metrics. Our use-case requires each scrape target to have an environment, region and component tags which are crucial when we're using these metrics.

If we could add a --labels argument to pushprox-client that would be perfect for us. What do others think? I haven't used Prometheus for long so maybe there's a better way to do this, though I'd be glad to raise a PR for this if others also would like it.

Activity

  1. roidelapluie commented on Jun 22, 2020

    @roidelapluie

    Static labels can be added by prometheus itself at scrape time.

  2. elliot-resdiary commented on Jun 22, 2020

    @elliot-resdiary
    Author

    Static labels can be added by prometheus itself at scrape time.

    Do you mean in a static config? I was hoping to use the /clients endpoint to discover targets along with the labels required to make their metrics useful.

  3. SuperQ commented on Jun 22, 2020

    @SuperQ
    Contributor

    It's an interesting idea about how to arrange labels in a reasonably consistent way to the /clients discovery interface. At the same time, avoiding arbitrary cardinality issues.

    I haven't used Prometheus for long so maybe there's a better way to do this.

    There are few different options here. Without a detailed conversation about your overall architecture, and design use case for PushProx, it's hard to say. But that's not really a conversation to be had over an issue.

  4. elliot-resdiary commented on Jun 23, 2020

    @elliot-resdiary
    Author

    They would fulfill the same purpose as static __meta_* tags which are available with the other service discovery mechanisms. Originally we were planning on using __meta_azure_machine_tag_<tagname> before realizing we needed PushProx to traverse NAT.

    A few other examples of tag meta labels I found are

    __meta_consul_tags
    __meta_ec2_tag_<tagkey>
    __meta_openstack_tag_<tagkey>
    __meta_gce_tags
    
  5. SuperQ commented on Jun 24, 2020

    @SuperQ
    Contributor

    If this is an Azure deployment, you should be running Prometheus inside of your VPCs to avoid NAT issues. Prometheus is meant to be distributed and deployed inside networks. PushProx is meant for more IoT use cases.

  6. cycwll commented on Jul 3, 2020

    @cycwll

    @elliot-resdiary I have the same requires as your

  7. Eagleseb commented on Jun 16, 2022

    @Eagleseb

    I agree this would be really nice to have, I could maybe have a look at the code base to implement that if someone could give me pointers

  8. moreinhardt commented on Jan 19, 2026

    @moreinhardt

    I just saw that /clients returns labels and thought that I must be able to configure these exactly like proposed in this issue when starting the client, e.g. with pushprox-client --label exporters=node,zfs --label foo=bar.

    I have a very simple use case here, which is exactly what's asked about in #160:

    Not all targets have all exporters running. E.g. node is running on all hosts, but postgres or zfs only on some. In the dynamic scrape config for network-internal hosts I use cloud provider tags to filter the hosts in the relabel_configs. Now I want to do exactly this with the hosts that can only be reached via pushprox.

    Atm I have separate jobs for every exporter accessed via the proxy with static target configs.

    Would be really cool if this could be added. Would you be open to reviewing a PR that adds this, @SuperQ?

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

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