mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-08 21:48:11 -05:00
Co-authored-by: georgehao <georgehao@users.noreply.github.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
19 lines
488 B
Go
19 lines
488 B
Go
package observability
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
"scroll-tech/common/observability/ginmetrics"
|
|
)
|
|
|
|
// Use register the gin metric
|
|
func Use(router *gin.Engine, metricsPrefix string, reg prometheus.Registerer) {
|
|
m := ginmetrics.GetMonitor(reg)
|
|
m.SetMetricPath("/metrics")
|
|
m.SetMetricPrefix(metricsPrefix + "_")
|
|
m.SetSlowTime(1)
|
|
m.SetDuration([]float64{0.025, .05, .1, .5, 1, 5, 10})
|
|
m.UseWithoutExposingEndpoint(router)
|
|
}
|