From 0600ae00fff55749db1ae321dd3c180042846433 Mon Sep 17 00:00:00 2001 From: alyssa Date: Thu, 21 Nov 2024 10:40:33 +0900 Subject: [PATCH] fix(gateway): remove shard_id from pluralkit_gateway_events metric --- services/gateway/src/discord/gateway.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/gateway/src/discord/gateway.rs b/services/gateway/src/discord/gateway.rs index 40ed9bf7..a50fda8e 100644 --- a/services/gateway/src/discord/gateway.rs +++ b/services/gateway/src/discord/gateway.rs @@ -86,12 +86,18 @@ pub async fn runner( while let Some(item) = shard.next_event(EventTypeFlags::all()).await { match item { Ok(event) => { + // event_type * shard_id is too many labels and prometheus fails to query it + // so we split it into two metrics counter!( - "pluralkit_gateway_events", - "shard_id" => shard.id().number().to_string(), + "pluralkit_gateway_events_type", "event_type" => serde_variant::to_variant_name(&event.kind()).unwrap(), ) .increment(1); + counter!( + "pluralkit_gateway_events_shard", + "shard_id" => shard.id().number().to_string(), + ) + .increment(1); if let Err(error) = shard_state .handle_event(shard.id().number(), event.clone()) .await