Skip to content

Commit

Permalink
Adding logging for debugibility (cadence-workflow#2802)
Browse files Browse the repository at this point in the history
* Adding logging for debugibility
  • Loading branch information
yux0 authored Nov 8, 2019
1 parent cc891e2 commit d4308b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
10 changes: 10 additions & 0 deletions common/xdc/nDCHistoryResender.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ func (n *NDCHistoryResenderImpl) SendSingleWorkflowHistory(
for historyIterator.HasNext() {
result, err := historyIterator.Next()
if err != nil {
n.logger.Error("failed to get history events",
tag.WorkflowDomainID(domainID),
tag.WorkflowID(workflowID),
tag.WorkflowRunID(runID),
tag.Error(err))
return err
}
historyBatch := result.(*historyBatch)
Expand All @@ -132,6 +137,11 @@ func (n *NDCHistoryResenderImpl) SendSingleWorkflowHistory(
historyBatch.versionHistory.GetItems())
err = n.sendReplicationRawRequest(replicationRequest)
if err != nil {
n.logger.Error("failed to replicate events",
tag.WorkflowDomainID(domainID),
tag.WorkflowID(workflowID),
tag.WorkflowRunID(runID),
tag.Error(err))
return err
}
}
Expand Down
14 changes: 10 additions & 4 deletions service/worker/replicator/replicationTask.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ func (t *activityReplicationTask) Execute() error {
return t.historyClient.SyncActivity(ctx, t.req)
}

func (t *activityReplicationTask) HandleErr(err error) error {
func (t *activityReplicationTask) HandleErr(
err error,
) error {
if t.attempt < t.config.ReplicatorActivityBufferRetryCount() {
return err
}
Expand Down Expand Up @@ -342,7 +344,7 @@ func (t *activityReplicationTask) HandleErr(err error) error {
retryV2Err.EndEventId,
retryV2Err.EndEventVersion,
); resendErr != nil {
t.logger.Error("error resend history", tag.Error(err))
t.logger.Error("error resend history", tag.Error(resendErr))
// should return the replication error, not the resending error
return err
}
Expand All @@ -360,7 +362,9 @@ func (t *historyReplicationTask) Execute() error {
return t.historyClient.ReplicateEvents(ctx, t.req)
}

func (t *historyReplicationTask) HandleErr(err error) error {
func (t *historyReplicationTask) HandleErr(
err error,
) error {
if t.attempt < t.config.ReplicatorHistoryBufferRetryCount() {
return err
}
Expand Down Expand Up @@ -404,7 +408,9 @@ func (t *historyMetadataReplicationTask) Execute() error {
)
}

func (t *historyMetadataReplicationTask) HandleErr(err error) error {
func (t *historyMetadataReplicationTask) HandleErr(
err error,
) error {
retryErr, ok := t.convertRetryTaskError(err)
if !ok || retryErr.GetRunId() == "" {
return err
Expand Down

0 comments on commit d4308b9

Please sign in to comment.