HTTP response duration with Prometheus

52 views
Skip to first unread message

Albert Aleksandrov

unread,
Apr 29, 2020, 4:17:26 AM4/29/20
to Prometheus Users

Hi all!


We have React app. It is deployed in Rancher and opened to the world by ingress. The task is to track response duration for the app pages with Prometheus. Prometheus metrics with percentiles.


I know there is npmjs package prom-client exists. As far as I can see it suggest to track time at the start and then at the end of request and then write down the duration (difference).


Here I would like to ask may be there is another way to track response duration? May be at ingress nginx stage?

Brian Candler

unread,
Apr 29, 2020, 4:32:40 AM4/29/20
to Prometheus Users
If you're instrumenting your application with a prometheus client library, then you won't be generating a metric for every requests. Almost certainly you want to be using histograms: that is, you divide the response times into buckets at values that make sense for your use case (say 1ms, 5ms, 10ms, 50ms, 100ms) and increment a counter for the appropriate bucket.

It looks like the nginx ingress controller already has this feature, albeit with fixed bucket sizes:

Albert Aleksandrov

unread,
Apr 30, 2020, 8:20:30 AM4/30/20
to Prometheus Users
Brian, thank you for your answer.

I misunderstood current environ. We have cluster ingress and no NGINX before the frontend react app. Is seems that we should realize metrics gathering inside app.

среда, 29 апреля 2020 г., 11:32:40 UTC+3 пользователь Brian Candler написал:

Brian Candler

unread,
Apr 30, 2020, 12:58:44 PM4/30/20
to Prometheus Users
Which ingress controller are you using?

Albert Aleksandrov

unread,
Apr 30, 2020, 1:34:49 PM4/30/20
to Prometheus Users
rancher/nginx-ingress-controller

четверг, 30 апреля 2020 г., 19:58:44 UTC+3 пользователь Brian Candler написал:
Reply all
Reply to author
Forward
0 new messages