Move graph service to service tracer.

This changes the graph service away from using global tracers,
which makes debugging tracing issues easier going forward.
This commit is contained in:
Daniël Franke
2023-07-12 12:56:33 +02:00
parent 138754749a
commit 919404bafe
12 changed files with 50 additions and 974 deletions
+15 -6
View File
@@ -7,6 +7,7 @@ import (
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/metrics"
"github.com/urfave/cli/v2"
"go.opentelemetry.io/otel/trace"
)
// Option defines a single option function.
@@ -14,12 +15,13 @@ type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Flags []cli.Flag
Namespace string
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Flags []cli.Flag
Namespace string
TraceProvider trace.TracerProvider
}
// newOptions initializes the available default options.
@@ -74,3 +76,10 @@ func Namespace(val string) Option {
o.Namespace = val
}
}
// TraceProvider provides a function to set the TraceProvider option.
func TraceProvider(val trace.TracerProvider) Option {
return func(o *Options) {
o.TraceProvider = val
}
}