add http checks to idp & graph

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2024-10-15 13:47:39 +02:00
parent c11b18c833
commit 80d619cb8f
2 changed files with 13 additions and 5 deletions

View File

@@ -14,7 +14,8 @@ func Server(opts ...Option) (*http.Server, error) {
checkHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger),
WithLogger(options.Logger).
WithCheck("web reachability", handlers.NewHTTPCheck(options.Config.HTTP.Addr)),
)
return debug.NewService(

View File

@@ -14,7 +14,13 @@ import (
func Server(opts ...Option) (*http.Server, error) {
options := newOptions(opts...)
checkHandler := handlers.NewCheckHandler(
healthHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("http reachability", handlers.NewHTTPCheck(options.Config.HTTP.Addr)),
)
readinessHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("tcp-check", func(ctx context.Context) error {
@@ -28,7 +34,8 @@ func Server(opts ...Option) (*http.Server, error) {
}
return handlers.NewTCPCheck(tcpURL)(ctx)
}),
}).
WithInheritedChecksFrom(healthHandler.Conf),
)
return debug.NewService(
@@ -39,7 +46,7 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Health(healthHandler),
debug.Ready(readinessHandler),
), nil
}