add trace starts for each object type

This commit is contained in:
Mike Mason
2023-07-21 18:11:34 +00:00
parent c27e50ea0b
commit be1b480968
6 changed files with 75 additions and 0 deletions

View File

@@ -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/permissions"
)
@@ -13,6 +15,15 @@ import (
// Relationship creations use events.
// Relationship deletions use the api, as delete events delete all related resources and not just the provided ones.
func (s *service) processRelationships(ctx context.Context, eventType string, relationships Relationships) int {
ctx, span := tracer.Start(ctx, "processRelationships",
trace.WithAttributes(
attribute.String("resource.id", relationships.Resource.PrefixedID().String()),
attribute.Int("resource.subject_relationships", len(relationships.SubjectRelationships)),
),
)
defer span.End()
rlogger := s.logger.With("resource.id", relationships.Resource.PrefixedID())
wantParentRelationship, wantSubjectRelationships := s.mapRelationWants(relationships)