From c8783f0b3477a2f8cacd24a98cb82af47a95fd0a Mon Sep 17 00:00:00 2001 From: Abhishek Jha Date: Fri, 26 Aug 2022 14:01:19 -0700 Subject: [PATCH] Addition of domainName tag to Replication task (#4975) What changes? -- Added domain tag to replication task -- Added new metrics for replication task : replication_task_applied_per_domain --- service/history/replication/task_processor.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/service/history/replication/task_processor.go b/service/history/replication/task_processor.go index 0391b808582..a0aee8087bc 100644 --- a/service/history/replication/task_processor.go +++ b/service/history/replication/task_processor.go @@ -448,13 +448,16 @@ func (p *taskProcessorImpl) processTaskOnce(replicationTask *types.ReplicationTa if err != nil { p.updateFailureMetric(scope, err) } else { - domainName, errorDomainName := p.shard.GetDomainCache().GetDomainName(replicationTask.HistoryTaskV2Attributes.DomainID) - if errorDomainName != nil { - return errorDomainName - } now := ts.Now() mScope := p.metricsClient.Scope(scope, metrics.TargetClusterTag(p.sourceCluster)) - mScope.Tagged(metrics.DomainTag(domainName)) + domainID := replicationTask.HistoryTaskV2Attributes.GetDomainID() + if domainID != "" { + domainName, errorDomainName := p.shard.GetDomainCache().GetDomainName(domainID) + if errorDomainName != nil { + return errorDomainName + } + mScope = mScope.Tagged(metrics.DomainTag(domainName)) + } // emit the number of replication tasks mScope.IncCounter(metrics.ReplicationTasksAppliedPerDomain) // emit single task processing latency