Why there are spikes when the counter increase at the same rate?

27 views
Skip to first unread message

stav alfi

unread,
Oct 24, 2020, 3:50:25 PM10/24/20
to Prometheus Users
Intro

I have a counter that is increasing by 1 every 1 second.
the scrape interval is 1 second as well

as you can see - pretty normal.

Screen Shot 2020-10-24 at 22.43.55.png

I would expect that the `rate(test_total[1m])` function will have the same result over time, but it doesn't:
Screen Shot 2020-10-24 at 22.45.50.png

Question:

Why the rate isn't equal to 1 exectly on each timestamp? why there are spikes?

Ben Kochie

unread,
Oct 24, 2020, 4:34:02 PM10/24/20
to stav alfi, Prometheus Users

--
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/701610c2-8c97-4b38-a386-db9ba0040fbdn%40googlegroups.com.

stav alfi

unread,
Oct 24, 2020, 6:45:26 PM10/24/20
to Prometheus Users
here is an update graph with the raw data:

Screen Shot 2020-10-25 at 1.43.02.png

{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"test_total","instance":"host.docker.internal:3000","job":"prometheus"},"values":[[1603579215.318,"2503"],[1603579216.315,"2504"],[1603579226.318,"2514"],[1603579231.316,"2519"],[1603579240.509,"2528"],[1603579241.508,"2529"],[1603579243.508,"2531"],[1603579249.510,"2537"],[1603579254.511,"2542"],[1603579256.508,"2544"],[1603579269.475,"2557"],[1603579270.476,"2558"],[1603579283.474,"2571"],[1603579288.474,"2576"],[1603579289.474,"2577"],[1603579291.474,"2579"],[1603579292.475,"2580"],[1603579295.474,"2583"],[1603579315.442,"2603"],[1603579319.443,"2607"],[1603579321.440,"2609"],[1603579322.441,"2610"],[1603579323.439,"2611"],[1603579324.439,"2612"],[1603579341.405,"2629"],[1603579343.405,"2631"],[1603579349.407,"2637"],[1603579350.405,"2638"],[1603579353.407,"2641"],[1603579354.407,"2642"],[1603579364.371,"2652"],[1603579373.371,"2661"],[1603579380.370,"2668"],[1603579397.337,"2685"],[1603579399.336,"2687"],[1603579406.337,"2694"]]}]}}


-----------


by looking at the raw data, it seems that even though I set promethues to scrape my app every 1 sec, it doesn't do that (?) :

global:
   scrape_interval: 1s
   evaluation_interval: 1s

Brian Candler

unread,
Oct 25, 2020, 3:32:17 AM10/25/20
to Prometheus Users
It could be that some of your scrapes are failing.  With a 1 second scrape interval, the scrape time limit will be 0.5 seconds by default, I believe.

What does a graph of

up{job="prometheus",instance="host.docker.internal:3000"}
scrape_duration_seconds{job="prometheus",instance="host.docker.internal:3000"}

show?  What happens if you change your scrape interval to 10 seconds?

How are you generating this "test_total" metric, i.e. what exporter is running on port 3000? And can you show the definition of the "prometheus" scrape job in your prometheus.yml ?  (Aside: it would be normal to give the scrape job a more descriptive name, since you're not scraping prometheus itself)

Brian Brazil

unread,
Oct 25, 2020, 4:05:45 AM10/25/20
to Brian Candler, Prometheus Users
On Sun, 25 Oct 2020 at 07:32, Brian Candler <b.ca...@pobox.com> wrote:
It could be that some of your scrapes are failing.  With a 1 second scrape interval, the scrape time limit will be 0.5 seconds by default, I believe.

It'll be a second. It's only the blackbox exporter that subtracts out half a second (by default), as if the probe times out there's still useful metrics about how it failed that we want to try to get back to Prometheus.

Brian
 

What does a graph of

up{job="prometheus",instance="host.docker.internal:3000"}
scrape_duration_seconds{job="prometheus",instance="host.docker.internal:3000"}

show?  What happens if you change your scrape interval to 10 seconds?

How are you generating this "test_total" metric, i.e. what exporter is running on port 3000? And can you show the definition of the "prometheus" scrape job in your prometheus.yml ?  (Aside: it would be normal to give the scrape job a more descriptive name, since you're not scraping prometheus itself)

--
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.

stav alfi

unread,
Oct 25, 2020, 4:55:20 PM10/25/20
to Prometheus Users
I can't reproduce it anymore. the graph is valid (I think).

I will update this thread if there will be any change. Thank you all for the help.

--------------

Screen Shot 2020-10-25 at 22.53.17.png


{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"counter_test","instance":"host.docker.internal:3000","job":"prometheus"},"values":[[1603659076.295,"0"],[1603659077.295,"1"],[1603659078.295,"2"],[1603659079.295,"3"],[1603659080.295,"4"],[1603659081.295,"5"],[1603659082.295,"6"],[1603659083.295,"7"],[1603659084.295,"8"],[1603659085.295,"9"],[1603659086.295,"10"],[1603659087.295,"11"],[1603659088.295,"12"],[1603659089.295,"13"],[1603659090.295,"14"],[1603659091.295,"15"],[1603659092.295,"16"],[1603659093.295,"17"],[1603659094.295,"18"],[1603659095.295,"19"],[1603659096.295,"20"],[1603659097.295,"21"],[1603659098.295,"22"],[1603659099.295,"23"],[1603659100.295,"24"],[1603659101.295,"25"],[1603659102.295,"26"],[1603659103.295,"27"],[1603659104.295,"28"],[1603659105.295,"29"],[1603659106.295,"30"],[1603659107.295,"31"],[1603659108.295,"32"],[1603659109.295,"33"],[1603659110.295,"34"],[1603659111.295,"35"],[1603659112.295,"36"],[1603659113.295,"37"],[1603659114.295,"38"],[1603659115.295,"39"],[1603659116.295,"40"],[1603659117.295,"41"],[1603659118.295,"42"],[1603659119.295,"43"],[1603659120.295,"44"],[1603659121.295,"45"],[1603659122.295,"46"],[1603659123.295,"47"],[1603659124.295,"48"],[1603659125.295,"49"],[1603659126.295,"50"],[1603659127.295,"51"],[1603659128.295,"52"],[1603659129.295,"53"],[1603659130.295,"54"],[1603659131.295,"55"],[1603659132.295,"56"],[1603659133.295,"57"],[1603659134.295,"58"],[1603659135.295,"59"],[1603659136.295,"60"],[1603659137.295,"61"],[1603659138.295,"62"],[1603659139.295,"63"],[1603659140.295,"64"],[1603659141.295,"65"],[1603659142.295,"66"],[1603659143.295,"67"],[1603659144.295,"68"],[1603659145.295,"69"],[1603659146.295,"70"],[1603659147.295,"71"],[1603659148.295,"72"],[1603659149.295,"73"],[1603659150.295,"74"],[1603659151.295,"75"],[1603659152.295,"76"],[1603659153.295,"77"],[1603659154.295,"78"],[1603659155.295,"79"],[1603659156.295,"80"],[1603659157.295,"81"],[1603659158.295,"82"],[1603659159.295,"83"],[1603659160.295,"84"],[1603659161.295,"85"],[1603659162.295,"86"],[1603659163.295,"87"],[1603659164.295,"88"],[1603659165.295,"89"],[1603659166.295,"90"],[1603659167.295,"91"],[1603659168.295,"92"],[1603659169.295,"93"],[1603659170.295,"94"],[1603659171.295,"95"],[1603659172.295,"96"],[1603659173.295,"97"],[1603659174.295,"98"],[1603659175.295,"99"],[1603659176.295,"100"],[1603659177.295,"101"],[1603659178.295,"102"],[1603659179.295,"103"],[1603659180.295,"104"],[1603659181.295,"105"],[1603659182.295,"106"],[1603659183.295,"107"],[1603659184.295,"108"],[1603659185.295,"109"],[1603659186.295,"110"],[1603659187.295,"111"],[1603659188.295,"112"],[1603659189.295,"113"],[1603659190.295,"114"],[1603659191.295,"115"],[1603659192.295,"116"],[1603659193.295,"117"],[1603659194.295,"118"],[1603659195.295,"119"],[1603659196.295,"120"],[1603659197.295,"121"],[1603659198.295,"122"],[1603659199.295,"123"],[1603659200.295,"124"],[1603659201.295,"125"],[1603659202.295,"126"],[1603659203.295,"127"],[1603659204.295,"128"],[1603659205.295,"129"],[1603659206.295,"130"],[1603659207.295,"131"],[1603659208.295,"132"],[1603659209.295,"133"],[1603659210.295,"134"],[1603659211.295,"135"],[1603659212.295,"136"],[1603659213.295,"137"],[1603659214.295,"138"],[1603659215.295,"139"],[1603659216.295,"140"],[1603659217.295,"141"],[1603659218.295,"142"],[1603659219.295,"143"],[1603659220.295,"144"],[1603659221.295,"145"],[1603659222.295,"146"],[1603659223.295,"147"],[1603659224.295,"148"],[1603659225.295,"149"],[1603659226.295,"150"],[1603659227.295,"151"],[1603659228.295,"152"],[1603659229.295,"153"],[1603659230.295,"154"],[1603659231.295,"155"],[1603659232.295,"156"],[1603659233.295,"157"],[1603659234.295,"158"],[1603659235.295,"159"],[1603659236.295,"160"],[1603659237.295,"161"],[1603659238.295,"162"],[1603659239.295,"163"],[1603659240.295,"164"],[1603659241.295,"165"],[1603659242.295,"166"],[1603659243.295,"167"],[1603659244.295,"168"],[1603659245.295,"169"],[1603659246.295,"170"],[1603659247.295,"171"],[1603659248.295,"172"],[1603659249.295,"173"],[1603659250.295,"174"],[1603659251.295,"175"],[1603659252.295,"176"],[1603659253.295,"177"],[1603659254.295,"178"],[1603659255.295,"179"]]}]}}
Reply all
Reply to author
Forward
0 new messages