Change invitations to use service tracing provider
This changes the invitations service to use the service tracing provider.
This commit is contained in:
@@ -4,20 +4,21 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/v2/services/invitations/pkg/invitations"
|
||||
invitationstracing "github.com/owncloud/ocis/v2/services/invitations/pkg/tracing"
|
||||
"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
|
||||
}
|
||||
|
||||
// Invite implements the Service interface.
|
||||
@@ -27,8 +28,9 @@ func (t tracing) Invite(ctx context.Context, invitation *invitations.Invitation)
|
||||
trace.WithAttributes(
|
||||
attribute.KeyValue{
|
||||
Key: "invitation", Value: attribute.StringValue(invitation.InvitedUserEmailAddress),
|
||||
})}
|
||||
ctx, span := invitationstracing.TraceProvider.Tracer("invitations").Start(ctx, "Invite", spanOpts...)
|
||||
}),
|
||||
}
|
||||
ctx, span := t.tp.Tracer("invitations").Start(ctx, "Invite", spanOpts...)
|
||||
defer span.End()
|
||||
|
||||
return t.next.Invite(ctx, invitation)
|
||||
|
||||
Reference in New Issue
Block a user