Name update
This commit is contained in:
+62
-11
@@ -87,7 +87,9 @@ impl Metrics {
|
||||
}
|
||||
|
||||
pub fn record_tftp_err(&self) {
|
||||
self.inner.tftp_transfers_err.fetch_add(1, Ordering::Relaxed);
|
||||
self.inner
|
||||
.tftp_transfers_err
|
||||
.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
// ── HTTP ───────────────────────────────────────────────────────────
|
||||
@@ -181,7 +183,10 @@ impl Metrics {
|
||||
"",
|
||||
);
|
||||
|
||||
let _ = writeln!(out, "# HELP openpxe_tftp_transfers_total TFTP transfers, by status.");
|
||||
let _ = writeln!(
|
||||
out,
|
||||
"# HELP openpxe_tftp_transfers_total TFTP transfers, by status."
|
||||
);
|
||||
let _ = writeln!(out, "# TYPE openpxe_tftp_transfers_total counter");
|
||||
let _ = writeln!(
|
||||
out,
|
||||
@@ -201,7 +206,10 @@ impl Metrics {
|
||||
"",
|
||||
);
|
||||
|
||||
let _ = writeln!(out, "# HELP openpxe_http_requests_total HTTP requests served, by route family.");
|
||||
let _ = writeln!(
|
||||
out,
|
||||
"# HELP openpxe_http_requests_total HTTP requests served, by route family."
|
||||
);
|
||||
let _ = writeln!(out, "# TYPE openpxe_http_requests_total counter");
|
||||
for (label, counter) in [
|
||||
("boot_script", &i.http_boot_script),
|
||||
@@ -218,14 +226,53 @@ impl Metrics {
|
||||
}
|
||||
|
||||
// Gauges.
|
||||
write_gauge(&mut out, "openpxe_iso_count", "ISOs currently registered (local + NFS).", i.iso_count.load(Ordering::Relaxed), "");
|
||||
write_gauge(&mut out, "openpxe_client_count", "PXE clients seen this process lifetime.", i.client_count.load(Ordering::Relaxed), "");
|
||||
write_gauge(&mut out, "openpxe_queue_count", "Clients currently waiting at the deployment queue.", i.queue_count.load(Ordering::Relaxed), "");
|
||||
write_gauge(&mut out, "openpxe_queue_imaging", "Clients currently imaging (queue + assigned target).", i.queue_imaging.load(Ordering::Relaxed), "");
|
||||
write_gauge(&mut out, "openpxe_nfs_mounts_active", "NFS shares currently mounted.", i.nfs_mounts_active.load(Ordering::Relaxed), "");
|
||||
write_gauge(&mut out, "openpxe_uptime_seconds", "Seconds since this OpenPXE instance started.", uptime_secs, "");
|
||||
write_gauge(
|
||||
&mut out,
|
||||
"openpxe_iso_count",
|
||||
"ISOs currently registered (local + NFS).",
|
||||
i.iso_count.load(Ordering::Relaxed),
|
||||
"",
|
||||
);
|
||||
write_gauge(
|
||||
&mut out,
|
||||
"openpxe_client_count",
|
||||
"PXE clients seen this process lifetime.",
|
||||
i.client_count.load(Ordering::Relaxed),
|
||||
"",
|
||||
);
|
||||
write_gauge(
|
||||
&mut out,
|
||||
"openpxe_queue_count",
|
||||
"Clients currently waiting at the deployment queue.",
|
||||
i.queue_count.load(Ordering::Relaxed),
|
||||
"",
|
||||
);
|
||||
write_gauge(
|
||||
&mut out,
|
||||
"openpxe_queue_imaging",
|
||||
"Clients currently imaging (queue + assigned target).",
|
||||
i.queue_imaging.load(Ordering::Relaxed),
|
||||
"",
|
||||
);
|
||||
write_gauge(
|
||||
&mut out,
|
||||
"openpxe_nfs_mounts_active",
|
||||
"NFS shares currently mounted.",
|
||||
i.nfs_mounts_active.load(Ordering::Relaxed),
|
||||
"",
|
||||
);
|
||||
write_gauge(
|
||||
&mut out,
|
||||
"openpxe_uptime_seconds",
|
||||
"Seconds since this OpenPXE instance started.",
|
||||
uptime_secs,
|
||||
"",
|
||||
);
|
||||
|
||||
let _ = writeln!(out, "# HELP openpxe_build_info Build metadata. Always 1; the version is in the label.");
|
||||
let _ = writeln!(
|
||||
out,
|
||||
"# HELP openpxe_build_info Build metadata. Always 1; the version is in the label."
|
||||
);
|
||||
let _ = writeln!(out, "# TYPE openpxe_build_info gauge");
|
||||
let _ = writeln!(out, "openpxe_build_info{{version=\"{version}\"}} 1");
|
||||
|
||||
@@ -259,7 +306,11 @@ mod tests {
|
||||
m.record_http(HttpRoute::Api);
|
||||
m.set_iso_count(3);
|
||||
let out = m.render("0.2.0", 42);
|
||||
assert_eq!(out.matches("# TYPE openpxe_dhcp_replies_total counter").count(), 1);
|
||||
assert_eq!(
|
||||
out.matches("# TYPE openpxe_dhcp_replies_total counter")
|
||||
.count(),
|
||||
1
|
||||
);
|
||||
assert_eq!(out.matches("# TYPE openpxe_iso_count gauge").count(), 1);
|
||||
assert!(out.contains("openpxe_dhcp_replies_total{arch=\"uefi\"} 1"));
|
||||
assert!(out.contains("openpxe_dhcp_replies_total{arch=\"bios\"} 1"));
|
||||
|
||||
Reference in New Issue
Block a user