xmlParser
xmlParser

Reputation: 2031

Prometheus query sum not working for different event

I have hystrix metrics for this command:

hystrix_execution_total

that looks like this:

hystrix_execution_total{event="thread_pool_rejected", key="myapp"}
hystrix_execution_total{event="timeout", key="myapp"}
hystrix_execution_total{event="failure", key="myapp"}
hystrix_execution_total{event="success", key="myapp"}

All of them have some value.

I want to get the sum from timeout and failure but I have got a problem.

hystrix_execution_total{event="timeout", key="myapp"} + hystrix_execution_total{event="failure", key="myapp"}

When I execute this I have got No data.

But when I change the event to both of them to timeout or failure I have got the sum.

So why I cant get the sum of different event?

Upvotes: 1

Views: 1421

Answers (1)

Bambus
Bambus

Reputation: 1583

This is because Prometheus expects matching labels on both side of the expression. You can do this instead:

hystrix_execution_total{event="timeout", key="myapp"} + ignoring(event) 
hystrix_execution_total{event="failure", key="myapp"}

Upvotes: 1

Related Questions