add trace starts for each object type
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
|
||||
"go.infratographer.com/x/events"
|
||||
"go.infratographer.com/x/gidx"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/metal/models"
|
||||
)
|
||||
@@ -58,6 +60,10 @@ func (s *service) IsOrganizationID(id gidx.PrefixedID) bool {
|
||||
|
||||
// TouchOrganization initializes a sync for the provided organization id for relationships and memberships.
|
||||
func (s *service) TouchOrganization(ctx context.Context, id gidx.PrefixedID) error {
|
||||
ctx, span := tracer.Start(ctx, "TouchOrganization", trace.WithAttributes(attribute.String("resource.id", id.String())))
|
||||
|
||||
defer span.End()
|
||||
|
||||
logger := s.logger.With("organization.id", id.String())
|
||||
|
||||
org, err := s.metal.GetOrganizationDetails(ctx, id)
|
||||
@@ -89,6 +95,10 @@ func (s *service) TouchOrganization(ctx context.Context, id gidx.PrefixedID) err
|
||||
|
||||
// DeleteOrganization deletes the provided organization id.
|
||||
func (s *service) DeleteOrganization(ctx context.Context, id gidx.PrefixedID) error {
|
||||
ctx, span := tracer.Start(ctx, "DeleteOrganization", trace.WithAttributes(attribute.String("resource.id", id.String())))
|
||||
|
||||
defer span.End()
|
||||
|
||||
err := s.publisher.PublishChange(ctx, organizationEvent, events.ChangeMessage{
|
||||
SubjectID: id,
|
||||
EventType: string(events.DeleteChangeType),
|
||||
|
||||
Reference in New Issue
Block a user