mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 20:42:40 +00:00
Add dummy /metrics endpoint (#327)
This commit is contained in:
parent
df73b29fb1
commit
678fb9938c
3 changed files with 8 additions and 1 deletions
|
@ -57,7 +57,7 @@ func validateReservedKeywords(fl validator.FieldLevel) bool {
|
||||||
name := fl.Field().String()
|
name := fl.Field().String()
|
||||||
|
|
||||||
restrictedNames := map[string]struct{}{}
|
restrictedNames := map[string]struct{}{}
|
||||||
for _, restrictedName := range []string{"assets", "register", "login", "logout", "settings", "admin-panel", "all", "search", "init", "healthcheck", "preview"} {
|
for _, restrictedName := range []string{"assets", "register", "login", "logout", "settings", "admin-panel", "all", "search", "init", "healthcheck", "preview", "metrics"} {
|
||||||
restrictedNames[restrictedName] = struct{}{}
|
restrictedNames[restrictedName] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,3 +23,9 @@ func healthcheck(ctx echo.Context) error {
|
||||||
"time": time.Now().Format(time.RFC3339),
|
"time": time.Now().Format(time.RFC3339),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// metrics is a dummy handler to satisfy the /metrics endpoint (for Prometheus, Openmetrics, etc.)
|
||||||
|
// until we have a proper metrics endpoint
|
||||||
|
func metrics(ctx echo.Context) error {
|
||||||
|
return ctx.String(200, "")
|
||||||
|
}
|
||||||
|
|
|
@ -251,6 +251,7 @@ func NewServer(isDev bool, sessionsPath string) *Server {
|
||||||
g1.GET("/preview", preview, logged)
|
g1.GET("/preview", preview, logged)
|
||||||
|
|
||||||
g1.GET("/healthcheck", healthcheck)
|
g1.GET("/healthcheck", healthcheck)
|
||||||
|
g1.GET("/metrics", metrics)
|
||||||
|
|
||||||
g1.GET("/register", register)
|
g1.GET("/register", register)
|
||||||
g1.POST("/register", processRegister)
|
g1.POST("/register", processRegister)
|
||||||
|
|
Loading…
Reference in a new issue