Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
feat: add separate metrics category for 410: Gone
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Aug 21, 2023
1 parent 5963abf commit 7514a4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions metrics/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ func (m *Metrics) getMatchingErrorMetric(ctx context.Context, msg string) (instr
{"graphsync request failed to complete: request failed - unknown reason", m.retrievalErrorGraphsyncCount},
{"failed to dial", m.retrievalErrorFailedToDialCount},
{"HTTP request failed, remote response code: 404", m.retrievalErrorHTTPRemoteRequestNotFound},
{"HTTP request failed, remote response code: 410", m.retrievalErrorHTTPRemoteRequestGone},
{"HTTP request failed, remote response code:", m.retrievalErrorHTTPRemoteRequestFailed},
{"extraneous block in CAR", m.retrievalErrorHTTPExtraneousBlock},
{"unexpected block in CAR", m.retrievalErrorHTTPUnexpectedBlock},
Expand Down
6 changes: 6 additions & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ func (m *Metrics) Start() error {
); err != nil {
return err
}
if m.retrievalErrorHTTPRemoteRequestGone, err = meter.Int64Counter(meterName+"/retrieval_error_http_remote_request_gone_total",
instrument.WithDescription("The number of retrieval errors because an HTTP remote peer returned status 410 gone"),
); err != nil {
return err
}
if m.retrievalErrorHTTPRemoteRequestFailed, err = meter.Int64Counter(meterName+"/retrieval_error_http_remote_request_failed_total",
instrument.WithDescription("The number of retrieval errors because an HTTP remote peer returned a failed status other than 404"),
); err != nil {
Expand Down Expand Up @@ -401,6 +406,7 @@ type stats struct {
retrievalErrorGraphsyncCount instrument.Int64Counter
retrievalErrorFailedToDialCount instrument.Int64Counter
retrievalErrorHTTPRemoteRequestNotFound instrument.Int64Counter
retrievalErrorHTTPRemoteRequestGone instrument.Int64Counter
retrievalErrorHTTPRemoteRequestFailed instrument.Int64Counter
retrievalErrorHTTPExtraneousBlock instrument.Int64Counter
retrievalErrorHTTPUnexpectedBlock instrument.Int64Counter
Expand Down

0 comments on commit 7514a4e

Please sign in to comment.