For example I have Gauge my_metric.
my_metric{job="1"} 1.0 - at 13:00 - first
my_metric{job="1"} 1.0 - at 13:10
my_metric{job="1"} 1.0 - at 13:20 - last
How can I get timedelta from first to last metric? I need to get 13:20 – 13:00 = 20 minutes.
I tried to do.
I got timestamps for each metric:
timestamp(my_metric))
Than I tried to get delta:
delta(timestamp(my_metric)))
but have an error:
bad_data: invalid parameter "query": 1:7: parse error: expected type range vector in call to function "delta", got instant vector
If i try to get range vector from timestamp
:
delta(timestamp(my_metric))[1h])
I have an error:
bad_data: invalid parameter "query": 1:67: parse error: ranges only allowed for vector selectors
New contributor
user25663127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.