Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/symbolizer/debuginfod_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func (c *DebuginfodHTTPClient) FetchDebuginfo(ctx context.Context, buildID strin
}

if found, _ := c.notFoundCache.Get(sanitizedBuildID); found {
c.metrics.cacheOperations.WithLabelValues("not_found", "get", statusSuccess).Inc()
status = statusErrorNotFound
return nil, buildIDNotFoundError{buildID: sanitizedBuildID}
}
Expand All @@ -128,7 +127,10 @@ func (c *DebuginfodHTTPClient) FetchDebuginfo(ctx context.Context, buildID strin
})

if err != nil {
var bnfErr buildIDNotFoundError
switch {
case errors.As(err, &bnfErr):
status = statusErrorNotFound
case errors.Is(err, context.Canceled):
status = statusErrorCanceled
case errors.Is(err, context.DeadlineExceeded):
Expand Down Expand Up @@ -212,6 +214,7 @@ func (c *DebuginfodHTTPClient) fetchDebugInfoWithRetries(ctx context.Context, sa
// Don't retry on 404 errors
if statusCode, isHTTPErr := isHTTPStatusError(err); isHTTPErr && statusCode == http.StatusNotFound {
c.notFoundCache.SetWithTTL(sanitizedBuildID, true, 1, c.cfg.NotFoundCacheTTL)
c.metrics.cacheOperations.WithLabelValues("not_found", "set", statusSuccess).Inc()
c.metrics.cacheSizeBytes.WithLabelValues("not_found").Set(float64(c.notFoundCache.Metrics.CostAdded()))
return nil, buildIDNotFoundError{buildID: sanitizedBuildID}
}
Expand Down Expand Up @@ -264,7 +267,8 @@ func isRetryableError(err error) bool {
return false
}

if _, ok := err.(buildIDNotFoundError); ok {
var bnfErr buildIDNotFoundError
if errors.As(err, &bnfErr) {
return false
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/symbolizer/symbolizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,18 @@ func (s *Symbolizer) symbolizeWithTable(table *lidia.Table, req *request) {
func (s *Symbolizer) getLidiaBytes(ctx context.Context, buildID string) ([]byte, error) {
if client, ok := s.client.(*DebuginfodHTTPClient); ok {
if found, _ := client.notFoundCache.Get(buildID); found {
s.metrics.cacheOperations.WithLabelValues("not_found", "get", statusSuccess).Inc()
return nil, buildIDNotFoundError{buildID: buildID}
}
s.metrics.cacheOperations.WithLabelValues("not_found", "get", "miss").Inc()
}

lidiaBytes, err := s.fetchLidiaFromObjectStore(ctx, buildID)
if err == nil {
s.metrics.cacheOperations.WithLabelValues("object_storage", "get", statusSuccess).Inc()
return lidiaBytes, nil
}
s.metrics.cacheOperations.WithLabelValues("object_storage", "get", "miss").Inc()

lidiaBytes, err = s.fetchLidiaFromDebuginfod(ctx, buildID)
if err != nil {
Expand All @@ -318,6 +322,9 @@ func (s *Symbolizer) getLidiaBytes(ctx context.Context, buildID string) ([]byte,

if err := s.bucket.Upload(ctx, buildID, bytes.NewReader(lidiaBytes)); err != nil {
level.Warn(s.logger).Log("msg", "Failed to store debug info in objstore", "buildID", buildID, "err", err)
s.metrics.cacheOperations.WithLabelValues("object_storage", "set", "error").Inc()
} else {
s.metrics.cacheOperations.WithLabelValues("object_storage", "set", statusSuccess).Inc()
}

return lidiaBytes, nil
Expand Down