Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make external labels available in federation matchers #2046

Closed
h0tbird opened this Issue Sep 30, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@h0tbird
Copy link

h0tbird commented Sep 30, 2016

What did you do?
I am experimenting with horizontal scalability, sharding and multiple cross-federated servers.

What did you expect to see?
External labels in federation matchers.

What did you see instead? Under which circumstances?
No external labels in federation matchers. Always.

In a multiple cross-federated setup external labels are not on every time series so those can be used to filter some targets.

Find below a sample setup which will use the requested feature:

global:
 external_labels:
  shard: 0
 scrape_interval: 15s
 scrape_timeout: 10s
 evaluation_interval: 10s

rule_files:
 - /etc/prometheus/recording.rules
 - /etc/prometheus/alerting.rules

alerting:
 alert_relabel_configs:
 - source_labels: [shard]
   action: replace
   replacement: 'all'
   target_label: shard

scrape_configs:

 - job_name: 'federate'
   honor_labels: true
   metrics_path: /federate
   params:
    match[]:
     - '{shard=~"1|2"}'
   static_configs:
    - targets:
      - 'master-0:9090'
      - 'master-1:9090'
      - 'master-2:9090'

 - job_name: 'node'
   file_sd_configs:
    - files:
      - /etc/prometheus/targets/node.yml
   relabel_configs:
   - source_labels: [__address__]
     modulus: 3
     target_label: __tmp_hash
     action: hashmod
   - source_labels: [__tmp_hash]
     regex: ^0$
     action: keep
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Sep 30, 2016

This was discussed previously in #1811 and is intended behaviour.

@h0tbird

This comment has been minimized.

Copy link
Author

h0tbird commented Sep 30, 2016

I am just wondering if now I have a valid use case for this feature to be implemented. On the other hand I can solve it by simply adding a static label to all my jobs.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Sep 30, 2016

The purpose of external labels is to uniquely identify Prometheus servers. Thus filtering on them isn't of much use, as you're already talking to the Prometheus server you want to.

@h0tbird

This comment has been minimized.

Copy link
Author

h0tbird commented Sep 30, 2016

Ok, I guess I am trying to (ab)use it. Thank you for the clarification.

@h0tbird h0tbird closed this Sep 30, 2016

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.