Skip to content

Commit

Permalink
Add endpoint to retriever error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
anbsky committed Jan 7, 2025
1 parent 161c172 commit 0e4bd64
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/query/processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,16 +651,24 @@ func preflightCacheHook(caller *Caller, ctx context.Context) (*jsonrpc.RPCRespon
var resp *jsonrpc.RPCResponse
var err error
for attempt := range retrieverRetries {
start := time.Now()
resp, err = caller.SendQuery(ctx, query)
duration := time.Since(start).Seconds()
switch {
case err == nil && resp.Error == nil:
return resp, err
case err != nil:
QueryCacheRetrievalFailures.WithLabelValues(CacheRetrievalErrorNet, query.Method()).Inc()
log.Infof("cache retriever %s attempt #%d failed, err=%+v", query.Method(), attempt, err)
log.Infof(
"cache retriever %s attempt #%d failed after %.3fs, err=%+v @ %s",
query.Method(), attempt, duration, err, caller.Endpoint(),
)
case resp.Error != nil:
QueryCacheRetrievalFailures.WithLabelValues(CacheRetrievalErrorSdk, query.Method()).Inc()
log.Infof("cache retriever %s attempt #%d failed, resp=%+v", query.Method(), attempt, resp.Error)
log.Infof(
"cache retriever %s attempt #%d failed after %.3fs, resp=%+v @ %s",
query.Method(), attempt, duration, resp.Error, caller.Endpoint(),
)
}
}
return resp, err
Expand Down

0 comments on commit 0e4bd64

Please sign in to comment.