Setup basic prom metrics endpoint (#624)
* Setup basic prom metrics endpoint * Use default prom handler to expose go runtime metrics
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/sosedoff/pgweb/pkg/command"
|
||||
"github.com/sosedoff/pgweb/pkg/metrics"
|
||||
)
|
||||
|
||||
func SetupMiddlewares(group *gin.RouterGroup) {
|
||||
@@ -53,3 +54,9 @@ func SetupRoutes(router *gin.Engine) {
|
||||
api.GET("/bookmarks", GetBookmarks)
|
||||
api.GET("/export", DataExport)
|
||||
}
|
||||
|
||||
func SetupMetrics(engine *gin.Engine) {
|
||||
if command.Opts.MetricsEnabled && command.Opts.MetricsAddr == "" {
|
||||
engine.GET("/metrics", gin.WrapH(metrics.Handler()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user