Add tracing to notifications service. (#6808)

* Add tracing to notifications service.

This enables tracing to the notifications service.

* Update services/notifications/pkg/config/tracing.go

---------

Co-authored-by: Jörn Friedrich Dreyer <jfd@owncloud.com>
This commit is contained in:
Daniël Franke
2023-07-14 16:11:49 +02:00
committed by GitHub
co-authored by Jörn Friedrich Dreyer
parent 6bb265fcf0
commit 91b46e32fc
3 changed files with 34 additions and 9 deletions
+13 -1
View File
@@ -18,6 +18,7 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
"github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/v2/ocis-pkg/tracing"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/v2/services/notifications/pkg/channels"
@@ -40,7 +41,17 @@ func Server(cfg *config.Config) *cli.Command {
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
err := grpc.Configure(grpc.GetClientOptions(&cfg.GRPCClientTLS)...)
traceProvider, err := tracing.GetServiceTraceProvider(cfg.Tracing, cfg.Service.Name)
if err != nil {
return err
}
err = grpc.Configure(
append(
grpc.GetClientOptions(&cfg.GRPCClientTLS),
grpc.WithTraceProvider(traceProvider),
)...,
)
if err != nil {
return err
}
@@ -133,6 +144,7 @@ func Server(cfg *config.Config) *cli.Command {
pool.WithTLSCACert(cfg.Notifications.GRPCClientTLS.CACert),
pool.WithTLSMode(tm),
pool.WithRegistry(registry.GetRegistry()),
pool.WithTracerProvider(traceProvider),
)
if err != nil {
logger.Fatal().Err(err).Str("addr", cfg.Notifications.RevaGateway).Msg("could not get reva gateway selector")