Skip to main content

Questions tagged [promql]

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.

0 votes
0 answers
12 views

PromQL query for specific duration

Stuck on a simple task. The request should only be processed if the request condition is true for more than 10 minutes. Let's say cpuLoad{instance="1.1.1.1"}>80 It should be output only ...
Stas_khodorich's user avatar
0 votes
0 answers
29 views

promQL or metricsQL subtract two time series

Preface My distributed server application emits a gauge for each active client. I want to see which clients are active against 2 nodes simultaneously. So I have a promQL query like so: count by (...
Gregor's user avatar
  • 1
-1 votes
0 answers
18 views

promql Compare the current label values with the past label values when the past label values do not exist

I have a counter type metric named request_count, which has labels route and status_code. I need to trigger an alert when the growth rate within the same minute compared to one week ago exceeds 1.5. ...
HuDahai's user avatar
  • 45
0 votes
1 answer
32 views

Nodata to Zero values in promQL

Context: I’m currently working on monitoring HAProxy logs using Loki and Prometheus. I’ve created a recording rule in Loki to count the logs: Loki Query: sum by (hostname, k8s_cluster_name) (...
Abhilash 's user avatar
0 votes
1 answer
24 views

Aggregating over multiple series and time in Prometheus PromQL

I have some data I am querying from Prometheus, a range vector, that I am currently getting via sum by (label1, label2) (series_name), and as expected, it gives me the most recent results of the sums ...
Yi Chen Chong's user avatar
-3 votes
0 answers
22 views

A PromQL request to create an alert in Prometheus

Can someone help me find out a solution for my work task? So the main problem is that only one matching label between two vectors persists, it is 'place'. Some labels like instance where it values ...
Stanislav's user avatar
0 votes
0 answers
19 views

Prometheus Gauge Metric: Inconsistent Sum Over Time for Device Status

I have a gauge metric that tracks device_status (ON/OFF). I would like to determine how many seconds a device was ON for a given period (e.g., yesterday, the current week, or the current month). For ...
lwin's user avatar
  • 4,280
1 vote
0 answers
20 views

Seasoning statistics of a metric

By *seasoning" I mean a metric that fluctuates near periodically, e.g. number of players reaches its peak at Saturday and Sunday. Suppose I have a matric my_metric with period of one week. How to ...
MasterMind's user avatar
0 votes
0 answers
21 views

How to use metric label values as X-Axis in Grafana Bar Chart?

I am attempting to display historical metrics of test results in Grafana Bar Chart using Prometheus as a data source. The goal is to display a summary of failed/passed test cases per day/build_id (...
David's user avatar
  • 13
0 votes
0 answers
53 views

Prometheus query to get previous deployment image tag

I am looking for a query to see when a container's image tag changes within a pod with Prometheus and that return it previous value. I tried to use kube_pod_container_info{} != kube_pod_container_info{...
user3441194's user avatar
0 votes
0 answers
14 views

How to query Prometheus only once for multiple queries in Grafana

I have a number of Prometheus queries in a Grafana panel that use this structure: sum(avg_over_time(cluster:capacity_cpu_cores:sum[$__range])) / $number_of_CPU_cores_per_server * ($__range_s / $...
wwillfred's user avatar
0 votes
0 answers
10 views

Prometheus promQL single label matcher empty value [duplicate]

I was going through promQL querying basics and noticed a statement which does not make sense. In contrast, these expressions are valid as they both have a selector that does not match empty label ...
yash sharma's user avatar
0 votes
1 answer
48 views

How to filter a time series after applying aggregation in PromQL?

I have a promQL expression like this- sum(metric_1) by (label_1). Now, I want to filter out the output of the expression using another label label_2. Something like this- (sum(metric_1) by (label_1, ...
Shauryagoel's user avatar
0 votes
1 answer
26 views

Can I get timedelta between first and last metric from prometheus?

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 ...
user25663127's user avatar
0 votes
1 answer
60 views

How to extract a substring from a label value in promql?

I have a Prometheus metric as shown below query_duration{query = "SELECT * FROM TABLE_NAME"} I'm trying to extract only TABLE_NAME from the label query. I'm trying to use regex to extract ...
dev333's user avatar
  • 769

15 30 50 per page
1
2 3 4 5
69