From 668305034a5aab42f270b744757a0ecca4c308b1 Mon Sep 17 00:00:00 2001 From: Tony Afanasev Date: Thu, 27 Jul 2023 14:39:57 +0700 Subject: [PATCH] Remove http method from transaction name --- gin/sentrygin.go | 3 +-- gin/sentrygin_test.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/gin/sentrygin.go b/gin/sentrygin.go index 98803cf7c..984db2c94 100644 --- a/gin/sentrygin.go +++ b/gin/sentrygin.go @@ -2,7 +2,6 @@ package sentrygin import ( "context" - "fmt" "net" "net/http" "os" @@ -61,7 +60,7 @@ func (h *handler) handle(c *gin.Context) { } transaction := sentry.StartTransaction(ctx, - fmt.Sprintf("%s %s", c.Request.Method, c.Request.URL.Path), + c.Request.URL.Path, options..., ) defer func() { diff --git a/gin/sentrygin_test.go b/gin/sentrygin_test.go index 97d733214..ca34ed10d 100644 --- a/gin/sentrygin_test.go +++ b/gin/sentrygin_test.go @@ -31,7 +31,7 @@ func TestIntegration(t *testing.T) { WantTransaction *sentry.Event }{ { - Path: "/panic", + Path: "/panic/:id", Method: "GET", WantStatus: 200, Handler: func(c *gin.Context) { @@ -40,9 +40,9 @@ func TestIntegration(t *testing.T) { WantTransaction: &sentry.Event{ Level: sentry.LevelInfo, Type: "transaction", - Transaction: "GET /panic", + Transaction: "/panic/:id", Request: &sentry.Request{ - URL: "/panic", + URL: "/panic/:id", Method: "GET", Headers: map[string]string{ "Accept-Encoding": "gzip", @@ -55,7 +55,7 @@ func TestIntegration(t *testing.T) { Level: sentry.LevelFatal, Message: "test", Request: &sentry.Request{ - URL: "/panic", + URL: "/panic/:id", Method: "GET", Headers: map[string]string{ "Accept-Encoding": "gzip", @@ -81,7 +81,7 @@ func TestIntegration(t *testing.T) { WantTransaction: &sentry.Event{ Level: sentry.LevelInfo, Type: "transaction", - Transaction: "POST /post", + Transaction: "/post", Request: &sentry.Request{ URL: "/post", Method: "POST", @@ -121,7 +121,7 @@ func TestIntegration(t *testing.T) { WantTransaction: &sentry.Event{ Level: sentry.LevelInfo, Type: "transaction", - Transaction: "GET /get", + Transaction: "/get", Request: &sentry.Request{ URL: "/get", Method: "GET", @@ -161,7 +161,7 @@ func TestIntegration(t *testing.T) { WantTransaction: &sentry.Event{ Level: sentry.LevelInfo, Type: "transaction", - Transaction: "POST /post/large", + Transaction: "/post/large", Request: &sentry.Request{ URL: "/post/large", Method: "POST", @@ -201,7 +201,7 @@ func TestIntegration(t *testing.T) { WantTransaction: &sentry.Event{ Level: sentry.LevelInfo, Type: "transaction", - Transaction: "POST /post/body-ignored", + Transaction: "/post/body-ignored", Request: &sentry.Request{ URL: "/post/body-ignored", Method: "POST", @@ -241,7 +241,7 @@ func TestIntegration(t *testing.T) { WantTransaction: &sentry.Event{ Level: sentry.LevelInfo, Type: "transaction", - Transaction: "GET /badreq", + Transaction: "/badreq", Request: &sentry.Request{ URL: "/badreq", Method: "GET",