File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
11
11
12
12
// Config responsible to configure middleware
13
13
type Config struct {
14
+ Skipper echo.Skipper
14
15
Namespace string
15
16
Buckets []float64
16
17
Subsystem string
@@ -25,6 +26,9 @@ const (
25
26
26
27
// DefaultConfig has the default instrumentation config
27
28
var DefaultConfig = Config {
29
+ Skipper : func (c echo.Context ) bool {
30
+ return c .Request ().URL ().Path () == `/metrics`
31
+ },
28
32
Namespace : "echo" ,
29
33
Subsystem : "http" ,
30
34
Buckets : []float64 {
@@ -94,8 +98,16 @@ func MetricsMiddlewareWithConfig(config Config) echo.MiddlewareFuncd {
94
98
Buckets : config .Buckets ,
95
99
}, []string {"method" , "handler" })
96
100
101
+ skipper := config .Skipper
102
+ if skipper == nil {
103
+ skipper = echo .DefaultSkipper
104
+ }
105
+
97
106
return func (next echo.Handler ) echo.HandlerFunc {
98
107
return func (c echo.Context ) error {
108
+ if skipper (c ) {
109
+ return next .Handle (c )
110
+ }
99
111
req := c .Request ()
100
112
path := c .Path ()
101
113
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ scrape_configs:
25
25
# honor_labels: true
26
26
# static_configs:
27
27
# - targets: ["pushgateway:9091"]
28
+ # basic_auth:
29
+ # username: username
30
+ # password: your-password
28
31
29
32
- job_name : " webx"
30
33
scrape_interval : 5s
You can’t perform that action at this time.
0 commit comments