Convert webfinger to use service trace provider
This commit is contained in:
@@ -4,21 +4,22 @@ import (
|
||||
"context"
|
||||
"net/url"
|
||||
|
||||
webfingertracing "github.com/owncloud/ocis/v2/services/webfinger/pkg/tracing"
|
||||
"github.com/owncloud/ocis/v2/services/webfinger/pkg/webfinger"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// NewTracing returns a service that instruments traces.
|
||||
func NewTracing(next Service) Service {
|
||||
func NewTracing(next Service, tp trace.TracerProvider) Service {
|
||||
return tracing{
|
||||
next: next,
|
||||
tp: tp,
|
||||
}
|
||||
}
|
||||
|
||||
type tracing struct {
|
||||
next Service
|
||||
tp trace.TracerProvider
|
||||
}
|
||||
|
||||
// Webfinger implements the Service interface.
|
||||
@@ -30,7 +31,7 @@ func (t tracing) Webfinger(ctx context.Context, queryTarget *url.URL, rels []str
|
||||
attribute.KeyValue{Key: "rels", Value: attribute.StringSliceValue(rels)},
|
||||
),
|
||||
}
|
||||
ctx, span := webfingertracing.TraceProvider.Tracer("webfinger").Start(ctx, "Webfinger", spanOpts...)
|
||||
ctx, span := t.tp.Tracer("webfinger").Start(ctx, "Webfinger", spanOpts...)
|
||||
defer span.End()
|
||||
|
||||
return t.next.Webfinger(ctx, queryTarget, rels)
|
||||
|
||||
Reference in New Issue
Block a user