promql

Label replace over a range vector in Prometheus

走远了吗. 提交于 2020-03-25 16:11:06
问题 I want to find the sum number of alerts for all the pods starting with "sendsms" over 10minutes. I am able to do use label_replace() to do this on the instant vector. But when i want to do this for over 10 minutes data, it cannot work as label_replace only works on instant vector. Explaining the problem with an example: ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-dbed"} 10 ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-ebed"} 20 ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-fbed"

Label replace over a range vector in Prometheus

孤人 提交于 2020-03-25 16:10:48
问题 I want to find the sum number of alerts for all the pods starting with "sendsms" over 10minutes. I am able to do use label_replace() to do this on the instant vector. But when i want to do this for over 10 minutes data, it cannot work as label_replace only works on instant vector. Explaining the problem with an example: ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-dbed"} 10 ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-ebed"} 20 ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-fbed"

Get Total requests in a period of time

吃可爱长大的小学妹 提交于 2020-01-10 07:33:40
问题 I need to show, in Grafana, a panel with the number of requests in the period of time selected in the upper right corner. For this I need to solve 2 issues here, I will ask the prometheus question here and the Grafana question in another link. If I have a Counter http_requests_total , How can I build a query to get an integer with the total number of requests during a period of time (for example:24hs)? 回答1: What you need is the increase() function, that will calculate the difference between

Get Total requests in a period of time

筅森魡賤 提交于 2020-01-10 07:33:17
问题 I need to show, in Grafana, a panel with the number of requests in the period of time selected in the upper right corner. For this I need to solve 2 issues here, I will ask the prometheus question here and the Grafana question in another link. If I have a Counter http_requests_total , How can I build a query to get an integer with the total number of requests during a period of time (for example:24hs)? 回答1: What you need is the increase() function, that will calculate the difference between

How can I group labels in a Prometheus query?

孤街醉人 提交于 2019-12-10 01:02:34
问题 If I have a metric with the following labels: my_metric{group="group a"} 100 my_metric{group="group b"} 100 my_metric{group="group c"} 100 my_metric{group="misc group a"} 1 my_metric{group="misc group b"} 2 my_metric{group="misc group c"} 1 my_metric{group="misc group d"} 1 Is it possible to do a query or even a label_replace that combines the 'misc' groups together? (I realize that the metric cardinality needs to be improved, and I've updated the app to fix it. However it left me with this

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

旧时模样 提交于 2019-12-03 07:01:17
问题 I'm using Grafana with Prometheus and I'd like to build a query that depends on the selected period of time selected in the upper right corner of the screen. Is there any variable (or something like that) to use in the query field? In other words, If I select 24hs I'd like to use that data in the query. 回答1: 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

Get Total requests in a period of time

*爱你&永不变心* 提交于 2019-12-02 21:55:14
I need to show, in Grafana, a panel with the number of requests in the period of time selected in the upper right corner. For this I need to solve 2 issues here, I will ask the prometheus question here and the Grafana question in another link. If I have a Counter http_requests_total , How can I build a query to get an integer with the total number of requests during a period of time (for example:24hs)? What you need is the increase() function, that will calculate the difference between the counter values at the start and at the end of the specified time interval. It also correctly handles

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

女生的网名这么多〃 提交于 2019-12-02 19:36:49
I'm using Grafana with Prometheus and I'd like to build a query that depends on the selected period of time selected in the upper right corner of the screen. Is there any variable (or something like that) to use in the query field? In other words, If I select 24hs I'd like to use that data in the 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