sinkingpoint / prometheus-gravel-gateway

A Prometheus Aggregation Gateway for FAAS applications
GNU Lesser General Public License v3.0
115 stars 10 forks source link

Pebbles - mean not correct #14

Closed ltagliamonte closed 2 years ago

ltagliamonte commented 2 years ago

The result of using mean5m seems not correct. To reproduce run the gateway locally and send:

echo '# TYPE test_value gauge
test_value{clearmode="mean5m"} 22' | curl --data-binary @- localhost:4278/metrics/job/testjob

expected 22, returns 0

curl localhost:4278/metrics
# TYPE test_value gauge
test_value{job="testjob"} 0

the result is wrong for all successive submissions.

ltagliamonte commented 2 years ago

@sinkingpoint i tested latest master and it seems fixed. One thing i would add in the documentation is that every5m the mean resets and it doesn't take into account the prev value.

curl localhost:4278/metrics
echo '# TYPE test_value gauge
test_value{clearmode="mean5m"} 1' | curl --data-binary @- localhost:4278/metrics/job/testjob
echo '# TYPE test_value gauge
test_value{clearmode="mean5m"} 2' | curl --data-binary @- localhost:4278/metrics/job/testjob
echo '# TYPE test_value gauge
test_value{clearmode="mean5m"} 3' | curl --data-binary @- localhost:4278/metrics/job/testjob
curl localhost:4278/metrics

sleep 330

curl localhost:4278/metrics
echo '# TYPE test_value gauge
test_value{clearmode="mean5m"} 10' | curl --data-binary @- localhost:4278/metrics/job/testjob
curl localhost:4278/metrics
sinkingpoint commented 2 years ago

One thing i would add in the documentation is that every5m the mean resets and it doesn't take into account the prev value.

What was the behavior you were expecting? Pebbles discard data outside the time frame (5 minutes in this case), so this is expected on our end