Add more counters
This commit is contained in:
parent
4c17286614
commit
cd5651c7f6
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2215,7 +2215,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "soundfx-rs"
|
name = "soundfx-rs"
|
||||||
version = "1.5.13"
|
version = "1.5.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"dashmap",
|
"dashmap",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "soundfx-rs"
|
name = "soundfx-rs"
|
||||||
description = "Discord bot for custom sound effects and soundboards"
|
description = "Discord bot for custom sound effects and soundboards"
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
||||||
version = "1.5.14"
|
version = "1.5.15"
|
||||||
authors = ["jellywx <judesouthworth@pm.me>"]
|
authors = ["jellywx <judesouthworth@pm.me>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ use poise::serenity_prelude::{
|
|||||||
ActionRowComponent, Activity, Context, CreateActionRow, CreateComponents,
|
ActionRowComponent, Activity, Context, CreateActionRow, CreateComponents,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "metrics")]
|
||||||
|
use crate::metrics::GREET_COUNTER;
|
||||||
use crate::{
|
use crate::{
|
||||||
cmds::search::SoundPager,
|
cmds::search::SoundPager,
|
||||||
models::{
|
models::{
|
||||||
@ -73,6 +75,9 @@ pub async fn listener(ctx: &Context, event: &poise::Event<'_>, data: &Data) -> R
|
|||||||
|
|
||||||
let (handler, _) = join_channel(&ctx, guild, user_channel).await;
|
let (handler, _) = join_channel(&ctx, guild, user_channel).await;
|
||||||
|
|
||||||
|
#[cfg(feature = "metrics")]
|
||||||
|
GREET_COUNTER.inc();
|
||||||
|
|
||||||
play_audio(
|
play_audio(
|
||||||
&mut sound,
|
&mut sound,
|
||||||
volume,
|
volume,
|
||||||
|
@ -13,10 +13,15 @@ lazy_static! {
|
|||||||
register_int_counter!("upload_cmd", "Number of calls to /upload").unwrap();
|
register_int_counter!("upload_cmd", "Number of calls to /upload").unwrap();
|
||||||
pub static ref DELETE_COUNTER: IntCounter =
|
pub static ref DELETE_COUNTER: IntCounter =
|
||||||
register_int_counter!("delete_cmd", "Number of calls to /delete").unwrap();
|
register_int_counter!("delete_cmd", "Number of calls to /delete").unwrap();
|
||||||
|
pub static ref GREET_COUNTER: IntCounter =
|
||||||
|
register_int_counter!("greet_invoke", "Number of greet sounds played").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init_metrics() {
|
pub fn init_metrics() {
|
||||||
REGISTRY.register(Box::new(PLAY_COUNTER.clone())).unwrap();
|
REGISTRY.register(Box::new(PLAY_COUNTER.clone())).unwrap();
|
||||||
|
REGISTRY.register(Box::new(UPLOAD_COUNTER.clone())).unwrap();
|
||||||
|
REGISTRY.register(Box::new(DELETE_COUNTER.clone())).unwrap();
|
||||||
|
REGISTRY.register(Box::new(GREET_COUNTER.clone())).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn serve() {
|
pub async fn serve() {
|
||||||
|
Loading…
Reference in New Issue
Block a user