discord.py-ext-prometheus icon indicating copy to clipboard operation
discord.py-ext-prometheus copied to clipboard

Command use count reset by restart of bot

Open solumath opened this issue 1 year ago • 3 comments

Currently, when I restart a bot the command count is reset which is the defined behaviour. However is there a way to make the logs for command count persistent or rather incremental? I sometimes need to restart the whole bot and these metrics just disappear.

I can always just store the command count in my file but I was wondering if you knew about something that would made it easier or rather native to the prometheus.

solumath avatar Feb 24 '25 08:02 solumath

Maybe it would be good to have different metrics for all-time command use and since boot?

solumath avatar Feb 24 '25 13:02 solumath

I'm not sure how to approach this, that sounds like a case for an analytical database more than system metrics, Prometheus isn't designed for persistence. Personally I'd like to see how many commands the bot handled before a crash for example.

We could have an option for an initial command count in the class if that's preferred. Let me know :)

Apollo-Roboto avatar Mar 25 '25 19:03 Apollo-Roboto

Yeah well, I was experimenting a lot with it and got it to somehow show something to have at least some idea. Not sure how accurate this is, use on your own danger :).

sum(increase(discord_event_on_interaction_total{job=~"$job", command!="None"}[$__range])+1)

But it's better than creating a whole database just for counting the commands.

solumath avatar Mar 26 '25 15:03 solumath