From b3a5da830809bdf1237ecb17cd1a2006392120cd Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Sat, 7 Dec 2024 00:54:19 +0700 Subject: [PATCH] sort the language labels --- skystreamer-prometheus-exporter/src/posts.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/skystreamer-prometheus-exporter/src/posts.rs b/skystreamer-prometheus-exporter/src/posts.rs index 14958be..a6243e4 100644 --- a/skystreamer-prometheus-exporter/src/posts.rs +++ b/skystreamer-prometheus-exporter/src/posts.rs @@ -265,7 +265,7 @@ impl PostsRegistry { { // Languages of the posts - let langs = post + let mut langs = post .language .iter() .map(|lang| { @@ -291,6 +291,9 @@ impl PostsRegistry { }) .collect::>(); + // sort the languages + langs.sort(); + langs.iter().for_each(|lang| { self.language_counter_individual .with_label_values(&[lang])