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
Feature: Any way to increment/decrement with a delay (after syntax) #762
Comments
Thanks for the kind words! There's no way to add a delay. I would think about trying to do this with the monitoring collector. You can export the last seen time for each user in a histogram type:
and then with your monitoring system count users who have been seen in the last hour, maybe something like:
(some sort of pseudo-Prometheus expression here) I think the
Or
Counting the number of labels in a metric is an interesting one -- that doesn't require any historical storage and is totally doable. I can imagine that working for you if you use
but you still need the count feature. Again, that's something that I'd defer to the monitoring collector though. |
@jaqx0r well, yes - i agree that "computation"/"analysis" should be done after mtail, i.e. in prometheus.. but in this case, the sheer amount of metric labels (there are a couple of thousands of possible usernames) place a huge burden on prometheus, as each label opens up a new time series. see https://prometheus.io/docs/practices/naming/
so the requirements to store these (possible thousands) of labels and then do a count (the only thing we're interested in) in prometheus a quite an overkill.. you mentioned that maybe a |
@jaqx0r |
No; my followup is that you should do this in a collector. If you wanted to implement a |
Hi!
First, thanks for mtail and your community support, it's great! ;-)
I'm using this version currently:
I have a use case that does not seem possible currently - but would be of great use.
What do I want to archieve?
I want to render a
gauge
metric that expresses the number of active users of an application.What i do
The application outputs this if a user makes a request (exemplary):
So OK great - so i do this:
Which works to track them - but i actually do not want a metric that has a label per user - i just want to have a count..
What is missing
From what I see, there is no way to have a "count of active users in this scenario" - as Crucially, there is not log event that tells me when the hour has passed, so there is no log line that says "now he is inactive, the hour passed".
It would be great if I could write this:
That way, if a new
$user
comes around (one which is not inactive_users
yet), i could increment it temporarly for an hour - mtail would automatically decrease it.Another way to solve it
Another feature that would be amazing in this scenario is a function that could count the number of labels in a metric.
That way i could simply write:
That would be amazing! ;-) We have
len()
for strings, so some kind of function that allows me to do the same for the metric dimensions..Thanks!
The text was updated successfully, but these errors were encountered: