Add metrics

This commit is contained in:
jude
2024-03-24 20:37:29 +00:00
parent 4a80d42f86
commit ecd75d6f55
4 changed files with 30 additions and 53 deletions

View File

@@ -1,10 +1,11 @@
use poise::serenity_prelude::ActivityData;
use poise::{
serenity_prelude as serenity,
serenity_prelude::{CreateEmbed, CreateMessage, FullEvent},
serenity_prelude::{ActivityData, CreateEmbed, CreateMessage, FullEvent},
};
use crate::{component_models::ComponentDataModel, Data, Error, THEME_COLOR};
use crate::{
component_models::ComponentDataModel, metrics::COMMAND_COUNTER, Data, Error, THEME_COLOR,
};
pub async fn listener(
ctx: &serenity::Context,
@@ -67,6 +68,10 @@ To stay up to date on the latest features and fixes, join our [Discord](https://
component_model.act(ctx, data, &component).await;
}
if let Some(command) = interaction.clone().command() {
COMMAND_COUNTER.with_label_values(&[command.data.name.as_str()]).inc();
}
}
_ => {}
}