-
Notifications
You must be signed in to change notification settings - Fork 84
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
Make metrics bad token detector configurable #3176
Conversation
crates/driver/src/infra/api/mod.rs
Outdated
let metrics_bad_token_detector = bad_tokens::metrics::Detector::new( | ||
self.bad_token_detection.metrics_bad_token_failure_ratio, | ||
self.bad_token_detection | ||
.metrics_bad_token_required_measurements, | ||
); |
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.
Different solver instances must not share the same metrics based detector all of them need to have their own.
The reason they should share the simulation detector is that it's predictable. All solvers running the simulation detector should come to the same conclusions about all tested tokens.
The metrics based approach is unique to each solver. Some solvers do support trading fee on transfer tokens. For those solvers the failure measurements for fee-on-transfer tokens will be significantly less than on solvers that don't support them correctly.
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.
Got it, makes sense, thanks. Fixed this.
|
||
impl Default for BadTokenDetectionConfig { | ||
fn default() -> Self { | ||
serde_json::from_str("{}").expect("BadTokenDetectionConfig uses default values") |
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.
Interesting idea to avoid duplicating default definitions.
# Conflicts: # crates/driver/src/domain/competition/bad_tokens/cache.rs # crates/driver/src/domain/competition/bad_tokens/metrics.rs # crates/driver/src/domain/competition/bad_tokens/mod.rs # crates/driver/src/domain/competition/bad_tokens/simulation.rs # crates/driver/src/domain/competition/mod.rs # crates/driver/src/infra/api/mod.rs # crates/driver/src/infra/config/file/load.rs # crates/driver/src/infra/config/file/mod.rs # crates/driver/src/infra/solver/mod.rs
c639068
to
5cbccd4
Compare
# Conflicts: # crates/driver/src/domain/competition/bad_tokens/metrics.rs # crates/driver/src/infra/api/mod.rs # crates/driver/src/infra/config/file/load.rs # crates/driver/src/infra/config/file/mod.rs # crates/driver/src/infra/solver/mod.rs
This is a follow-up to #3172, which makes the metrics bad token detector configurable. Uses the same default values.
simulation_bad_token_max_age
remains global config, while everything else bad-token related is now configured per solver since conditions may change from solver to solver.