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

Conversation

bowenxia
Copy link
Member

What changed?
Add metric when history replication message is too large

Why?
to catch a previous on-call issue

How did you test it?

Potential risks

Release notes

Documentation Changes

@@ -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.

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.40%. Comparing base (4b24cb9) to head (3fbc6f8).
Report is 1 commits behind head on master.

Files with missing lines Coverage Δ
service/history/handler/handler.go 88.94% <100.00%> (+0.01%) ⬆️

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b24cb9...3fbc6f8. Read the comment docs.

@@ -1601,6 +1601,9 @@ func (h *handlerImpl) GetReplicationMessages(

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

Choose a reason for hiding this comment

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

it would be better to have a gauge metric instead of counter which would have value responseSize + size

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that but:

  1. Our purpose was to make an alert that can catch things when there are a lot of "replication message too large" warnings, so I think adding a counter could be a more straightforward way.
  2. The maxResponseSize is not a fixed value, so that it would be harder to find a threshold to trigger the alert.

Copy link
Member

Choose a reason for hiding this comment

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

I see. If we are more interested in the number of occurrences then counter makes sense.

@bowenxia bowenxia merged commit b5628a7 into master Dec 12, 2024
20 checks passed
@bowenxia bowenxia deleted the xbowen/add_metric_for_history_replication_message_too_large branch December 12, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants