Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 1e9bb67

Browse files
authored
Group Work Unit checks (#401)
* move validator to async redis, remove unwraps, add work units check
1 parent 177e60b commit 1e9bb67

File tree

3 files changed

+460
-68
lines changed

3 files changed

+460
-68
lines changed

crates/validator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ log = { workspace = true }
1818
nalgebra = { workspace = true }
1919
prometheus = "0.14.0"
2020
rand = "0.9.0"
21-
redis = { workspace = true }
21+
redis = { workspace = true, features = ["tokio-comp"] }
2222
redis-test = { workspace = true }
2323
regex = "1.11.1"
2424
reqwest = { workspace = true }

crates/validator/src/metrics.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ lazy_static! {
99
"validator_validation_loop_duration_seconds",
1010
"Duration of the validation loop",
1111
&["validator_id", "pool_id"],
12-
vec![0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0]
12+
vec![0.01, 0.05, 0.1, 0.25, 0.5, 1.0, 2.0, 5.0, 10.0, 15.0, 30.0, 60.0, 120.0, 300.0]
1313
).unwrap();
1414

1515
// === SYNTHETIC DATA VALIDATION METRICS ===
@@ -54,6 +54,12 @@ lazy_static! {
5454
"Total group validations by result",
5555
&["validator_id", "pool_id", "group_id", "toploc_config_name", "result"] // result: accept, reject, crashed, pending, unknown
5656
).unwrap();
57+
58+
pub static ref GROUP_WORK_UNITS_CHECK_TOTAL: CounterVec = register_counter_vec!(
59+
"validator_group_work_units_check_total",
60+
"Whether the work units match the group size",
61+
&["validator_id", "pool_id", "group_id", "toploc_config_name", "result"] // result: match, mismatch
62+
).unwrap();
5763
}
5864

5965
pub fn export_metrics() -> Result<String, prometheus::Error> {
@@ -119,6 +125,25 @@ impl MetricsContext {
119125
}
120126
}
121127

128+
pub fn record_group_work_units_check_result(
129+
&self,
130+
group_id: &str,
131+
toploc_config_name: &str,
132+
result: &str,
133+
) {
134+
if let Some(pool_id) = &self.pool_id {
135+
GROUP_WORK_UNITS_CHECK_TOTAL
136+
.with_label_values(&[
137+
&self.validator_id as &str,
138+
pool_id,
139+
group_id,
140+
toploc_config_name,
141+
result,
142+
])
143+
.inc();
144+
}
145+
}
146+
122147
pub fn record_validation_loop_duration(&self, duration_s: f64) {
123148
let pool_id = self.pool_id.as_deref().unwrap_or("hw_validator");
124149
VALIDATION_LOOP_DURATION

0 commit comments

Comments
 (0)