From 21235e994938fc7c2cad7e0116ba5a304b26b960 Mon Sep 17 00:00:00 2001 From: Flc Date: Tue, 26 Nov 2024 08:52:01 +0800 Subject: [PATCH] feat(otelecho): Adjust the default span name --- CHANGELOG.md | 2 +- .../github.com/labstack/echo/otelecho/test/echo_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cbe3acb9f7..9f6c8903d05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Added support for providing `endpoint`, `pollingIntervalMs` and `initialSamplingRate` using environment variable `OTEL_TRACES_SAMPLER_ARG` in `go.opentelemetry.io/contrib/samples/jaegerremote`. (#6310) - Added support exporting logs via OTLP over gRPC in `go.opentelemetry.io/contrib/config`. (#6340) -- Added support custom span name in `go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho`. (#6365) +- Added support custom span name and refactored the default span name in `go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho`. (#6365) ### Fixed diff --git a/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go b/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go index 80bf466c63b..116f556708a 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go +++ b/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go @@ -84,7 +84,7 @@ func TestTrace200(t *testing.T) { spans := sr.Ended() require.Len(t, spans, 1) span := spans[0] - assert.Equal(t, "/user/:id", span.Name()) + assert.Equal(t, "GET /user/:id", span.Name()) assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) attrs := span.Attributes() assert.Contains(t, attrs, attribute.String("net.host.name", "foobar")) @@ -116,7 +116,7 @@ func TestError(t *testing.T) { spans := sr.Ended() require.Len(t, spans, 1) span := spans[0] - assert.Equal(t, "/server_err", span.Name()) + assert.Equal(t, "GET /server_err", span.Name()) attrs := span.Attributes() assert.Contains(t, attrs, attribute.String("net.host.name", "foobar")) assert.Contains(t, attrs, attribute.Int("http.status_code", http.StatusInternalServerError)) @@ -175,7 +175,7 @@ func TestStatusError(t *testing.T) { spans := sr.Ended() require.Len(t, spans, 1) span := spans[0] - assert.Equal(t, "/err", span.Name()) + assert.Equal(t, "GET /err", span.Name()) assert.Equal(t, tc.spanCode, span.Status().Code) attrs := span.Attributes()