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

mgr: prometheus: set metadata metrics value to '1' (#22717). #19979

Merged
merged 1 commit into from Jan 23, 2018

Conversation

k0ste
Copy link
Contributor

@k0ste k0ste commented Jan 17, 2018

By default we have pool metrics like this:

ceph_pool_objects{pool_id="1"} 1075534
ceph_pool_metadata{name="name_of_pool_1",pool_id="1"} 0

When I was try to join name label from metadata series (to use label with Grafana) like this:

ceph_pool_objects * on (pool_id) group_left(name) ceph_pool_metadata

Result returned without metric, only labels:

{name="name_of_pool_1",pool_id="1"}

This is because metadata metric always have value '0'.
This behavior will be fixed if set value to '1'.

http://tracker.ceph.com/issues/22717

@tchaikov tchaikov added the mgr label Jan 17, 2018
Signed-off-by: Konstantin Shalygin <k0ste@k0ste.ru>
@jcsp
Copy link
Contributor

jcsp commented Jan 17, 2018

Hmm, I had tested the ceph_disk_occupation stuff with an and on query, I wonder if that query type just doesn't care about the value (vs normal on?)

Anyway, this change looks reasonable to me

@jan--f
Copy link
Contributor

jan--f commented Jan 17, 2018

When I was try to join name label from metadata series (to use label with Grafana) like this:
ceph_pool_objects * on (pool_id) group_left(name) ceph_pool_metadata

Do you execute this query in Grafana or prometheus? I do get a metric value (its 0), in Grafana that is not obvious though.

So the reason why this behaves like this is due to the use of *. This operator multiplies the two metrics where the labels match. Using + should work as expected with the current metadata metric value. Generally its better to use the and operator as described in the documentation since this does not rely on the metadata metric having the right neutral element for the arithmetic operation you choose and the group_left is not needed.

While I don't have a strong opinion whether this metadata metric value should be 1 or 0, the initial motivation was to keep the value neutral in a graph...so 0. I.e. should someone add that metric to a graph (why would be beyond me) it would simply be 0.

@k0ste
Copy link
Contributor Author

k0ste commented Jan 18, 2018

Please, see screenshot at http://tracker.ceph.com/issues/22717
Should answer your questions about Grafana.

Difference between and and * query:

When and: labels from ceph_pool_metadata can't be used:
selection_005

And when *: label name from ceph_pool_metadata joined to answer:
selection_006

Now see how it look on graph (14 Jan is when I set metadata metrics to '1'):

selection_004

Obviously '0' returned instead ceph_pool_objects metric value.

@jcsp
Copy link
Contributor

jcsp commented Jan 18, 2018

If you use the + instead of *, does that preserve the labels and do what you want?

@jcsp
Copy link
Contributor

jcsp commented Jan 18, 2018

When I look at https://www.robustperception.io/how-to-have-labels-for-machine-roles/ and https://www.robustperception.io/exposing-the-software-version-to-prometheus/, they use a 1 value for all the metadata series, so I think we may find more people wanting to use the * operator like in the prometheus docs examples -- I'm inclined to merge this PR for that reason, even if it isn't strictly necessary. Okay with you @jan--f ?

@k0ste
Copy link
Contributor Author

k0ste commented Jan 18, 2018

If you use the + instead of *, does that preserve the labels and do what you want?

Yes...
Now I even more hate the documentation of Prometheus.

@jan--f
Copy link
Contributor

jan--f commented Jan 19, 2018

@jcsp yes agreed

@jcsp jcsp added the needs-qa label Jan 19, 2018
@liewegas liewegas merged commit d431de7 into ceph:master Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants