mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
move to /health and exclude metrics from logging.
This commit is contained in:
parent
e37f5c13ca
commit
8f83089c8e
@ -128,7 +128,7 @@ COPY --from=build /src/bin/neko /usr/bin/neko
|
||||
#
|
||||
# add healthcheck
|
||||
HEALTHCHECK --interval=10s --timeout=5s --retries=8 \
|
||||
CMD wget -O - http://localhost:${NEKO_SERVER_BIND#*:}/api/health || exit 1
|
||||
CMD wget -O - http://localhost:${NEKO_SERVER_BIND#*:}/health || exit 1
|
||||
|
||||
#
|
||||
# run neko
|
||||
|
@ -57,11 +57,6 @@ func (api *ApiManagerCtx) Route(r types.Router) {
|
||||
r.Route(path, router)
|
||||
}
|
||||
})
|
||||
|
||||
r.Get("/health", func(w http.ResponseWriter, r *http.Request) error {
|
||||
_, err := w.Write([]byte("true"))
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func (api *ApiManagerCtx) Authenticate(w http.ResponseWriter, r *http.Request) (context.Context, error) {
|
||||
|
@ -17,8 +17,8 @@ type logFormatter struct {
|
||||
}
|
||||
|
||||
func (l *logFormatter) NewLogEntry(r *http.Request) middleware.LogEntry {
|
||||
// exclude healthcheck from logs
|
||||
if r.RequestURI == "/api/health" {
|
||||
// exclude health & metrics from logs
|
||||
if r.RequestURI == "/health" || r.RequestURI == "/metrics" {
|
||||
return &nulllog{}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,11 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
|
||||
return config.AllowOrigin(r.Header.Get("Origin"))
|
||||
}))
|
||||
|
||||
router.Get("/health", func(w http.ResponseWriter, r *http.Request) error {
|
||||
_, err := w.Write([]byte("true"))
|
||||
return err
|
||||
})
|
||||
|
||||
router.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error {
|
||||
promhttp.Handler().ServeHTTP(w, r)
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user