This commit is contained in:
Mateusz Gruszczyński committed 2026-10-13 00:00:06 +02:00
1 parent d23fa5e154
commit 81ab39e70a
51 files changed
+5352 -1489

No files matched your search

+72
View File
@@ -55,6 +55,78 @@ fn render_misc(app: &App, snapshot: &crate::config::Snapshot, f: &mut Families)
&l,
host.max_connections,
);
// Backend labels are bounded by configured stream/backend IDs; never client addresses.
for backend in &view.backends {
let lb = labels(&[
("stream", &host.id),
("protocol", protocol),
("backend", &backend.id),
]);
let state = match backend.status {
"checking" => 1,
"healthy" => 2,
"unhealthy" => 3,
"disabled" => 4,
_ => 0,
};
f.add(
"rust_proxy_stream_backend_health_state",
"gauge",
"0 unverified, 1 checking, 2 healthy, 3 unhealthy, 4 disabled.",
&lb,
state,
);
f.add(
"rust_proxy_stream_backend_active",
"gauge",
"Active backend assignments including connecting TCP sessions.",
&lb,
backend.active,
);
f.add(
"rust_proxy_stream_backend_drain",
"gauge",
"One when backend refuses new sessions due to drain.",
&lb,
u8::from(backend.drain),
);
// A disabled detailed-metrics flag does not affect routing counters or probes.
if !backend.detail_enabled {
continue;
}
for (name, value) in [
("sessions_total", backend.sessions_total),
("sessions_completed_total", backend.sessions_completed),
("assignments_total", backend.assignments),
("rejected_total", backend.rejected),
("errors_total", backend.errors),
("bytes_in_total", backend.bytes_in),
("bytes_out_total", backend.bytes_out),
("packets_in_total", backend.packets_in),
("packets_out_total", backend.packets_out),
("health_success_total", Some(backend.health.successful)),
("health_failure_total", Some(backend.health.failed)),
] {
if let Some(value) = value {
f.add(
&format!("rust_proxy_stream_backend_{name}"),
"counter",
"Backend observation since listener startup.",
&lb,
value,
);
}
}
if let Some(latency) = backend.health.latency_ms {
f.add(
"rust_proxy_stream_backend_health_latency_ms",
"gauge",
"Last successful probe latency in milliseconds.",
&lb,
latency,
);
}
}
}
}
if settings.include_logging {