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

metrics metadata can inherit from job #4368

Closed
zhangjianweibj opened this Issue Jul 11, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@zhangjianweibj
Copy link

zhangjianweibj commented Jul 11, 2018

prometheus verison:last

issue: metrics get from prometheus should inherit metadata from scrape job.or users can config the feature.in this situation,prometheus pull meric from client can reduce additional label and reduce network burden.what is more,users can use prometheus more flexibly and effectively.

for example,i want every metric samples get from prometheus hava lables service_id and service_port,how to achieve this goal?
image

image

@jojohappy

This comment has been minimized.

Copy link
Contributor

jojohappy commented Jul 11, 2018

You can use the relabel_config to replace the __meta_ label as a normal label.

example

relabel_configs:
- source_labels: [__meta_consul_node]
  separator: ;
  regex: (.*)
  target_label: node
  replacement: $1
  action: replace
- source_labels: [__meta_consul_service]
  separator: ;
  regex: (.*)
  target_label: consul_service
  replacement: $1
  action: replace
- source_labels: [__meta_consul_tag]
  separator: ;
  regex: (.*)
  target_label: consul_tag
  replacement: $1
  action: replace
- source_labels: [__meta_consul_dc]
  separator: ;
  regex: (.*)
  target_label: consul_dc
  replacement: $1
  action: replace
- source_labels: [__meta_consul_service_port]
  separator: ;
  regex: (.*)
  target_label: consul_service_port
  replacement: $1
  action: replace
@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Jul 11, 2018

Thanks for your report and @jojohappy for the answer. I'm closing the issue for now.

For future questions, we suggest you use our user mailing list, which you can also search. If you prefer more interactive help, join or our IRC channel, #prometheus on irc.freenode.net. Please be aware that our IRC channel has no logs, is not searchable, and that people might not answer quickly if they are busy or asleep. If in doubt, you should choose the mailing list.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 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 22, 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.