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 (
"strings"
"go.infratographer.com/x/gidx"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"golang.org/x/exp/slices"
"go.equinixmetal.net/infra9-metal-bridge/internal/permissions"
@@ -13,6 +15,15 @@ import (
// processMemberships determines the changes between what is wanted and what is live and executes on the differences.
// If skipDeletions is true, no deletes will be executed.
func (s *service) processMemberships(ctx context.Context, relationships Relationships, skipDeletions bool) (int, int) {
ctx, span := tracer.Start(ctx, "processMemberships",
trace.WithAttributes(
attribute.String("resource.id", relationships.Resource.PrefixedID().String()),
attribute.Int("resource.memberships", len(relationships.Memberships)),
),
)
defer span.End()
if len(relationships.Memberships) == 0 {
return 0, 0
}