Skip to content

Commit

Permalink
Merge pull request #94 from LUSHDigital/feat/remove-path-from-metrics
Browse files Browse the repository at this point in the history
Feat/remove path from metrics
  • Loading branch information
zeevallin authored Mar 20, 2020
2 parents a6a7ab8 + 48fa26d commit f6ad56b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion middleware/metricsmw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Using gorilla mux.

```go
r := mux.NewRouter()
r.Use(metrics.MeasureRequestsMiddleware)
r.Use(mux.MiddlewareFunc(metrics.MeasureRequestsMiddleware))
```

Using standard net/http library.
Expand Down
5 changes: 2 additions & 3 deletions middleware/metricsmw/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
Name: "http_request_duration_seconds",
Help: "Duration in seconds of each request",
},
[]string{"method", "code", "path"},
[]string{"method", "code"},
)

// ResponseSizeHistogram measures the size in bytes for responses.
Expand All @@ -26,7 +26,7 @@ var (
Name: "http_response_byte_size",
Help: "Size in bytes of each response",
},
[]string{"method", "code", "path"},
[]string{"method", "code"},
)

// All represents a combination of all HTTP metric collectors.
Expand Down Expand Up @@ -103,7 +103,6 @@ func MeasureRequests(next http.HandlerFunc) http.HandlerFunc {
labels := prometheus.Labels{
"method": r.Method,
"code": strconv.Itoa(rec.status),
"path": r.RequestURI,
}

if rsh, err := ResponseSizeHistogram.GetMetricWith(labels); err != nil {
Expand Down

0 comments on commit f6ad56b

Please sign in to comment.