Skip to content

kvcoord: Add metric to keep track of restarted ranges in rangefeed#98980

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
miretskiy:muxrf
Mar 22, 2023
Merged

kvcoord: Add metric to keep track of restarted ranges in rangefeed#98980
craig[bot] merged 1 commit intocockroachdb:masterfrom
miretskiy:muxrf

Conversation

@miretskiy
Copy link
Copy Markdown
Contributor

Add a distsender.rangefeed.restart_ranges metric to keep track of the number of ranges restarted due to transient error.

Epic: CRDB-25044
Release note: None

@miretskiy miretskiy requested review from a team and erikgrinaker March 19, 2023 13:16
@miretskiy miretskiy requested a review from a team as a code owner March 19, 2023 13:16
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Mar 19, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

// Ensure context is cancelled on all errors, to prevent gRPC stream leaks.
ctx, cancelFeed := context.WithCancel(ctx)
defer func() {
ds.metrics.RangefeedRestartRanges.Inc(1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is going to increment the metric when the rangefeed isn't restarted too, e.g. when cancelled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added check on ctx.Err.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It will also increment the metric when handleRangefeedError returns a permanent error. Shouldn't this be incremented in partialRangeFeed once we've actually determined to restart the rangefeed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, definitely

@miretskiy miretskiy force-pushed the muxrf branch 2 times, most recently from 43abde5 to 7bc7b46 Compare March 19, 2023 14:47
Add a `distsender.rangefeed.restart_ranges` metric to keep track
of the number of ranges restarted due to transient error.

Epic: CRDB-25044
Release note: None
@miretskiy
Copy link
Copy Markdown
Contributor Author

bors r+

@craig craig bot merged commit 5fc479d into cockroachdb:master Mar 22, 2023
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 22, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants