S
S
Serg4452020-01-07 23:00:00
Monitoring
Serg445, 2020-01-07 23:00:00

How to get the time for which the metric became maximum in Prometheus?

Can you tell me if it's possible, and if so, how?
There is a metric that we give to prometheus, at some point in time it changes from 0 to a certain maximum value (let's say 100). The task is: to get the time for which it grew.
I tried like this:
some_metric{label="l1"}[10m]- the interval during which the maximum value is usually always reached

timestamp(max_over_time(some_metric{label="l1"}[10m]))- timestamp(min_over_time(some_metric{label="l1"}[10m]))
- in this case, 0 is returned because, for reasons that are not clear to me, the expression:
timestamp(max_over_time(some_metric{label="l1"}[10m]))

and
timestamp(min_over_time(some_metric{label="l1"}[10m]))

return the same value, although :
min_over_time(some_metric{label="l1"}[10m])
and
max_over_time(some_metric{label="l1"}[10m])
returns the maximum and minimum value for the specified period

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question