Skip to content

Commit

Permalink
Fix defaultErrorCode naming
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoffl01 committed Oct 1, 2024
1 parent 11d58d9 commit 767938c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions contrib/internal/httptrace/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func newConfig() config {
queryString: !internal.BoolEnv(envQueryStringDisabled, false),
queryStringRegexp: defaultQueryStringRegexp,
traceClientIP: internal.BoolEnv(envTraceClientIPEnabled, false),
isStatusError: defaultErrorCodes,
isStatusError: isServerError,
}
v := os.Getenv(envServerErrorStatuses)
if fn := GetErrorCodesFromInput(v); fn != nil {
Expand All @@ -62,7 +62,7 @@ func newConfig() config {
return c
}

func defaultErrorCodes(statusCode int) bool {
func isServerError(statusCode int) bool {
return statusCode >= 500 && statusCode < 600
}

Expand Down
4 changes: 2 additions & 2 deletions contrib/net/http/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func newRoundTripperConfig() *roundTripperConfig {
spanNamer: defaultSpanNamer,
ignoreRequest: func(_ *http.Request) bool { return false },
queryString: internal.BoolEnv(envClientQueryStringEnabled, true),
isStatusError: defaultErrorCodes,
isStatusError: isClientError,
}
v := os.Getenv(envClientErrorStatuses)
if fn := httptrace.GetErrorCodesFromInput(v); fn != nil {
Expand Down Expand Up @@ -283,6 +283,6 @@ func RTWithErrorCheck(fn func(err error) bool) RoundTripperOption {
}
}

func defaultErrorCodes(statusCode int) bool {
func isClientError(statusCode int) bool {
return statusCode >= 400 && statusCode < 500
}

0 comments on commit 767938c

Please sign in to comment.