prometheus-community / promql-langserver

PromQL language server
Apache License 2.0
176 stars 18 forks source link

Prometheus Query function to retrieve the number of requests for last $period #210

Closed rajasree1993 closed 3 years ago

rajasree1993 commented 3 years ago

Hi all

We have been exploring on all the Prometheus Query functions which can be useful to retrieve the number of requests for the last $period from a cumulative stats http_srv_req_count.

sum(http_srv_req_count) - sum(http_srv_req_count offset $period) >= 0

Can you confirm if the below function would help in the scenario as mentioned above. idelta(http_srv_req_count[$period]) >= 0

  1. If not can you suggest a PromQL function to satisfy our requirement.
  2. if yes, whats the impact of $period in the idelta function. With our observation, can see that it takes the difference of last two samples everytime and show the result but when does the $period gets applied.
slrtbtfs commented 3 years ago

Thanks for your report. It looks as if this is actually a question about usage and not development.

It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided.