Skip to content

Metrics

Leonid Kozarin edited this page Apr 10, 2023 · 1 revision

Metrics

Metrics are exposed as the /metrics endpoint on an APP_PORT.

There are metrics for message handlers and inline handlers, and also a inline_result_was_chosen metric, which is a counter of all messages sent by users using the bot (to make it work, it's necessary to enable a special option by us the bot (to make it work, it's necessary to enable a special option by using the /setinlinefeedback command of @BotFather.

Metrics for message handlers

A counter of the Handle() method calls. They're registered according to the following scheme: used_message_handler_{struct name}

To get charts for all metrics for 4 weeks use the following PromQL query:

increase(label_replace(label_replace({__name__=~"used_message_handler_.*", job="SadFavBot"},"name_label","$1","__name__", "(.+)"), "instance", "", "__name__", "(.+)")[4w:])

Metrics for inline handlers

A counter of the Handle() method calls. They're registered according to the following scheme: used_inline_handler_{struct name}