Add dummy /metrics endpoint (#327)

This commit is contained in:
Thomas Miceli 2024-09-12 01:45:30 +02:00 committed by GitHub
parent df73b29fb1
commit 678fb9938c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View file

@ -57,7 +57,7 @@ func validateReservedKeywords(fl validator.FieldLevel) bool {
name := fl.Field().String()
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{}{}
}

View file

@ -23,3 +23,9 @@ func healthcheck(ctx echo.Context) error {
"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, "")
}

View file

@ -251,6 +251,7 @@ func NewServer(isDev bool, sessionsPath string) *Server {
g1.GET("/preview", preview, logged)
g1.GET("/healthcheck", healthcheck)
g1.GET("/metrics", metrics)
g1.GET("/register", register)
g1.POST("/register", processRegister)