-
Notifications
You must be signed in to change notification settings - Fork 937
metric: track how often the flush operation is aborted due to the fut… #2338
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
base: master
Are you sure you want to change the base?
Conversation
…ure being cancelled. This PR adds a reusable Token to track when an operation is complete or report the failure via a metric. The flush operation is part of a `select!` call and can therefore be cancelled if another future completes first. We want to track how often this happens.
8e53bd4 to
5815d5b
Compare
| /// WouldBlock and are retried in a loop. | ||
| fn send_to_wouldblock_duration_s(&self) -> TimeHistogram; | ||
|
|
||
| /// Number of flush operations that were incomplete due to the future being |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Number of flush operations that were incomplete due to the future being | |
| /// Number of mid-handshake flush operations that were skipped due to future cancellation. |
Same for below
|
|
||
| /// Number of flush operations that were incomplete due to the future being | ||
| /// canceled. | ||
| fn incomplete_flush_operation_count(&self) -> Counter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fn incomplete_flush_operation_count(&self) -> Counter; | |
| fn skipped_mid_handshake_flush_count(&self) -> Counter; |
| impl<M: Metrics, F: Fn(&M)> TrackCompleteToken<M, F> { | ||
| fn new(metrics: M, f: F) -> Self { | ||
| Self { | ||
| complete: AtomicBool::from(false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be atomic?
Also, this is currently only used for incrementing one counter. It may be clearer to just pass in the counter and increment it on drop rather than register a callback.
playground example demonstrating usage: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=53b991dd80a5935ecdce5e8fbb3ca6db