From 43b8916fa5b381cc90a22c787a574c8fc75550b5 Mon Sep 17 00:00:00 2001 From: Jesse Szwedko Date: Mon, 9 Dec 2024 22:25:25 +0100 Subject: [PATCH] fix(internal_metrics source): Emit `build_info` gauge on an interval (#21991) * fix(internal_metrics source): Emit build_info on an interval Signed-off-by: Jesse Szwedko * Add changelog entry Signed-off-by: Jesse Szwedko * Fix imports Signed-off-by: Jesse Szwedko * fix: add import --------- Signed-off-by: Jesse Szwedko Co-authored-by: Pavlos Rontidis --- changelog.d/21988_emit_build_info_interval.fix.md | 3 +++ src/internal_events/heartbeat.rs | 10 ++++++++++ src/internal_events/process.rs | 10 ---------- 3 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 changelog.d/21988_emit_build_info_interval.fix.md diff --git a/changelog.d/21988_emit_build_info_interval.fix.md b/changelog.d/21988_emit_build_info_interval.fix.md new file mode 100644 index 0000000000000..9c26f735e2bbb --- /dev/null +++ b/changelog.d/21988_emit_build_info_interval.fix.md @@ -0,0 +1,3 @@ +Emit `build_info` gauge on an interval to avoid expiration. + +authors: jszwedko diff --git a/src/internal_events/heartbeat.rs b/src/internal_events/heartbeat.rs index 17f3f91a2858f..4e71d8a45fd1a 100644 --- a/src/internal_events/heartbeat.rs +++ b/src/internal_events/heartbeat.rs @@ -1,5 +1,6 @@ use std::time::Instant; +use crate::built_info; use metrics::gauge; use vector_lib::internal_event::InternalEvent; @@ -12,5 +13,14 @@ impl InternalEvent for Heartbeat { fn emit(self) { trace!(target: "vector", message = "Beep."); gauge!("uptime_seconds").set(self.since.elapsed().as_secs() as f64); + gauge!( + "build_info", + "debug" => built_info::DEBUG, + "version" => built_info::PKG_VERSION, + "rust_version" => built_info::RUST_VERSION, + "arch" => built_info::TARGET_ARCH, + "revision" => built_info::VECTOR_BUILD_DESC.unwrap_or("") + ) + .set(1.0); } } diff --git a/src/internal_events/process.rs b/src/internal_events/process.rs index 04ac6c32e877e..5a54154eca849 100644 --- a/src/internal_events/process.rs +++ b/src/internal_events/process.rs @@ -1,5 +1,4 @@ use metrics::counter; -use metrics::gauge; use vector_lib::internal_event::InternalEvent; use vector_lib::internal_event::{error_stage, error_type}; @@ -18,15 +17,6 @@ impl InternalEvent for VectorStarted { arch = built_info::TARGET_ARCH, revision = built_info::VECTOR_BUILD_DESC.unwrap_or(""), ); - gauge!( - "build_info", - "debug" => built_info::DEBUG, - "version" => built_info::PKG_VERSION, - "rust_version" => built_info::RUST_VERSION, - "arch" => built_info::TARGET_ARCH, - "revision" => built_info::VECTOR_BUILD_DESC.unwrap_or("") - ) - .set(1.0); counter!("started_total").increment(1); } }