From 476eb07a59528ada834033720b91d62287301fa2 Mon Sep 17 00:00:00 2001 From: Kyle Nusbaum Date: Fri, 7 Feb 2020 09:28:53 -0600 Subject: [PATCH] Revert "contrib/gin-gonic/gin: correct resource name" (#587) This reverts commit b12f0feaff5773fde59bc44a73951a3c69c3e85f. With this change, github.com/gin-gonic/gin@v1.2.0 is no longer supported. That is ok, but we want to cut a version without this fix. This fix will be restored, targeting v1.21.1. --- contrib/gin-gonic/gin/gintrace_test.go | 4 ++-- contrib/gin-gonic/gin/option.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/gin-gonic/gin/gintrace_test.go b/contrib/gin-gonic/gin/gintrace_test.go index e3239b21ba..38b104bb29 100644 --- a/contrib/gin-gonic/gin/gintrace_test.go +++ b/contrib/gin-gonic/gin/gintrace_test.go @@ -76,7 +76,7 @@ func TestTrace200(t *testing.T) { assert.Equal("http.request", span.OperationName()) assert.Equal(ext.SpanTypeWeb, span.Tag(ext.SpanType)) assert.Equal("foobar", span.Tag(ext.ServiceName)) - assert.Contains(span.Tag(ext.ResourceName), "GET /user/:id") + assert.Contains(span.Tag(ext.ResourceName), "gin.TestTrace200") assert.Equal("200", span.Tag(ext.HTTPCode)) assert.Equal("GET", span.Tag(ext.HTTPMethod)) // TODO(x) would be much nicer to have "/user/:id" here @@ -311,7 +311,7 @@ func TestResourceNamerSettings(t *testing.T) { router.GET("/test", func(c *gin.Context) { span, ok := tracer.SpanFromContext(c.Request.Context()) assert.True(ok) - assert.Equal(span.(mocktracer.Span).Tag(ext.ResourceName), "GET /test") + assert.Equal(span.(mocktracer.Span).Tag(ext.ResourceName), c.HandlerName()) }) r := httptest.NewRequest("GET", "/test", nil) diff --git a/contrib/gin-gonic/gin/option.go b/contrib/gin-gonic/gin/option.go index 853fcf5944..c9fc37c23e 100644 --- a/contrib/gin-gonic/gin/option.go +++ b/contrib/gin-gonic/gin/option.go @@ -59,5 +59,5 @@ func WithResourceNamer(namer func(c *gin.Context) string) Option { } func defaultResourceNamer(c *gin.Context) string { - return c.Request.Method + " " + c.FullPath() + return c.HandlerName() }