Apollo-Roboto / discord.py-ext-prometheus

Add Prometheus to your Discord bot with this handy extension
https://pypi.org/project/discord-ext-prometheus/
MIT License
15 stars 5 forks source link

Counters have absurd values #19

Closed 2br-2b closed 3 weeks ago

2br-2b commented 3 weeks ago

When using this library, I've noticed a problem.

When I start a counter, I get a _total and a _sum object. The sum always seems to end up at some absurdly high value.

(Note - code taken from my bot, which is functionally the same as this)

ON_INTERACTION_COUNTER = Counter(
    METRIC_PREFIX + 'event_on_interaction',
    'Amount of interactions called by users',
    ['shard', 'interaction', 'command'],
)

In this example, the counter always starts at something crazy like 1718207136.937016.

To counter this, I get the rate :

sum by (command) (increase(max_over_time(prod_storybot_event_on_interaction_total{job="$job",command!="None"}[$__range])[$__range:]))

But this causes the query to go slow and time out.

I think this might be a bug in the client library, but I just wanted to check

Apollo-Roboto commented 3 weeks ago

Can you show the result of this promql query? I'm wondering which interaction type is influencing this counter the most.

sum(discord_event_on_interaction_total) by (interaction)
2br-2b commented 3 weeks ago

Odd... since last boot, it seems like I'm getting normal values:

sum(prod_storybot_event_on_interaction_total) by (interaction)

image

I'm not sure why - usually, the counters will have crazy values. I'm not sure why it seems to be working now.

I guess I'll close this for now, but reopen when I see this issue again?