global: snapshot

This commit is contained in:
nym21
2026-03-12 01:30:50 +01:00
parent 71dd7e9852
commit b97f32f86e
51 changed files with 916 additions and 652 deletions

View File

@@ -235,9 +235,13 @@ pub struct MetricNotFound {
}
impl MetricNotFound {
pub fn new(metric: String, all_matches: Vec<String>) -> Self {
pub fn new(mut metric: String, all_matches: Vec<String>) -> Self {
let total_matches = all_matches.len();
let suggestions = all_matches.into_iter().take(3).collect();
if metric.len() > 100 {
metric.truncate(100);
metric.push_str("...");
}
Self {
metric,
suggestions,
@@ -261,7 +265,7 @@ impl fmt::Display for MetricNotFound {
if remaining > 0 {
write!(
f,
" ({remaining} more — /api/metrics/search/{} for all)",
" ({remaining} more — /api/metrics/search?q={} for all)",
self.metric
)?;
}