@@ -118,7 +118,6 @@ func (c *DebuginfodHTTPClient) FetchDebuginfo(ctx context.Context, buildID strin
118118 }
119119
120120 if found , _ := c .notFoundCache .Get (sanitizedBuildID ); found {
121- c .metrics .cacheOperations .WithLabelValues ("not_found" , "get" , statusSuccess ).Inc ()
122121 status = statusErrorNotFound
123122 return nil , buildIDNotFoundError {buildID : sanitizedBuildID }
124123 }
@@ -128,7 +127,10 @@ func (c *DebuginfodHTTPClient) FetchDebuginfo(ctx context.Context, buildID strin
128127 })
129128
130129 if err != nil {
130+ var bnfErr buildIDNotFoundError
131131 switch {
132+ case errors .As (err , & bnfErr ):
133+ status = statusErrorNotFound
132134 case errors .Is (err , context .Canceled ):
133135 status = statusErrorCanceled
134136 case errors .Is (err , context .DeadlineExceeded ):
@@ -212,6 +214,7 @@ func (c *DebuginfodHTTPClient) fetchDebugInfoWithRetries(ctx context.Context, sa
212214 // Don't retry on 404 errors
213215 if statusCode , isHTTPErr := isHTTPStatusError (err ); isHTTPErr && statusCode == http .StatusNotFound {
214216 c .notFoundCache .SetWithTTL (sanitizedBuildID , true , 1 , c .cfg .NotFoundCacheTTL )
217+ c .metrics .cacheOperations .WithLabelValues ("not_found" , "set" , statusSuccess ).Inc ()
215218 c .metrics .cacheSizeBytes .WithLabelValues ("not_found" ).Set (float64 (c .notFoundCache .Metrics .CostAdded ()))
216219 return nil , buildIDNotFoundError {buildID : sanitizedBuildID }
217220 }
@@ -264,7 +267,8 @@ func isRetryableError(err error) bool {
264267 return false
265268 }
266269
267- if _ , ok := err .(buildIDNotFoundError ); ok {
270+ var bnfErr buildIDNotFoundError
271+ if errors .As (err , & bnfErr ) {
268272 return false
269273 }
270274
0 commit comments