mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-22 08:01:02 +00:00
Merge pull request 'rpc/system_metrics.rs: Added rustversion label to garage_build_info metric.' (#524) from jpds/garage:rustversion-label into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/524
This commit is contained in:
commit
7fcc153e7c
8 changed files with 28 additions and 6 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1309,6 +1309,7 @@ dependencies = [
|
||||||
"opentelemetry",
|
"opentelemetry",
|
||||||
"rand",
|
"rand",
|
||||||
"rmp-serde",
|
"rmp-serde",
|
||||||
|
"rustc_version",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.6",
|
"sha2 0.10.6",
|
||||||
|
|
|
@ -32,7 +32,7 @@ args@{
|
||||||
ignoreLockHash,
|
ignoreLockHash,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
nixifiedLockHash = "12ff12e9210c87ac93e2f2bdb7007b6232e7efcfa302c272bf0caee6e78abd10";
|
nixifiedLockHash = "d36a8590fdf6eeb128a5a852d55945b595d5830291ad0aca95a21dcc1fab8681";
|
||||||
workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc;
|
workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc;
|
||||||
currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock);
|
currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock);
|
||||||
lockHashIgnored = if ignoreLockHash
|
lockHashIgnored = if ignoreLockHash
|
||||||
|
@ -1861,6 +1861,9 @@ in
|
||||||
devDependencies = {
|
devDependencies = {
|
||||||
mktemp = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".mktemp."0.5.0" { inherit profileName; }).out;
|
mktemp = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".mktemp."0.5.0" { inherit profileName; }).out;
|
||||||
};
|
};
|
||||||
|
buildDependencies = {
|
||||||
|
rustc_version = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.4.0" { profileName = "__noProfile"; }).out;
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
"unknown".garage_web."0.8.1" = overridableMkRustCrate (profileName: rec {
|
"unknown".garage_web."0.8.1" = overridableMkRustCrate (profileName: rec {
|
||||||
|
|
|
@ -20,6 +20,7 @@ pub async fn handle_get_cluster_status(garage: &Arc<Garage>) -> Result<Response<
|
||||||
node: hex::encode(garage.system.id),
|
node: hex::encode(garage.system.id),
|
||||||
garage_version: garage_util::version::garage_version(),
|
garage_version: garage_util::version::garage_version(),
|
||||||
garage_features: garage_util::version::garage_features(),
|
garage_features: garage_util::version::garage_features(),
|
||||||
|
rust_version: garage_util::version::rust_version(),
|
||||||
db_engine: garage.db.engine(),
|
db_engine: garage.db.engine(),
|
||||||
known_nodes: garage
|
known_nodes: garage
|
||||||
.system
|
.system
|
||||||
|
@ -106,6 +107,7 @@ struct GetClusterStatusResponse {
|
||||||
node: String,
|
node: String,
|
||||||
garage_version: &'static str,
|
garage_version: &'static str,
|
||||||
garage_features: Option<&'static [&'static str]>,
|
garage_features: Option<&'static [&'static str]>,
|
||||||
|
rust_version: &'static str,
|
||||||
db_engine: String,
|
db_engine: String,
|
||||||
known_nodes: HashMap<String, KnownNodeResp>,
|
known_nodes: HashMap<String, KnownNodeResp>,
|
||||||
layout: GetClusterLayoutResponse,
|
layout: GetClusterLayoutResponse,
|
||||||
|
|
|
@ -820,11 +820,12 @@ impl AdminRpcHandler {
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
writeln!(
|
writeln!(
|
||||||
&mut ret,
|
&mut ret,
|
||||||
"\nGarage version: {} [features: {}]",
|
"\nGarage version: {} [features: {}]\nRust compiler version: {}",
|
||||||
garage_util::version::garage_version(),
|
garage_util::version::garage_version(),
|
||||||
garage_util::version::garage_features()
|
garage_util::version::garage_features()
|
||||||
.map(|list| list.join(", "))
|
.map(|list| list.join(", "))
|
||||||
.unwrap_or_else(|| "(unknown)".into()),
|
.unwrap_or_else(|| "(unknown)".into()),
|
||||||
|
garage_util::version::rust_version(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@ impl SystemMetrics {
|
||||||
.u64_value_observer("garage_build_info", move |observer| {
|
.u64_value_observer("garage_build_info", move |observer| {
|
||||||
observer.observe(
|
observer.observe(
|
||||||
1,
|
1,
|
||||||
&[KeyValue::new(
|
&[
|
||||||
"version",
|
KeyValue::new("rustversion", garage_util::version::rust_version()),
|
||||||
garage_util::version::garage_version(),
|
KeyValue::new("version", garage_util::version::garage_version()),
|
||||||
)],
|
],
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.with_description("Garage build info")
|
.with_description("Garage build info")
|
||||||
|
|
|
@ -47,6 +47,9 @@ hyper = "0.14"
|
||||||
|
|
||||||
opentelemetry = { version = "0.17", features = [ "rt-tokio", "metrics", "trace" ] }
|
opentelemetry = { version = "0.17", features = [ "rt-tokio", "metrics", "trace" ] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
rustc_version = "0.4.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mktemp = "0.5"
|
mktemp = "0.5"
|
||||||
|
|
||||||
|
|
8
src/util/build.rs
Normal file
8
src/util/build.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use rustc_version::version;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Acquire the version of Rust used to compile, this is added as a label to
|
||||||
|
// the garage_build_info metric.
|
||||||
|
let v = version().unwrap();
|
||||||
|
println!("cargo:rustc-env=RUSTC_VERSION={v}");
|
||||||
|
}
|
|
@ -26,3 +26,7 @@ pub fn init_version(version: &'static str) {
|
||||||
pub fn init_features(features: &'static [&'static str]) {
|
pub fn init_features(features: &'static [&'static str]) {
|
||||||
FEATURES.store(Some(Arc::new(features)));
|
FEATURES.store(Some(Arc::new(features)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn rust_version() -> &'static str {
|
||||||
|
env!("RUSTC_VERSION")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue