How to use the selected period of time in a query?

There are two ways that I know: You can use the $__interval variable like this: increase(http_requests_total[$__interval]) There is a drawback that the $__interval variable’s value is adjusted by resolution of the graph, but this may also be helpful in some situations. This approach should fit your case better: Go to Dashboard’s Templating settings, create new … Read more

How do I write a Prometheus query that returns the value of a label?

My answer tries to elaborate on Carl’s answer. I assume that the GUI layout may have changed a little since 2016, so it took me while to find the “name” option. Assuming you have a metric as follows: # HELP db2_prometheus_adapter_info Information on the state of the DB2-Prometheus-Adapter # TYPE db2_prometheus_adapter_info gauge db2_prometheus_adapter_info{app_state=”UP”) 1.0 and … Read more

tech