0

I'm pretty new to Prometheus and according to my understanding, there are many metrics already available in Prometheus. But I'm not able to see "http_requests_total" which is used in many examples in the list. Do we need to configure anything in order to avail these HTTP metrics?

My requirement is to calculate the no: of HTTP requests hitting the server at a time. So http_request_total or http_requests_in_flight metrics would be of great help for usage.

Can someone please guide me here on what to do next?

Savitha
  • 29
  • 4

1 Answers1

1

The documentation is extensive and helpful.

See installation

If you have Docker, you can simply run:

docker run \
--interactive --tty --rm \
--publish=9090:9090 \
prom/prometheus

And then browse: http://localhost:9090.

The default config is set to scrape itself.

You can list these metrics.

And graph prometheus_http_requests_total them.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88
  • Thanks for your reply.But I'm not able to list this metrics in dashboard in fact. Even after hitting multiple http requests in server, I'm not able to view this metrics. So do we have to configure the query somewhere? Like http_requests_total{deployment="my-deployment"} if i would like to see this query in the dashboard,what I have to do? – Savitha Jun 04 '21 at 03:08
  • The link in my answer results in a simple query to `prometheus_http_requests_total`, you needn't do anything else. If that doesn't work and you're unable to list the metrics, there's a different problem but there's insufficient information in your reply to diagnose it. If you're using a non-Linux OS, there's probably additional steps. I encourage you to read the documentation in the link I included as this should help. – DazWilkin Jun 04 '21 at 04:21
  • Thanks, DazWiklin, for the guidance. Now I'm able to see the metrics that I need in the Prometheus UI. But on querying http_requests_total{deployment="my-deployment"} , I'm getting 0 results. Actually, I'm expecting some values here. I don't know what is missing on my part. But I haven't configured any rules for these metrics. Can you throw some light here? I can see in logs that the corresponding deployment serves HTTP requests but cannot query the same. – Savitha Jun 04 '21 at 19:34
  • @savitha respectfully, you really would benefit from reading the Prometheus documentation. If you run Prometheus per the answer, there is a metric `prometheus_http_requests_total`. This metric has 3 labels: `code`, `handler`, `instance`, `job`. You can query by any combination of these e.g. `prometheus_http_requests_total{code="200",job="prometheus"}` but not by labels that don't exist (`deployment`) and their non-existent values `my-deployment`. If my answer helped, please mark it as the answer and good luck! – DazWilkin Jun 04 '21 at 20:38
  • Thanks DazWilkin – Savitha Jun 04 '21 at 21:25