Maurício Linhares
Maurício Linhares

Reputation: 40333

How do I show the count of a specific group of metrics from a prometheus histogram?

So, I have a histogram that collects duration in seconds for some operations, metrics are:

And this works, I get my quantiles and all, but I want to get a count of all requests that go over 1 second. How do I produce a query like that?

Upvotes: 3

Views: 2524

Answers (2)

brian-brazil
brian-brazil

Reputation: 34172

rate(rpc_request_duration_seconds_bucket{le="+Inf"}[1m]) 
  - ignoring(le)
rate(rpc_request_duration_seconds_bucket{le="1.0"}[1m])

will return how many queries are going over 1s every second.

This is all queries, minus the queries that take less than or equal to one second.

Upvotes: 6

ahus1
ahus1

Reputation: 5950

You want to write something like

rate(rpc_request_duration_seconds_count [1m])

This will give you the requests per second in a (sliding) interval of 1 minute. See the Query functions doc of Prometheus.

Upvotes: 0

Related Questions