Add tracing to eventhistory service.

This adds tracing to the event history service.
This commit is contained in:
Daniël Franke
2023-07-07 12:46:59 +02:00
parent 1658084812
commit d00f5a9da5
5 changed files with 50 additions and 20 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
ogrpc "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"
"github.com/owncloud/ocis/v2/services/eventhistory/pkg/config"
"github.com/owncloud/ocis/v2/services/eventhistory/pkg/config/parser"
@@ -32,7 +33,13 @@ func Server(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
err := ogrpc.Configure(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
traceProvider, err := tracing.GetServiceTraceProvider(cfg.Tracing, cfg.Service.Name)
if err != nil {
return err
}
err = ogrpc.Configure(
append(ogrpc.GetClientOptions(cfg.GRPCClientTLS), ogrpc.WithTraceProvider(traceProvider))...,
)
if err != nil {
return err
}
@@ -76,6 +83,7 @@ func Server(cfg *config.Config) *cli.Command {
grpc.Metrics(metrics),
grpc.Consumer(consumer),
grpc.Persistence(st),
grpc.TraceProvider(traceProvider),
)
gr.Add(service.Run, func(err error) {
@@ -107,7 +115,6 @@ func Server(cfg *config.Config) *cli.Command {
}
return gr.Run()
},
}
}