Skip to content

Commit

Permalink
Add dummy /metrics endpoint (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomiceli authored Sep 11, 2024
1 parent df73b29 commit 678fb99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/utils/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{}
}

Expand Down
6 changes: 6 additions & 0 deletions internal/web/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")
}
1 change: 1 addition & 0 deletions internal/web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 678fb99

Please sign in to comment.