Skip to content

Commit

Permalink
allow consumers to set a router to serve metrics on
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Lambert committed May 4, 2018
1 parent e0b707b commit fe4536e
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 fe4536e

Please sign in to comment.