-
|
Hi! counter foo_fail_state by nb
/.* bal (?P<nb>\d+).*fail_state/{
foo_fail_state[$nb]++
del foo_fail_state[$nb] after 1h
}The counter keep counting as long as the "nb" is in the log lines. Once the "nb" is deleted and no more log lines are generated for that "nb" the counter keeps reporting the last value indefinitely unless mtail process gets restarted from which point the counter for the particular "nb" is gone. Looks like a waste of resources. I added "del foo_fail_state[$nb] after 1h" line hoping that the counter for the deleted "nb" would disappear from the reports (Prometheus scrapes the mail metrics) after 1 hour of inactivity/value change. Is there a way around this? How do I stop reporting a metric for a key that does not exist anymore? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
That looks like a bug. The value of the |
Beta Was this translation helpful? Give feedback.
That looks like a bug.
del=afteris specifically designed for this.The value of the
$nbth element in the label should be getting removed after an hour of no activity. This is documented here and here.