Skip to content

Commit

Permalink
fix(internal_metrics source): Emit build_info gauge on an interval (#…
Browse files Browse the repository at this point in the history
…21991)

* fix(internal_metrics source): Emit build_info on an interval

Signed-off-by: Jesse Szwedko <[email protected]>

* Add changelog entry

Signed-off-by: Jesse Szwedko <[email protected]>

* Fix imports

Signed-off-by: Jesse Szwedko <[email protected]>

* fix: add import

---------

Signed-off-by: Jesse Szwedko <[email protected]>
Co-authored-by: Pavlos Rontidis <[email protected]>
  • Loading branch information
jszwedko and pront committed Dec 9, 2024
1 parent ca3abef commit 43b8916
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions changelog.d/21988_emit_build_info_interval.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Emit `build_info` gauge on an interval to avoid expiration.

authors: jszwedko
10 changes: 10 additions & 0 deletions src/internal_events/heartbeat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::Instant;

use crate::built_info;
use metrics::gauge;
use vector_lib::internal_event::InternalEvent;

Expand All @@ -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);
}
}
10 changes: 0 additions & 10 deletions src/internal_events/process.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand All @@ -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);
}
}
Expand Down

0 comments on commit 43b8916

Please sign in to comment.