Time Filter on prometheus metrics

264 views
Skip to first unread message

dikshant rai

unread,
Apr 5, 2023, 6:45:17 AM4/5/23
to Prometheus Users
Hi,
I created a prometheus metric query as per the logs to count them and put them in grafana dashboard show that I can visualise them in numbers.
I am creating one gauge and one trendline. Fo trendline it is good.
Query is:    
 sum(http_server_requests_seconds_count{uri="/collection/completeTask", method="POST", application="collection-service", status="200"})
only issue is time filter is not there. For example: If I put filter in grafana for 30 min it will show total number of task and If I put it for 2 days it still shows the same.
It must be in way that it should shows how many request has been generated in last 30 min or 1 hour only.
How can we put time filter for same?

Brian Candler

unread,
Apr 5, 2023, 7:13:39 AM4/5/23
to Prometheus Users
Your question appears to be about Grafana, so it would be best asked to the Grafana community:

dikshant rai

unread,
Apr 5, 2023, 7:46:47 AM4/5/23
to Prometheus Users
Hi Brian,
Thanks for responding. I just wanted to confirm that I am not missing anything on prometheus query.

dikshant rai

unread,
Apr 5, 2023, 1:48:25 PM4/5/23
to Prometheus Users
Hi Brian,
I tried everything on grafana but it looks like there is not any filter in grafana. I might be missing something writing PROMQL or count metrics does not support this.
I only want them to list out count in given time filter

Brian Candler

unread,
Apr 5, 2023, 3:24:43 PM4/5/23
to Prometheus Users
Sorry, but your question is about the capabilities and configuration of Grafana panels ("one gauge and one trendline"), not about Prometheus or PromQL.

The actual API call made to Prometheus (e.g. whether it's an instant query or a range query, and if a range then what time range is requested) is entirely controlled by Grafana.  How it renders the results of that query is entirely controlled by Grafana.

dikshant rai

unread,
Apr 6, 2023, 2:35:31 AM4/6/23
to Prometheus Users
Hi Brian, time range is not fixed as it always vary for duration we wanted to check. I also try to plot in prometheus but not getting expected output. Only filter I want to put that for selected time frame it should show me only for specific time. I am attaching for your reference. I have put 3 hour as filter but it is showing me for whole instead of 3 our only.prome-metric.png
Reply all
Reply to author
Forward
0 new messages