Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metric when history replication message is too large #6558

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,8 @@ 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 Expand Up @@ -2523,6 +2525,7 @@ const (
ReplicationDLQProbeFailed
ReplicationDLQSize
ReplicationDLQValidationFailed
ReplicationMessageTooLargePerShard
GetReplicationMessagesForShardLatency
GetDLQReplicationMessagesLatency
EventReapplySkippedCount
Expand Down Expand Up @@ -3217,6 +3220,7 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{
ReplicationDLQProbeFailed: {metricName: "replication_dlq_probe_failed", metricType: Counter},
ReplicationDLQSize: {metricName: "replication_dlq_size", metricType: Gauge},
ReplicationDLQValidationFailed: {metricName: "replication_dlq_validation_failed", metricType: Counter},
ReplicationMessageTooLargePerShard: {metricName: "replication_message_too_large_per_shard", metricType: Counter},
GetReplicationMessagesForShardLatency: {metricName: "get_replication_messages_for_shard", metricType: Timer},
GetDLQReplicationMessagesLatency: {metricName: "get_dlq_replication_messages", metricType: Timer},
EventReapplySkippedCount: {metricName: "event_reapply_skipped_count", metricType: Counter},
Expand Down
3 changes: 3 additions & 0 deletions service/history/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,9 @@ func (h *handlerImpl) GetReplicationMessages(

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

@Shaddoll Shaddoll Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's reuse the metric scope returned in line 1558 with shard id tag included

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed. I only added the shard tag inside of that if statement.

metricsScope.IncCounter(metrics.ReplicationMessageTooLargePerShard)

// Log shards that did not fit for debugging purposes
h.GetLogger().Warn("Replication messages did not fit in the response (history host)",
tag.ShardID(int(shardID)),
Expand Down
Loading