-
Notifications
You must be signed in to change notification settings - Fork 30
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
Exclude Epoch Boundary from Health Check #105
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
83f0450
Exclude Epoch Boundary from Health Check
jedleggett 298e22c
feedback
jedleggett f6998bc
handle possible slot padding
jedleggett f60203d
ignore edge cases
jedleggett 8058f31
Merge branch 'master' into jl/epoch_boundary_health
jedleggett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ use std::{ | |
|
||
use crossbeam_channel::{select, tick, Receiver, Sender}; | ||
use solana_metrics::datapoint_info; | ||
use solana_sdk::clock::Slot; | ||
use solana_sdk::clock::{Slot, DEFAULT_SLOTS_PER_EPOCH}; | ||
|
||
#[derive(PartialEq, Eq, Copy, Clone)] | ||
pub enum HealthState { | ||
|
@@ -42,23 +42,30 @@ impl HealthManager { | |
let mut slot_sender_max_len = 0usize; | ||
let channel_len_tick = tick(Duration::from_secs(5)); | ||
let check_and_metrics_tick = tick(missing_slot_unhealthy_threshold / 2); | ||
let mut outside_epoch_boundary = true; | ||
|
||
while !exit.load(Ordering::Relaxed) { | ||
select! { | ||
recv(check_and_metrics_tick) -> _ => { | ||
let new_health_state = | ||
match last_update.elapsed() <= missing_slot_unhealthy_threshold { | ||
true => HealthState::Healthy, | ||
false => HealthState::Unhealthy, | ||
}; | ||
*health_state.write().unwrap() = new_health_state; | ||
datapoint_info!( | ||
"relayer-health-state", | ||
("health_state", new_health_state, i64) | ||
); | ||
if outside_epoch_boundary { | ||
let new_health_state = | ||
match last_update.elapsed() <= missing_slot_unhealthy_threshold { | ||
true => HealthState::Healthy, | ||
false => HealthState::Unhealthy, | ||
}; | ||
*health_state.write().unwrap() = new_health_state; | ||
datapoint_info!( | ||
"relayer-health-state", | ||
("health_state", new_health_state, i64) | ||
); | ||
} | ||
} | ||
recv(slot_receiver) -> maybe_slot => { | ||
let slot = maybe_slot.expect("error receiving slot, exiting"); | ||
// Don't perform health updates within +/- 75 slots of epoch boundary | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thoughts on moving this logic to the health state stuff above? |
||
// Note: This is not necessarily correct for local testing | ||
let slot_index = slot % DEFAULT_SLOTS_PER_EPOCH; | ||
outside_epoch_boundary = 75 < slot_index && slot_index < (DEFAULT_SLOTS_PER_EPOCH - 75); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be good to add a const for 75 with a comment on why the specific value |
||
slot_sender.send(slot).expect("error forwarding slot, exiting"); | ||
last_update = Instant::now(); | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can you move the check of outside_epoch_boundary into the match statement/if/else for health state? may be helpful to continue emitting data points during that time