Avoiding duplicate points when scraping

140 views
Skip to first unread message

ofir y

unread,
Apr 30, 2023, 5:25:45 AM4/30/23
to Prometheus Users
I have a Prometheus server which scrapes data from my API metrics endpoint that is populated using  Prometheus.net library . the scraping interval set to 15 seconds. I'm publishing a request duration summary metric to it. this metric is published at random times to the endpoint. but the scrape interval makes Prometheus thinks it is a new value every 15 seconds, even if no new data was published. this causes the _count & _sum values of the metric to be wrong, as they consider every 15 seconds to be a new point.

my goal is to be able to count & to sum up all requests actions. so if I had 3 requests over a period of 2 minutes like so:
00:00 request 1: duration 1 sec
00:30 request 2: duration 1 sec
01:55 request 3: duration 2 sec

the _count will be 3, and the _sum will be 4 seconds. can I achieve this somehow by using labels or something else?
Reply all
Reply to author
Forward
0 new messages