Add tracing to settings service.

This adds tracing to the settings service. It uses the otelchi package
and passes the tracing provider to the grpc and http servers.
This commit is contained in:
Daniël Franke
2023-06-27 12:31:19 +02:00
parent cd304b4df8
commit 96557a95ae
36 changed files with 2230 additions and 81 deletions
@@ -8,6 +8,7 @@ import (
"github.com/owncloud/ocis/v2/services/settings/pkg/metrics"
svc "github.com/owncloud/ocis/v2/services/settings/pkg/service/v0"
"github.com/urfave/cli/v2"
"go.opentelemetry.io/otel/trace"
)
// Option defines a single option function.
@@ -22,6 +23,7 @@ type Options struct {
Metrics *metrics.Metrics
ServiceHandler svc.Service
Flags []cli.Flag
TraceProvider trace.TracerProvider
}
// newOptions initializes the available default options.
@@ -83,3 +85,10 @@ func ServiceHandler(val svc.Service) Option {
o.ServiceHandler = val
}
}
// TraceProvider provides a function to set the TraceProvider option
func TraceProvider(val trace.TracerProvider) Option {
return func(o *Options) {
o.TraceProvider = val
}
}