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 with same metric name cannot use binary arithmetic operators to calculate. #4365

Closed
cauwulixuan opened this Issue Jul 10, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@cauwulixuan
Copy link

cauwulixuan commented Jul 10, 2018

Proposal

Use case. Why is this important?

Nice to have' is not a good use case :)

Bug Report

What did you do?
I have defined a metric name "hadoop_namenode_fsname_system_capacity_bytes" with different labels.
And metrics can be scraped like:

# HELP hadoop_namenode_fsname_system_capacity_bytes Current DataNodes capacity in each mode in bytes
# TYPE hadoop_namenode_fsname_system_capacity_bytes gauge
hadoop_namenode_fsname_system_capacity_bytes{mode="UsedNonDFS"} 203908392012.0
hadoop_namenode_fsname_system_capacity_bytes{mode="Total"} 422567952384.0
hadoop_namenode_fsname_system_capacity_bytes{mode="Used"} 156852491239.0
hadoop_namenode_fsname_system_capacity_bytes{mode="Remaining"} 144899711054.0

Now I want to calculate capacity_used_ratio using:

hadoop_namenode_fsname_system_capacity_bytes{mode="Used"} / hadoop_namenode_fsname_system_capacity_bytes{mode="Total"}

What did you expect to see?
The result of the calculation.

What did you see instead? Under which circumstances?
no data

Environment

  • System information:

    insert output of uname -srm here

  • Prometheus version:

    insert output of prometheus --version here

  • Alertmanager version:

    insert output of alertmanager --version here (if relevant to the issue)

  • Prometheus configuration file:

insert configuration here
  • Alertmanager configuration file:
insert configuration here (if relevant to the issue)
  • Logs:
insert Prometheus and Alertmanager logs relevant to the issue here
@cauwulixuan

This comment has been minimized.

Copy link
Author

cauwulixuan commented Jul 10, 2018

Any ideas? Many thanks.

@krasi-georgiev

This comment has been minimized.

Copy link
Member

krasi-georgiev commented Jul 10, 2018

Thanks for your report. It looks as if this is actually a question about usage and not development.

no crash, no panic = support question 😉

To make support question, and all replies, easier to find, I suggest you move this to our user mailing list.

If you haven't looked already you might find your answer in the official docs and examples or by searching in the users or devs groups.
The #prometheus IRC channel is also a great place to mix up with the community and ask questions (don't be afraid to answers few while waiting).

If you think this is not purely a support question, feel free to comment in here or in the dev mailing list.

Once your questions have been answered, please add a link to the solution to help other Prometheans in trouble reaching this from a search 👍

@cauwulixuan

This comment has been minimized.

Copy link
Author

cauwulixuan commented Jul 10, 2018

It works by ignore "mode" label, because by default Prometheus wants to match all labels on both sides:

hadoop_namenode_fsname_system_capacity_bytes{mode="Used"} / ignoring(mode) hadoop_namenode_fsname_system_capacity_bytes{mode="Total"}

Wish could help others.

@krasi-georgiev

This comment has been minimized.

Copy link
Member

krasi-georgiev commented Jul 11, 2018

Thanks!

@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.