Hi,
I’m on Grafana Cloud and I’m trying to annotate my time serie with when the version changed.
I have this graph generated using
histogram_quantile(0.9, sum by(le, handler, method) (rate(http_request_duration_seconds_bucket{instance=~".*_${env}.*", handler="/health"}[$__rate_interval])))
How can I using an _info metric annotate the above graph?
release_version_info{instance="my_api_prd:5050", job="prometheus.scrape.track_backend", version="0.1.0"}
release_version_info{instance="my_api_prd:5050", job="prometheus.scrape.track_backend", version="0.1.1"}
Hi, how does release_version_info
metric look like? Is it a single point or does it start when the release was made and then it’s a straight line until another release is deployed?
If it’s a single point, you can just create an annotation (dashboard Settings → Annotations → Add annotation query) with the query release_version_info
- annotation will be created where the points are.
If the metric is exposed indefinitely, you can use increase
function that should mark the beginning of the time series and then be equal to 0 - AFAIK annotations take to consideration only points greater than 0 so you should be good to go.
Hi, thank you for your answer.
It starts when the release was made indeed (and then straight line), it’s a Gauge type.
I tried the increase function but it’s not displaying anything. The only thing that seems to work is this:
last_over_time(release_version_info{instance=~".+_${env}.+"}[$__interval])
unless
last_over_time(release_version_info{instance=~".+_${env}.+"}[$__interval] offset $__interval)
I’m not sure this is optimal though
You can try increase(release_version_info{<selectors>}[$__rate_interval])
- variable $__interval
might not be enough to display the result of increase (increase needs at least two points to calculate and in the $__interval
there might not be enough.
Does increase
work with gauge? I get only 0 as output when using it.
What is the value of the metric? 1? 0? If it’s constant, it shouldn’t really matter if it’s a gauge, because it behaves like a counter.