From 8678c8559e11c008ef371ff48f104730630763ab Mon Sep 17 00:00:00 2001 From: Jan Michael Auer Date: Mon, 22 Jun 2026 16:29:11 +0200 Subject: [PATCH 1/2] ref(cogs): Use usecase directly as app_feature --- objectstore-service/src/backend/counting.rs | 22 +++------------------ 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/objectstore-service/src/backend/counting.rs b/objectstore-service/src/backend/counting.rs index 742c517e..cedcd4fc 100644 --- a/objectstore-service/src/backend/counting.rs +++ b/objectstore-service/src/backend/counting.rs @@ -30,28 +30,12 @@ use crate::multipart::{ }; use crate::stream::ClientStream; -/// Converts an objectstore `usecase` into the `app_feature` value used by our COGS pipelines. -fn usecase_to_appfeature(usecase: &str) -> &'static str { - // TODO: Flesh out this mapping - match usecase { - "attachments" => "attachments", - "preprod" => "preprod", - _ => { - objectstore_log::warn!(?usecase, "COGS: Can't convert usecase to app_feature"); - "shared" - } - } -} - /// Increments `cogs.usage` by one operation for the given `usecase`. /// -/// Under the hood, `usecase` is converted to the appropriate `app_feature` value expected in our -/// COGS pipeline. +/// Under the hood, the `usecase` is used as the `app_feature`. This allows to identify distinct +/// products and map them in the for the COGs pipeline. fn count(usecase: &str) { - objectstore_metrics::count!( - "cogs.usage" += 1, - app_feature = usecase_to_appfeature(usecase), - ); + objectstore_metrics::count!("cogs.usage" += 1, app_feature = usecase.to_owned()); } /// A [`Backend`] decorator that counts each operation performed for COGS. Also implements From c165adf4df9554260c98391d1461528aabb2d57f Mon Sep 17 00:00:00 2001 From: Jan Michael Auer Date: Mon, 22 Jun 2026 17:11:48 +0200 Subject: [PATCH 2/2] fix(cogs): Update test to match new app_feature behavior --- objectstore-service/src/backend/counting.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objectstore-service/src/backend/counting.rs b/objectstore-service/src/backend/counting.rs index cedcd4fc..4e597e0f 100644 --- a/objectstore-service/src/backend/counting.rs +++ b/objectstore-service/src/backend/counting.rs @@ -266,11 +266,11 @@ mod tests { } #[test] - fn unmapped_usecase_falls_back_to_shared() { + fn new_usecase_is_app_feature() { let captured = capture(async { let backend = CountingBackend::new(Box::new(InMemoryBackend::new("in-memory"))); backend - .get_object(&object_id("unmapped"), None) + .get_object(&object_id("new_usecase"), None) .await .unwrap(); }); @@ -278,7 +278,7 @@ mod tests { assert!( captured .iter() - .any(|m| m == "cogs.usage:+1|c|#app_feature:shared"), + .any(|m| m == "cogs.usage:+1|c|#app_feature:new_usecase"), "captured: {captured:?}" ); }