Pushgateway or StatsD

39 views
Skip to first unread message

Albert Aleksandrov

unread,
May 16, 2020, 12:59:28 PM5/16/20
to Prometheus Users
Hi all!

(Django app)

We have a business entity called upload. It has such parameters (labels) as 
1. series (series1, series2, etc), 
2. processing_duration (in seconds)
3. status (success, running, terminated),
4. some another labels.

With Prometheus we would like to count:
1. uploads summed by status,
2. average duration by series,
3. something else.

Now I see metrics to look like this to archive our goals:

upload{series="series1", status="terminated"} 1  # actually the value is always 1
upload{series="series2", status="terminated"} 1
upload{series="series2", status="success"} 1

upload_processing_duration{series="series1"} 20 
upload_processing_duration{series="series2"} 30

With such metrics queries would be like this:

sum(upload{status="terminated"}) or sum(upload{series="series1"})
avg(upload_duration{series="series1"})

So as to have such raw (plain, atomic) data in Prometheus one should to push
them as they appear or to save them by one (without overriding) if we use /metrics 
endpoint which then is being scraped by Prometheus with some interval.

I tried pushgateway but when metrics pushed they stay there with the same values
until overriding or deleting. And it happens that Prometheus scrapes the same values again 
and again instead of to scrape them and forget delete.

wefwe.jpg

Could you please say how can I archive such behaviour?


Albert Aleksandrov

unread,
May 16, 2020, 1:06:46 PM5/16/20
to Prometheus Users
One minute later I thought about deleting metrics from registry after being scraped
and registering it back when upload appear.

суббота, 16 мая 2020 г., 19:59:28 UTC+3 пользователь Albert Aleksandrov написал:

Matthias Rampke

unread,
May 16, 2020, 5:24:24 PM5/16/20
to Albert Aleksandrov, Prometheus Users
If you care about the individual event to the extent that you want to see it individually, you are probably better off using an event tracking system like the ELK stack.

Prometheus shines when you only need to track aggregates, such as the number of uploads, and the total time of uploads. It can do math to get the average duration and such from that, but it cannot track "this upload in particular took that long". From this perspective, the metrics staying constant when there are no new uploads makes sense: the *total* does not stop existing just because it did not increase in the last minute.



/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/c7870b28-7a40-417d-9b74-d6c2b48390b4%40googlegroups.com.

Albert Aleksandrov

unread,
May 19, 2020, 3:03:19 AM5/19/20
to Prometheus Users
Thanks for the idea

воскресенье, 17 мая 2020 г., 0:24:24 UTC+3 пользователь Matthias Rampke написал:
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages