monitor.go 499 B

1234567891011121314151617181920212223
  1. package router
  2. import (
  3. "net/http"
  4. "github.com/gin-gonic/gin"
  5. "github.com/go-admin-team/go-admin-core/tools/transfer"
  6. "github.com/prometheus/client_golang/prometheus/promhttp"
  7. )
  8. func init() {
  9. routerNoCheckRole = append(routerNoCheckRole, registerMonitorRouter)
  10. }
  11. // 需认证的路由代码
  12. func registerMonitorRouter(v1 *gin.RouterGroup) {
  13. v1.GET("/metrics", transfer.Handler(promhttp.Handler()))
  14. //健康检查
  15. v1.GET("/health", func(c *gin.Context) {
  16. c.Status(http.StatusOK)
  17. })
  18. }