Skip to content

Commit 267f60f

Browse files
authored
chore: minor symbolizer metrics improvements (#4597)
1 parent 2305b52 commit 267f60f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pkg/symbolizer/debuginfod_client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ func (c *DebuginfodHTTPClient) FetchDebuginfo(ctx context.Context, buildID strin
119119

120120
if found, _ := c.notFoundCache.Get(sanitizedBuildID); found {
121121
status = statusErrorNotFound
122+
c.metrics.cacheOperations.WithLabelValues("not_found", "get", statusSuccess).Inc()
122123
return nil, buildIDNotFoundError{buildID: sanitizedBuildID}
123124
}
125+
c.metrics.cacheOperations.WithLabelValues("not_found", "get", "miss").Inc()
124126

125127
v, err, _ := c.group.Do(sanitizedBuildID, func() (interface{}, error) {
126128
return c.fetchDebugInfoWithRetries(ctx, sanitizedBuildID)
@@ -214,6 +216,7 @@ func (c *DebuginfodHTTPClient) fetchDebugInfoWithRetries(ctx context.Context, sa
214216
// Don't retry on 404 errors
215217
if statusCode, isHTTPErr := isHTTPStatusError(err); isHTTPErr && statusCode == http.StatusNotFound {
216218
c.notFoundCache.SetWithTTL(sanitizedBuildID, true, 1, c.cfg.NotFoundCacheTTL)
219+
c.notFoundCache.Wait()
217220
c.metrics.cacheOperations.WithLabelValues("not_found", "set", statusSuccess).Inc()
218221
c.metrics.cacheSizeBytes.WithLabelValues("not_found").Set(float64(c.notFoundCache.Metrics.CostAdded()))
219222
return nil, buildIDNotFoundError{buildID: sanitizedBuildID}

pkg/symbolizer/symbolizer.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,12 @@ func (s *Symbolizer) symbolizeWithTable(table *lidia.Table, req *request) {
384384

385385
func (s *Symbolizer) getLidiaBytes(ctx context.Context, buildID string) ([]byte, error) {
386386
if client, ok := s.client.(*DebuginfodHTTPClient); ok {
387-
if found, _ := client.notFoundCache.Get(buildID); found {
388-
s.metrics.cacheOperations.WithLabelValues("not_found", "get", statusSuccess).Inc()
389-
return nil, buildIDNotFoundError{buildID: buildID}
387+
if sanitizedBuildID, err := sanitizeBuildID(buildID); err == nil {
388+
if found, _ := client.notFoundCache.Get(sanitizedBuildID); found {
389+
s.metrics.cacheOperations.WithLabelValues("not_found", "get", statusSuccess).Inc()
390+
return nil, buildIDNotFoundError{buildID: buildID}
391+
}
390392
}
391-
s.metrics.cacheOperations.WithLabelValues("not_found", "get", "miss").Inc()
392393
}
393394

394395
lidiaBytes, err := s.fetchLidiaFromObjectStore(ctx, buildID)

0 commit comments

Comments
 (0)