Skip to content

Commit

Permalink
fix(contrib/go-chi): remove checks for ext.Error, stop setting isServ…
Browse files Browse the repository at this point in the history
…erError
  • Loading branch information
hannahkm committed Nov 26, 2024
1 parent f07a859 commit 92f5e33
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 16 deletions.
3 changes: 0 additions & 3 deletions contrib/go-chi/chi.v5/chi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,6 @@ func TestError(t *testing.T) {
spans := mt.FinishedSpans()
assert.Len(spans, 1)
span := spans[0]
if span.Tag(ext.Error) == nil {
t.Fatal("Span missing error tags")
}
assertSpan(assert, *span, code)
wantErr := fmt.Sprintf("%d: %s", code, http.StatusText(code))
assert.Equal(wantErr, span.Tag(ext.ErrorMsg))
Expand Down
5 changes: 0 additions & 5 deletions contrib/go-chi/chi.v5/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func defaults(cfg *config) {
cfg.serviceName = instr.ServiceName(instrumentation.ComponentServer, nil)
cfg.analyticsRate = instr.AnalyticsRate(true)
cfg.headerTags = instr.HTTPHeadersAsTags()
cfg.isStatusError = isServerError
cfg.ignoreRequest = func(_ *http.Request) bool { return false }
cfg.modifyResourceName = func(s string) string { return s }
// for backward compatibility with modifyResourceName, initialize resourceName as nil.
Expand Down Expand Up @@ -97,10 +96,6 @@ func WithStatusCheck(fn func(statusCode int) bool) OptionFn {
}
}

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

// WithIgnoreRequest specifies a function to use for determining if the
// incoming HTTP request tracing should be skipped.
func WithIgnoreRequest(fn func(r *http.Request) bool) OptionFn {
Expand Down
3 changes: 0 additions & 3 deletions contrib/go-chi/chi/chi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ func TestError(t *testing.T) {
spans := mt.FinishedSpans()
assert.Len(spans, 1)
span := spans[0]
if span.Tag(ext.Error) == nil {
t.Fatal("Span missing error tags")
}
assertSpan(assert, *span, code)
wantErr := fmt.Sprintf("%d: %s", code, http.StatusText(code))
assert.Equal(wantErr, span.Tag(ext.ErrorMsg))
Expand Down
5 changes: 0 additions & 5 deletions contrib/go-chi/chi/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func defaults(cfg *config) {
cfg.serviceName = instr.ServiceName(instrumentation.ComponentServer, nil)
cfg.analyticsRate = instr.AnalyticsRate(true)
cfg.headerTags = instr.HTTPHeadersAsTags()
cfg.isStatusError = isServerError
cfg.ignoreRequest = func(_ *http.Request) bool { return false }
cfg.resourceNamer = func(r *http.Request) string {
resourceName := chi.RouteContext(r.Context()).RoutePattern()
Expand Down Expand Up @@ -99,10 +98,6 @@ func WithStatusCheck(fn func(statusCode int) bool) OptionFn {
}
}

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

// WithHeaderTags enables the integration to attach HTTP request headers as span tags.
// Warning:
// Using this feature can risk exposing sensitive data such as authorization tokens to Datadog.
Expand Down

0 comments on commit 92f5e33

Please sign in to comment.