bakins / gearman-exporter

Gearmand metrics exporter for Prometheus
MIT License
21 stars 10 forks source link

Counter that counts up? #16

Closed tegk closed 4 years ago

tegk commented 5 years ago

Why not use a counter that counts up rather than to count the current jobs?

bakins commented 5 years ago

At the time, I think we cared about the jobs running right now. Also, I don't recall if that data is easy to get from gearman.

I haven't used this code in a long time, so if you - or someone else is interested - I can transfer ownership.

zoonage commented 4 years ago

@tegk This functionality isn't possible as you cannot know if a job has completed by the time the second scrape has. If you have a scrape interval of 30 seconds but each job takes 1 minute then the job will be counted twice by a counter.

The counting would have to be done by Gearman.

tegk commented 4 years ago

@tegk This functionality isn't possible as you cannot know if a job has completed by the time the second scrape has. If you have a scrape interval of 30 seconds but each job takes 1 minute then the job will be counted twice by a counter.

The counting would have to be done by Gearman.

That's why you would always increment and let Prometheus calculate the rate

zoonage commented 4 years ago

@tegk This functionality isn't possible as you cannot know if a job has completed by the time the second scrape has. If you have a scrape interval of 30 seconds but each job takes 1 minute then the job will be counted twice by a counter. The counting would have to be done by Gearman.

That's why you would always increment and let Prometheus calculate the rate

The counter carries the risk of overcounting long running jobs, so the rate as calculated by Prometheus could appear higher than what it actually is.

If at t0 you have jobs a,b,c running then the counter would be 3, if at t1 you have jobs a,d,e running (i.e. a is long running) then the counter would be 6 even though there have actually only been 5 jobs