aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Davies <jpds@protonmail.com>2023-01-09 17:15:55 +0000
committerJonathan Davies <jpds@protonmail.com>2023-01-10 10:39:50 +0000
commitdf1d9a98737e8a38656de8ac71bb23e8d3ad2ce9 (patch)
tree3cfb8c53794361c8779b37e657bb0ec23485b158 /src
parentaac348fe937442bcf750316d6ebd47936d86ed90 (diff)
downloadgarage-df1d9a98737e8a38656de8ac71bb23e8d3ad2ce9.tar.gz
garage-df1d9a98737e8a38656de8ac71bb23e8d3ad2ce9.zip
system.rs: Integrated SystemMetrics into System implementation.
Diffstat (limited to 'src')
-rw-r--r--src/rpc/system.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rpc/system.rs b/src/rpc/system.rs
index ed10aa4b..90f6a4c2 100644
--- a/src/rpc/system.rs
+++ b/src/rpc/system.rs
@@ -38,6 +38,9 @@ use crate::replication_mode::*;
use crate::ring::*;
use crate::rpc_helper::*;
+#[cfg(feature = "metrics")]
+use crate::system_metrics::*;
+
const DISCOVERY_INTERVAL: Duration = Duration::from_secs(60);
const STATUS_EXCHANGE_INTERVAL: Duration = Duration::from_secs(10);
@@ -103,6 +106,8 @@ pub struct System {
consul_discovery: Option<ConsulDiscovery>,
#[cfg(feature = "kubernetes-discovery")]
kubernetes_discovery: Option<KubernetesDiscoveryConfig>,
+ #[cfg(feature = "metrics")]
+ metrics: SystemMetrics,
replication_mode: ReplicationMode,
replication_factor: usize,
@@ -275,6 +280,9 @@ impl System {
cluster_layout_staging_hash: cluster_layout.staging_hash,
};
+ #[cfg(feature = "metrics")]
+ let metrics = SystemMetrics::new(replication_factor);
+
let ring = Ring::new(cluster_layout, replication_factor);
let (update_ring, ring) = watch::channel(Arc::new(ring));
@@ -365,6 +373,8 @@ impl System {
consul_discovery,
#[cfg(feature = "kubernetes-discovery")]
kubernetes_discovery: config.kubernetes_discovery.clone(),
+ #[cfg(feature = "metrics")]
+ metrics,
ring,
update_ring: Mutex::new(update_ring),