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"
|
||||
)
|
||||
@@ -51,6 +53,10 @@ func (s *service) IsProjectID(id gidx.PrefixedID) bool {
|
||||
|
||||
// TouchProject initializes a sync for the provided project id for relationships and memberships.
|
||||
func (s *service) TouchProject(ctx context.Context, id gidx.PrefixedID) error {
|
||||
ctx, span := tracer.Start(ctx, "TouchProject", trace.WithAttributes(attribute.String("resource.id", id.String())))
|
||||
|
||||
defer span.End()
|
||||
|
||||
logger := s.logger.With("project.id", id.String())
|
||||
|
||||
project, err := s.metal.GetProjectDetails(ctx, id)
|
||||
@@ -82,6 +88,10 @@ func (s *service) TouchProject(ctx context.Context, id gidx.PrefixedID) error {
|
||||
|
||||
// DeleteProject deletes the provided project id.
|
||||
func (s *service) DeleteProject(ctx context.Context, id gidx.PrefixedID) error {
|
||||
ctx, span := tracer.Start(ctx, "DeleteProject", trace.WithAttributes(attribute.String("resource.id", id.String())))
|
||||
|
||||
defer span.End()
|
||||
|
||||
err := s.publisher.PublishChange(ctx, projectEvent, events.ChangeMessage{
|
||||
SubjectID: id,
|
||||
EventType: string(events.DeleteChangeType),
|
||||
|
||||
Reference in New Issue
Block a user