Skip to content

Commit

Permalink
Merge pull request #1 from Jim-Lambert-Bose/allow-router-override
Browse files Browse the repository at this point in the history
allow consumers to set a router to serve metrics on
  • Loading branch information
Jim Lambert authored May 4, 2018
2 parents e0b707b + fe4536e commit a28f6b0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ func (p *Prometheus) SetListenAddress(address string) {
}
}

// SetListenAddressWithRouter for using a separate router to expose metrics. (this keeps things like GET /metrics out of
// your content's access log).
func (p *Prometheus) SetListenAddressWithRouter(listenAddress string, r *gin.Engine) {
p.listenAddress = listenAddress
if len(p.listenAddress) > 0 {
p.router = r
}
}

func (p *Prometheus) setMetricsPath(e *gin.Engine) {

if p.listenAddress != "" {
Expand Down

0 comments on commit a28f6b0

Please sign in to comment.