fluent-plugin-prometheus icon indicating copy to clipboard operation
fluent-plugin-prometheus copied to clipboard

Counter should start from 0

Open mhoshino opened this issue 6 years ago • 6 comments

Current implementation is not following the below rule

https://prometheus.io/docs/practices/instrumentation/#avoid-missing-metrics

To avoid this, export 0 (or NaN, if 0 would be misleading) for any time series you know may exist in advance.

This is leading to situation's such as creating prometheus alert. For example

rate(my_metric[1m]) > 0

Will not fire alert when my_metric=1 but instead my_metric > 2. This is because my_metric does not start with 0 and start's with 1

mhoshino avatar Dec 04 '18 02:12 mhoshino

Usually that happen after fluentd restart. Maybe there would be a way to make some storage to persist metrics/values between reboots? Some sort of buffer on disk

dkalashnik avatar Dec 05 '18 09:12 dkalashnik

Hi @dkalashnik . Do we really need to store this on buffer disk? The problem I am seeing is that, it needs to capture a message at least 2 times every time for it to generate alert after restart happens on fluentd. If it can start from 0 after the restart, I am assuming it will be able to fire the alert on the 1st message

mhoshino avatar Jan 29 '19 05:01 mhoshino

@mhoshino basicly its about https://github.com/prometheus/prometheus/issues/1673

mescanef avatar Feb 19 '19 10:02 mescanef

It seems without this being resolved there counter for the prometheus ruby client does not start from 0

prometheus/client_ruby#141

mhoshino avatar Sep 03 '19 04:09 mhoshino

+1 We still need this for error counting and doing delta alerting, otherwise the first counter will never be catched and you cannot use this metric for alerting.

Kuckkuck avatar Feb 06 '20 14:02 Kuckkuck

@mhoshino @Kuckkuck have you found a solution to use fluentd-plugin-prometheus metrics from prometheus?

yeplaa avatar May 03 '22 07:05 yeplaa