Feature: Any way to increment/decrement with a delay (after syntax) #884
-
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
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 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 Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 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. |
Beta Was this translation helpful? Give feedback.
-
@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 |
Beta Was this translation helpful? Give feedback.
-
@jaqx0r |
Beta Was this translation helpful? Give feedback.
-
No; my followup is that you should do this in a collector. If you wanted to implement a |
Beta Was this translation helpful? Give feedback.
Thanks for the kind words!
There's no way to add a delay.
mtail
is designed to give immediate feedback to the monitoring system that collects its metrics.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
changes()
function in Prometheus would do what you want: https://prometheus.io/docs/prometheus/l…