Skip to content

Commit

Permalink
Archival tag activity logger with workflowID and runID (cadence-workf…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 authored Jun 11, 2019
1 parent c4a2686 commit b6ac934
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions service/worker/archiver/activities.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func uploadHistoryActivity(ctx context.Context, request ArchiveRequest) (err err
}
}()

logger := tagLoggerWithRequest(container.Logger, request).WithTags(tag.Attempt(activity.GetInfo(ctx).Attempt))
logger := tagLoggerWithRequest(tagLoggerWithActivityInfo(container.Logger, activity.GetInfo(ctx)), request)
domainCache := container.DomainCache
clusterMetadata := container.ClusterMetadata
domainCacheEntry, err := getDomainByID(ctx, domainCache, request.DomainID)
Expand Down Expand Up @@ -283,7 +283,7 @@ func deleteHistoryActivity(ctx context.Context, request ArchiveRequest) (err err
}
}
}()
logger := tagLoggerWithRequest(container.Logger, request).WithTags(tag.Attempt(activity.GetInfo(ctx).Attempt))
logger := tagLoggerWithRequest(tagLoggerWithActivityInfo(container.Logger, activity.GetInfo(ctx)), request)
if request.EventStoreVersion == persistence.EventStoreVersionV2 {
if err := deleteHistoryV2(ctx, container, request); err != nil {
logger.Error("failed to delete history from events v2", tag.ArchivalDeleteHistoryFailReason(errorDetails(err)), tag.Error(err))
Expand Down Expand Up @@ -317,7 +317,7 @@ func deleteBlobActivity(ctx context.Context, request ArchiveRequest) (err error)
}
}
}()
logger := tagLoggerWithRequest(container.Logger, request).WithTags(tag.Attempt(activity.GetInfo(ctx).Attempt))
logger := tagLoggerWithRequest(tagLoggerWithActivityInfo(container.Logger, activity.GetInfo(ctx)), request)
blobstoreClient := container.Blobstore

if err := validateArchivalRequest(&request); err != nil {
Expand Down
8 changes: 8 additions & 0 deletions service/worker/archiver/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/uber/cadence/common/log"
"github.com/uber/cadence/common/log/tag"
"go.uber.org/cadence"
"go.uber.org/cadence/activity"
)

// MaxArchivalIterationTimeout returns the max allowed timeout for a single iteration of archival workflow
Expand Down Expand Up @@ -78,6 +79,13 @@ func tagLoggerWithRequest(logger log.Logger, request ArchiveRequest) log.Logger
)
}

func tagLoggerWithActivityInfo(logger log.Logger, activityInfo activity.Info) log.Logger {
return logger.WithTags(
tag.WorkflowID(activityInfo.WorkflowExecution.ID),
tag.WorkflowRunID(activityInfo.WorkflowExecution.RunID),
tag.Attempt(activityInfo.Attempt))
}

func contextExpired(ctx context.Context) bool {
select {
case <-ctx.Done():
Expand Down

0 comments on commit b6ac934

Please sign in to comment.