Use the promql tag when your question is related to how to formulate promql query strings related to data for which you are querying in Prometheus. Other relevant reasons might exist but this is the main purpose.
Questions tagged [promql]
901 questions
12
votes
2 answers
Grafana Prometheus Counter
I have trying to get exact count for an event in a Grafana visualization using Prometheus as timeseries DB. But the counter is showing incorrect records. I am getting a higher count for 2 days that I am getting 7 days, which definately points to…

user7510999
- 351
- 1
- 4
- 12
12
votes
5 answers
Filter vector based new label introduced by `label_replace`
In Prometheus I'm trying to merge multiple http request lines into groups using…

Victor
- 121
- 1
- 4
12
votes
2 answers
Prometheus query and case sensitivity
I have one query where I am trying to join two metrics on a label.
K_Status_Value == 5 and ON(macAddr) state_details{live="True"}
The label macAddr is present in both the metrics. The value of the label appears in 'K_Status_Value' sometimes in upper…

Arnav Bose
- 791
- 4
- 13
- 27
12
votes
4 answers
Merge/join two metrics in Prometheus/PromQL
I have two different (but related metrics).
metric_1(id="abc",id2="def")
metric_2(id="abc",id2="def")
My goal ultimately is to have the following in Grafana. I plan to use the "instant" value and Grafana's table visualization widget to display this…

rcjsuen
- 873
- 1
- 6
- 12
11
votes
1 answer
When to use sum_over_time vs increase Promql Grafana
I am a little unclear on when to exactly use increase and when to use sum_over_time in order to calculate a periodic collection of data in Grafana.
I want to calculate the total percentage of availability of my system.
Thanks.

pixelWorld
- 329
- 2
- 17
11
votes
1 answer
Converting seconds to HH:MM:SS using Prometheus & Grafana
I'm trying to show system uptime as DD-HH-MM-SS format, doing it using common code wouldn't be an issue but I'm doing it using Prometheus (PromQL) and Grafana only, here's the PromQL…

argamanza
- 1,122
- 3
- 14
- 36
11
votes
3 answers
Difference between PromQL "by" and "without" unclear
I have a question about calculating response times with Prometheus summary metrics.
I created a summary metric that does not only contain the service name but also the complete path and the http-method.
Now I try to calculate the average response…

eventhorizon
- 2,977
- 8
- 33
- 57
10
votes
3 answers
Understanding of rate() function of PromQL
I went through the PromQL docs and found rate little bit confusing. Then I tried one query from Prometheus query dashboard and found below given results
Time Count increase rate(count[1m])
15s 4381 0 0
30s 4381 0 0
45s 4381 …

Deepu--Java
- 3,742
- 3
- 19
- 30
9
votes
1 answer
What is the meaning of term "resolution" in prometheus?
In the below promQL query execution:
"Resolution" is mentioned as 14 seconds
and
"total time series" is mentioned as 1
What does "resolution" with value 14 seconds mean?
What is "time series"? What does "time series" with value 1 mean?
What…

overexchange
- 15,768
- 30
- 152
- 347
9
votes
2 answers
Prometheus query to average over time by a specific label
I need to query a metric and find out the average value of the metric over a period of 24hrs. But using using avg_over_time directly on the metric won't work. There is a specific ipaddr label. The average has to be grouped by each ipaddr. Now,…

Arnav Bose
- 791
- 4
- 13
- 27
9
votes
2 answers
Get delta between two custom timestamps in Prometheus
I have a Prometheus metric called device_number. What I want is to show the difference in value between now and one day/week/month etc ago. Which means subtracting two values with two different timestamps.
Checking around I don't find any useful…

Matej
- 565
- 2
- 9
- 21
9
votes
1 answer
How can I filter the result of label_values(label) to get a list of labels that match a regex?
I have several metrics with the label "service". I want to get a list of all the "service" levels that begin with "abc" and end with "xyz". These will be the values of a grafana template variable.
This is that I have tried:
label_values(service) =~…
user11126265
8
votes
2 answers
How to exclude multiple labels from Prometheus Query?
I want to exclude mulitple app groups from my query... Not sure how to go about it.. My thoughts are like this
count(master_build_state{app_group~! "oss-data-repair", "pts-plan-tech-solution", kubernets_namespace = "etc"} ==0)
I do not want to…

ColeGulledge
- 393
- 1
- 2
- 12
8
votes
2 answers
Getting a count of distinct label values in prometheus/grafana
I am trying to create a table/chart in Grafana showing the total number of unique users who have logged in to a given application over a given time range (e.g. last 24 hours). I have a metric, app_request_path which records the number of requests…

FlamingBee
- 125
- 1
- 1
- 6
8
votes
2 answers
Prometheus query to count unique labels over a timeframe
I need to count the number of unique labelsets for a prometheus metric over a given timeframe. For example, "How many unique labelsets have a value of 1 at some point during the past 7 days."
I've investigated using count and count_over_time but…

Scott Smith
- 221
- 2
- 7