Skip to content

Commit

Permalink
Fix new relic transaction names.
Browse files Browse the repository at this point in the history
  • Loading branch information
cscatolini committed May 19, 2017
1 parent 7a25da2 commit 06c72a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/newrelic_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"fmt"
"net/http"

"github.com/gorilla/mux"
newrelic "github.com/newrelic/go-agent"
)

Expand All @@ -32,7 +33,8 @@ func (m *NewRelicMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()

if m.App.NewRelic != nil {
txn := m.App.NewRelic.StartTransaction(fmt.Sprintf("%s %s", r.Method, r.URL.Path), w, r)
route, _ := mux.CurrentRoute(r).GetPathTemplate()
txn := m.App.NewRelic.StartTransaction(fmt.Sprintf("%s %s", r.Method, route), w, r)
defer txn.End()
ctx = newContextWithNewRelicTransaction(r.Context(), txn, r)

Expand Down

0 comments on commit 06c72a6

Please sign in to comment.