feat(metrics): Add status tag to shared_cache metrics
This allows us to create error ratios, error ratios are good and we
need more of them.
@@ -426,6 +426,7 @@ impl SharedCacheService {
counter("services.shared_cache.store") += 1,
"cache" => cache_name.as_ref(),
"write" => op.as_ref(),
+ "status" => "ok",
);
if let SharedCacheStoreResult::Written(bytes) = op {
let bytes: i64 = bytes.try_into().unwrap_or(i64::MAX);
@@ -441,6 +442,11 @@ impl SharedCacheService {
backend.name(),
LogError(&*err),
);
+ metric!(
+ counter("services.shared_cache.store") += 1,
+ "cache" => cache_name.as_ref(),
+ "status" => "error",
+ );
}
}
@@ -490,6 +496,7 @@ impl SharedCacheService {
counter("services.shared_cache.fetch") += 1,
"cache" => key.name.as_ref(),
"hit" => "true",
+ "status" => "ok",
);
let bytes: i64 = bytes.try_into().unwrap_or(i64::MAX);
metric!(
@@ -503,6 +510,7 @@ impl SharedCacheService {
counter("services.shared_cache.fetch") += 1,
"cache" => key.name.as_ref(),
"hit" => "false",
+ "status" => "ok",
);
false
}
@@ -512,6 +520,11 @@ impl SharedCacheService {
self.backend_name(),
LogError(&*err)
);
+ metric!(
+ counter("services.shared_cache.fetch") += 1,
+ "cache" => key.name.as_ref(),
+ "status" => "error",
+ );
false
}
}
