Skip to content

Commit df60b58

Browse files
suzuki-safieclaude
andcommitted
Remove Echo-specific references from extractor files
Keep extrator.go and extrator_test.go free of Echo-specific mentions so they can be copied for use outside of Echo. The Echo-specific scenarios remain covered in otel_test.go. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent b68c918 commit df60b58

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

extrator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ func SpanNameFormatter(v Values) string {
561561
}
562562

563563
// SpanStatus returns the span status code and error description for a server span, based on the
564-
// resolved HTTP status code (see [echo.ResolveResponseStatus]) and the error returned from the handler.
564+
// resolved HTTP response status code and the error that occurred while handling the request.
565565
//
566566
// Spec:
567567
//
@@ -587,8 +587,8 @@ func SpanStatus(code int, err error) (codes.Code, string) {
587587
}
588588
if code >= 400 {
589589
// this instrumentation creates server spans, and for those the convention is to leave
590-
// the status unset on 4xx responses, even when the handler returned an error that
591-
// resolves to 4xx (e.g. echo.NewHTTPError(400)).
590+
// the status unset on 4xx responses, even when the error is what the status code was
591+
// resolved from.
592592
return codes.Unset, ""
593593
}
594594
if err != nil { // an error alongside a 1xx-3xx status indicates another error occurred

extrator_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"net/http"
77
"testing"
88

9-
"github.com/labstack/echo/v5"
109
"github.com/stretchr/testify/assert"
1110
"go.opentelemetry.io/otel/attribute"
1211
"go.opentelemetry.io/otel/codes"
@@ -752,9 +751,9 @@ func TestSpanStatus(t *testing.T) {
752751
expectDesc: "",
753752
},
754753
{
755-
name: "client error 400 with handler error is left unset for server span",
754+
name: "client error 400 with error is left unset for server span",
756755
whenStatus: 400,
757-
whenError: echo.NewHTTPError(http.StatusBadRequest, "invalid request"),
756+
whenError: errors.New("invalid request"),
758757
expectCode: codes.Unset,
759758
expectDesc: "",
760759
},

0 commit comments

Comments
 (0)