Skip to content

Commit

Permalink
the server probs added to the several services
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Oct 16, 2024
1 parent 4f8d0bb commit d4fe58d
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 8 deletions.
9 changes: 8 additions & 1 deletion services/audit/pkg/server/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ func Server(opts ...Option) (*http.Server, error) {
WithLogger(options.Logger),
)

readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)).
WithInheritedChecksFrom(checkHandler.Conf),
)

return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
Expand All @@ -26,6 +33,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}
9 changes: 8 additions & 1 deletion services/clientlog/pkg/server/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ func Server(opts ...Option) (*http.Server, error) {
WithLogger(options.Logger),
)

readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)).
WithInheritedChecksFrom(checkHandler.Conf),
)

return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
Expand All @@ -26,6 +33,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}
12 changes: 10 additions & 2 deletions services/eventhistory/pkg/server/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ func Server(opts ...Option) (*http.Server, error) {

checkHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger),
WithLogger(options.Logger).
WithCheck("grpc reachability", handlers.NewGRPCCheck(options.Config.GRPC.Addr)),
)

readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)).
WithInheritedChecksFrom(checkHandler.Conf),
)

return debug.NewService(
Expand All @@ -26,6 +34,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}
11 changes: 10 additions & 1 deletion services/notifications/pkg/server/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package debug

import (
"net/http"
"strconv"

"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
Expand All @@ -17,6 +18,14 @@ func Server(opts ...Option) (*http.Server, error) {
WithLogger(options.Logger),
)

readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Notifications.Events.Cluster)).
WithCheck("smtp-check", handlers.NewTCPCheck(options.Config.Notifications.SMTP.Host+":"+strconv.Itoa(options.Config.Notifications.SMTP.Port))).
WithInheritedChecksFrom(checkHandler.Conf),
)

return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
Expand All @@ -26,6 +35,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}
16 changes: 15 additions & 1 deletion services/search/pkg/server/debug/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package debug

import (
"context"
"net/http"

"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
Expand All @@ -18,6 +19,19 @@ func Server(opts ...Option) (*http.Server, error) {
WithCheck("grpc reachability", handlers.NewGRPCCheck(options.Config.GRPC.Addr)),
)

readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)).
WithCheck("tika-check", func(ctx context.Context) error {
if options.Config.Extractor.Type == "tika" {
return handlers.NewTCPCheck(options.Config.Extractor.Tika.TikaURL)(ctx)
}
return nil
}).
WithInheritedChecksFrom(checkHandler.Conf),
)

return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
Expand All @@ -27,6 +41,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}
9 changes: 8 additions & 1 deletion services/sse/pkg/server/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ func Server(opts ...Option) (*http.Server, error) {
WithCheck("web reachability", handlers.NewHTTPCheck(options.Config.HTTP.Addr)),
)

readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)).
WithInheritedChecksFrom(checkHandler.Conf),
)

return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
Expand All @@ -27,6 +34,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}
9 changes: 8 additions & 1 deletion services/userlog/pkg/server/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ func Server(opts ...Option) (*http.Server, error) {
WithCheck("web reachability", handlers.NewHTTPCheck(options.Config.HTTP.Addr)),
)

readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)).
WithInheritedChecksFrom(checkHandler.Conf),
)

return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
Expand All @@ -27,6 +34,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}

0 comments on commit d4fe58d

Please sign in to comment.