baa middleware for collector api info for prometheus.
// init
b.Use(metrics.Metrics(metrics.Config{
MetricsPath: "/metrics",
Namespace: "trend",
}))
import "github.com/prometheus/client_golang/prometheus/promhttp"
// metrics
b.Get("/metrics", func(c *baa.Context) {
promhttp.Handler().ServeHTTP(c.Resp, c.Req)
})
the Namespace is the namespace of api metrics
the path of prometheus collect metrics, default "/metics"