New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialise metrics at startup #180
Comments
A workaround:
But then we need to check init each time, which is not performant. |
I think this runs DANGEROUSLY close to confusing zero ( I would not want this metric reading to be However, doing some digging. Is this related to why you need it set? prometheus/prometheus#1853 Per the Prometheus Best Practices:
|
Yes, I want to initiate counters with labels to 0. It is different from setting gauges, which makes less sense. |
Counters without dimensions are initialized to zero internally already.
The dimensioned counters are not, because (maybe obviously) the values are
not known until the log line is read (and mtail doesn't checkpoint this
state, deliberately.)
I've been considering a BEGIN like awk for a while but not really convinced
until now. Stlil a bit uneasy about the syntax; we only want to allow
counters to be initialized? I can imagine that other things might want to
be set up at start, but I don't know what those are. I worry though that
this feature (like all features) creates an explosion of possibility and
thus grants mtail programs the power to become very slow at processing log
lines.
…On Tue, 25 Sep 2018 at 04:07, Julien Pivotto ***@***.***> wrote:
Yes, I want to initiate *counters* with labels to 0. It is different from
setting gauges, which makes less sense.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#180 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AC5b-0qagqVxRhozGUWCilVjJiUKpzd3ks5ueR9OgaJpZM4W2PBC>
.
|
I can come up with a contrived example of why gauges should be initialized, but I do not have an actual example. I would want to set the gauge to zero when a gauge is measured as an offset of another number without a log file line stating as such (If we're using
Acknowledging feature creep, initializing is just for startup (runonce), it is just to initialize variables (no logic), and it is recommended practice by Prometheus. |
These seem like legit use cases. Let's build it.
…On Wed, 26 Sep 2018 at 05:45, Justin J. Novack ***@***.***> wrote:
Stlil a bit uneasy about the syntax; we only want to allow counters to be
initialized?
I can come up with a *contrived* example of why gauges should be
initialized, but I do not have an actual example. I would want to set the
gauge to zero when a gauge is measured as an offset of another number
without a log file line stating as such. If we're using mtail, the
application is probably not logging or metricing (verb) the way we want to,
and we have to give intelligence to it. On application start, if I'm
measuring drift of something that only complains when drift is NOT zero, I
would like to initialize it as zero on my metrics so I can watch it drift
from zero, rather than all of a sudden SEEING it at ±1 after a "missing"
period.
I worry though that this feature (like all features) creates an explosion
of possibility and thus grants mtail programs the power to become very slow
at processing log lines.
Acknowledging feature creep, initializing is just for startup (runonce),
it is just to initialize variables (no logic), and it is recommended
practice by Prometheus.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#180 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AC5b--jeP5lTPx2ZtR5m3Ni9t_0h7z59ks5ue3cDgaJpZM4W2PBC>
.
|
I think this is easier to implement without a BEGIN block but by allowing an initialisation expression after the metric declaration, e.g.: counter foo = 0 just like in C++. |
Huh, that doesn't work for the case in your first comment, with a dimensioned metric. :/ |
yeah because the counters are already 0 when they are not dimensional in mtail (IIRC) |
Facepalm. Thanks for the reminder :-) |
I've just started using mtail, but this one of the first things that confused me. I feel that when there are no matches, the value should always be set to '0' rather than omitting it. |
One reason for initializing any gauge/counter/histogram is where you have
This will return no value if "500" is missing as there are no results on the left side of the expression. |
Any progress on this ? We are using mtail based metrics to detect anomalies. However, we currently hitting prometheus/prometheus#1673. We would not hit this problem if the metric would be initialized to zero. |
@praetp did you try #180 (comment)? |
Our counters are in fact dimensionless, so I just needed to upstep to a newer version of mtail :) |
There is even no syntax I know of that can initialize histograms (regardless of BEGIN or not). |
Just like in awk BEGIN,
I would like to be able to initiate metrics.
The text was updated successfully, but these errors were encountered: