This commit is contained in:
Mateusz Gruszczyński committed 2026-10-05 09:30:21 +02:00
1 parent 1dea7f55c8
commit c819f0a335
151 files changed
+7610 -4264

No files matched your search

+42 -15
View File
@@ -24,10 +24,26 @@ impl BackendState {
latency_us: 0,
ewma_us: 0,
transitions: 0,
unhealthy_source: if mode == HealthMode::Off { "none" } else { "active" },
unhealthy_reason: if mode == HealthMode::Off { "none" } else { "checking" },
active_unhealthy_source: if mode == HealthMode::Off { "none" } else { "active" },
active_unhealthy_reason: if mode == HealthMode::Off { "none" } else { "checking" },
unhealthy_source: if mode == HealthMode::Off {
"none"
} else {
"active"
},
unhealthy_reason: if mode == HealthMode::Off {
"none"
} else {
"checking"
},
active_unhealthy_source: if mode == HealthMode::Off {
"none"
} else {
"active"
},
active_unhealthy_reason: if mode == HealthMode::Off {
"none"
} else {
"checking"
},
passive_unhealthy_source: "none",
passive_unhealthy_reason: "none",
}),
@@ -169,9 +185,9 @@ impl BackendState {
return;
}
let current_source_is_still_unhealthy =
(h.unhealthy_source.starts_with("active") && !h.active_healthy)
|| (h.unhealthy_source.starts_with("passive") && !h.passive_healthy);
let current_source_is_still_unhealthy = (h.unhealthy_source.starts_with("active")
&& !h.active_healthy)
|| (h.unhealthy_source.starts_with("passive") && !h.passive_healthy);
if current_source_is_still_unhealthy {
return;
}
@@ -202,7 +218,8 @@ impl BackendState {
h.active_healthy = true;
}
} else {
self.active_health_failures_total.fetch_add(1, Ordering::Relaxed);
self.active_health_failures_total
.fetch_add(1, Ordering::Relaxed);
h.successes = 0;
h.failures = h.failures.saturating_add(1);
if h.failures >= settings.fall {
@@ -260,11 +277,21 @@ impl BackendState {
fn record_passive_observation(&self, reason: &'static str) {
match reason {
"http_5xx" => { self.http_5xx_total.fetch_add(1, Ordering::Relaxed); }
"timeout" => { self.timeouts_total.fetch_add(1, Ordering::Relaxed); }
"connect_error" => { self.connect_errors_total.fetch_add(1, Ordering::Relaxed); }
"io_error" => { self.io_errors_total.fetch_add(1, Ordering::Relaxed); }
"slow_response" => { self.slow_responses_total.fetch_add(1, Ordering::Relaxed); }
"http_5xx" => {
self.http_5xx_total.fetch_add(1, Ordering::Relaxed);
}
"timeout" => {
self.timeouts_total.fetch_add(1, Ordering::Relaxed);
}
"connect_error" => {
self.connect_errors_total.fetch_add(1, Ordering::Relaxed);
}
"io_error" => {
self.io_errors_total.fetch_add(1, Ordering::Relaxed);
}
"slow_response" => {
self.slow_responses_total.fetch_add(1, Ordering::Relaxed);
}
_ => {}
}
}
@@ -301,7 +328,8 @@ impl BackendState {
if !passive.counts(reason) {
return;
}
self.passive_health_failures_total.fetch_add(1, Ordering::Relaxed);
self.passive_health_failures_total
.fetch_add(1, Ordering::Relaxed);
h.passive_successes = 0;
h.passive_failures = h.passive_failures.saturating_add(1);
if h.passive_failures >= passive.fall(active) {
@@ -325,7 +353,6 @@ impl BackendState {
}
self.finish_transition(&mut h, previous);
}
}
#[derive(Debug)]
pub struct Member {