feat: Add Prometheus metrics endpoint

This commit is contained in:
Erwan Leboucher authored and Jade Ellis committed 2026-10-12 10:03:12 +01:00
1 parent ea96858c4a
commit f14c401f39
25 files changed
+652 -46

No files matched your search

+11
View File
@@ -49,6 +49,17 @@ where
Ok(out)
}
/// Compare two strings without short-circuiting on the first mismatch, for
/// checking secrets.
#[must_use]
pub fn constant_time_eq(a: &str, b: &str) -> bool {
a.len() == b.len()
&& a.bytes()
.zip(b.bytes())
.fold(0_u8, |acc, (x, y)| acc | (x ^ y))
== 0
}
#[inline]
#[must_use]
pub fn camel_to_snake_string(s: &str) -> String {
+7
View File
@@ -68,3 +68,10 @@ fn between_infallible() {
assert_eq!("\"foo".between_infallible(("\"", "\"")), "\"foo");
assert_eq!("foo".between_infallible(("\"", "\"")), "foo");
}
#[test]
fn constant_time_eq() {
assert!(super::constant_time_eq("abc", "abc"));
assert!(!super::constant_time_eq("abc", "abz"));
assert!(!super::constant_time_eq("abc", "abcd"));
}