Tracking latency

30 views
Skip to first unread message

Manish G

unread,
Jan 12, 2021, 1:37:34 AM1/12/21
to Prometheus Users
Hi All,

We have some flink metrics configured for our flatmap functions. We have basically a gauge which keeps track of total time function has taken so far and a counter which keeps track of number of times function has been invoked.

We want to capture average time taken by the function in grafana panel.
Can we use above 2 metrics for this purpose(gauge/counter) or should we use what is explained here.

WIth regards

Matthias Rampke

unread,
Jan 12, 2021, 7:34:28 AM1/12/21
to Manish G, Prometheus Users
If you keep adding up the time the function has taken across all invocations, that is also a counter. You can get the average run time over, say, 5 minutes by tracking

rate(function_run_time_sum[5m]) / rate(function_run_time_count[5m])

Using native Prometheus clients, you get both if you use either a summary or a histogram and .observe() each invocation time as it happens.

/MR


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAOFd6ij85%2BPs%3DsuOqpD7TPJiV3_8v%2BBA3us%3Dicm5o8t1zNh0-Q%40mail.gmail.com.

Manish G

unread,
Jan 12, 2021, 7:49:01 AM1/12/21
to Matthias Rampke, Prometheus Users
Thanks Matthias. It clears lots of things..

Manish G

unread,
Jan 13, 2021, 12:18:31 PM1/13/21
to Matthias Rampke, Prometheus Users
So I have added prometheus client histogram following this.
Mine is spring application and I have added micrometer-registry-prometheus dependency.
Any other configuration needed so that histogram data is published to prometheus?


Reply all
Reply to author
Forward
0 new messages