From cd3a363f53f8a68a09b8cdd3b0d0e02eb6d2cd6e Mon Sep 17 00:00:00 2001 From: Theo Butler Date: Wed, 13 Nov 2024 09:13:29 -0500 Subject: [PATCH] fix: include user_id in client fees aggregation --- src/bin/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index ce97f18..5f4064e 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -190,6 +190,7 @@ async fn handle_source_msg( if let Some(deployment) = data.indexer_queries.first().map(|i| &i.deployment) { let key = ClientFeesKey { gateway_id: data.gateway_id.clone(), + user_id: data.user_id.clone().unwrap_or_default(), api_key: data.api_key.clone(), deployment: deployment_cid(deployment), }; @@ -336,7 +337,7 @@ async fn record_aggregations( let query_count = (v.success_count + v.failure_count).max(1) as f64; ClientFeesProtobuf { gateway_id: k.gateway_id, - user_id: v.user_id, + user_id: k.user_id, api_key: k.api_key, deployment: k.deployment, fees_grt: v.fees_grt, @@ -466,13 +467,13 @@ struct Aggregations { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] struct ClientFeesKey { gateway_id: String, + user_id: String, api_key: String, deployment: String, } #[derive(Debug, Default)] struct ClientFeesValue { - user_id: String, fees_grt: f64, fees_usd: f64, success_count: u32,