Multiple handlers of api server in table with instant vectors

41 views
Skip to first unread message

Srikanth Chekuri

unread,
Jul 14, 2020, 7:10:02 AM7/14/20
to Prometheus Users
Hello,

prometheus has a way to return all time series with the metric http_requests_total and the given job and handler labels using

`http_requests_total{job="apiserver", handler="/api/comments"} 
`
I want to have a table with all api endpoints and their corresponding http total requests. How do i achieve this?

Brian Candler

unread,
Jul 14, 2020, 8:16:39 AM7/14/20
to Prometheus Users
Does the query

http_requests_total{job="apiserver"}

do what you want?  If not, can you clarify what it is that you want?

Give some examples of the input data, and what output data you'd like to see.  Are you trying to combine/summarise different timeseries?  If so, what are they?

Srikanth Chekuri

unread,
Jul 14, 2020, 8:44:52 AM7/14/20
to Prometheus Users

The query http_requests_total{job="apiserver", handler="/tests"}  gives me the data I need. I want to do this for multiple endpoint in a table. For example I have few other endpoints "/scores", "/runs", "/tests/:id" . I want to make a table with each api endpoint and its corresponding requests count.


-----------------------------------
 API           |   Count
-----------------------------------
/tests        |  100
/scores     |  10
/runs        |  420
/tests/:id |  69

----------------------------------

Brian Candler

unread,
Jul 14, 2020, 11:54:02 AM7/14/20
to Prometheus Users
On Tuesday, 14 July 2020 13:44:52 UTC+1, Srikanth Chekuri wrote:

The query http_requests_total{job="apiserver", handler="/tests"}  gives me the data I need.

I don't think it does - you say you want a table with other values like handler="/scores", handler="/runs" etc.

Why does this query not do what you want?

     http_requests_total{job="apiserver"}

It will give you a separate answer for every timeseries, which means every unique value of the "handler" label.  It's the table you asked for.  Try it in the promQL browser in the prometheus web interface.
Reply all
Reply to author
Forward
0 new messages