Skip to content

Commit

Permalink
Remove http method from transaction name
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Afanasev committed Jul 27, 2023
1 parent b551438 commit 6683050
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions gin/sentrygin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sentrygin

import (
"context"
"fmt"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -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() {
Expand Down
18 changes: 9 additions & 9 deletions gin/sentrygin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 6683050

Please sign in to comment.