1//! This exposes reth's version information over prometheus.
2use metrics::gauge;
34/// Contains version information for the application.
5#[derive(Debug, Clone)]
6pub struct VersionInfo {
7/// The version of the application.
8pub version: &'static str,
9/// The build timestamp of the application.
10pub build_timestamp: &'static str,
11/// The cargo features enabled for the build.
12pub cargo_features: &'static str,
13/// The Git SHA of the build.
14pub git_sha: &'static str,
15/// The target triple for the build.
16pub target_triple: &'static str,
17/// The build profile (e.g., debug or release).
18pub build_profile: &'static str,
19}
2021impl VersionInfo {
22/// This exposes reth's version information over prometheus.
23pub fn register_version_metrics(&self) {
24let labels: [(&str, &str); 6] = [
25 ("version", self.version),
26 ("build_timestamp", self.build_timestamp),
27 ("cargo_features", self.cargo_features),
28 ("git_sha", self.git_sha),
29 ("target_triple", self.target_triple),
30 ("build_profile", self.build_profile),
31 ];
3233let _gauge = gauge!("info", &labels);
34 }
35}