chore(prometheus): move prometheus to a new file

This commit is contained in:
Siyuan Miao
2025-03-07 20:01:14 +01:00
parent 5c7accae0d
commit 8b59a3e387
3 changed files with 19 additions and 5 deletions

5
web.go
View File

@@ -12,10 +12,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/version"
"golang.org/x/crypto/bcrypt"
)
@@ -90,8 +87,6 @@ func setupRouter() *gin.Engine {
r.POST("/device/setup", handleSetup)
// A Prometheus metrics endpoint.
version.Version = builtAppVersion
prometheus.MustRegister(versioncollector.NewCollector("jetkvm"))
r.GET("/metrics", gin.WrapH(promhttp.Handler()))
// Protected routes (allows both password and noPassword modes)