Skip to content

Commit

Permalink
reuse previously created metric scope
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenxia committed Dec 11, 2024
1 parent acf39b3 commit 0e68040
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1299,8 +1299,6 @@ const (
ReplicationTaskCleanupScope
// ReplicationDLQStatsScope is scope used by all metrics emitted related to replication DLQ
ReplicationDLQStatsScope
// ReplicationMessageTooLargeScope is scope used by all metrics emitted related to replication message size
ReplicationMessageTooLargeScope
// FailoverMarkerScope is scope used by all metrics emitted related to failover marker
FailoverMarkerScope
// HistoryReplicationV2TaskScope is the scope used by history task replication processing
Expand Down
4 changes: 2 additions & 2 deletions service/history/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ func (h *handlerImpl) GetReplicationMessages(

h.GetLogger().Debug("Received GetReplicationMessages call.")

_, sw := h.startRequestProfile(ctx, metrics.HistoryGetReplicationMessagesScope)
metricsScope, sw := h.startRequestProfile(ctx, metrics.HistoryGetReplicationMessagesScope)
defer sw.Stop()

if h.isShuttingDown() {
Expand Down Expand Up @@ -1601,7 +1601,7 @@ func (h *handlerImpl) GetReplicationMessages(

size := proto.FromReplicationMessages(tasks).Size()
if (responseSize + size) >= maxResponseSize {
metricsScope := h.GetMetricsClient().Scope(metrics.ReplicationMessageTooLargeScope, metrics.ShardIDTag(int(shardID)))
metricsScope.Tagged(metrics.ShardIDTag(int(shardID)))
metricsScope.IncCounter(metrics.ReplicationMessageTooLargePerShard)

// Log shards that did not fit for debugging purposes
Expand Down

0 comments on commit 0e68040

Please sign in to comment.