From 8078fbccf33b256fc72d71d495e5211896eba7c9 Mon Sep 17 00:00:00 2001 From: Xiaoyang Tan Date: Thu, 18 Jun 2026 19:30:08 -0700 Subject: [PATCH] Disambiguate cache_hit metric counters Rename generic cache_hit counters to changed_targets_cache_hit and graph_cache_hit so they are distinguishable in dashboards when both are emitted under the same service scope. --- controller/getchangedtargets.go | 2 +- controller/gettargetgraph.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/getchangedtargets.go b/controller/getchangedtargets.go index 690569f..f131c97 100644 --- a/controller/getchangedtargets.go +++ b/controller/getchangedtargets.go @@ -129,7 +129,7 @@ func (c *controller) GetChangedTargets(request *pb.GetChangedTargetsRequest, str logger.Info("GetChangedTargets: Cache hit, streaming from storage", zap.Duration("cache_read_duration", cacheReadDuration), ) - scope.Counter("cache_hit").Inc(1) + scope.Counter("changed_targets_cache_hit").Inc(1) scope.Timer("cache_read_duration").Record(cacheReadDuration) if sendErr := sendTrimmedChangedTargets(stream, cached, maxDist, request.GetOutputConfig()); sendErr != nil { logger.Error("GetChangedTargets: Failed to send cached response", zap.Error(sendErr)) diff --git a/controller/gettargetgraph.go b/controller/gettargetgraph.go index 50045f0..03567b7 100644 --- a/controller/gettargetgraph.go +++ b/controller/gettargetgraph.go @@ -131,7 +131,7 @@ func (c *controller) getGraph(ctx context.Context, buildDescription *pb.BuildDes zap.Duration("total_duration", time.Since(start)), ) scope := c.scope.SubScope("get_graph") - scope.Counter("cache_hit").Inc(1) + scope.Counter("graph_cache_hit").Inc(1) scope.Timer("storage_duration").Record(time.Since(storageStart)) scope.Timer("total_duration").Record(time.Since(start)) return graphReader, nil