mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-21 15:41:02 +00:00
Initialize metrics exporter earlier (fix #389)
This commit is contained in:
parent
7a901f7aab
commit
782630fc27
3 changed files with 15 additions and 5 deletions
|
@ -137,8 +137,8 @@ let
|
||||||
/* [2] */ hardeningDisable = [ "pie" ];
|
/* [2] */ hardeningDisable = [ "pie" ];
|
||||||
};
|
};
|
||||||
overrideArgs = old: {
|
overrideArgs = old: {
|
||||||
/* [4] */ features = [ "bundled-libs" "sled" ]
|
/* [4] */ features = [ "bundled-libs" "sled" "metrics" ]
|
||||||
++ (if release then [ "kubernetes-discovery" "telemetry-otlp" "metrics" "lmdb" "sqlite" ] else []);
|
++ (if release then [ "kubernetes-discovery" "telemetry-otlp" "lmdb" "sqlite" ] else []);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,10 @@ pub struct AdminApiServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AdminApiServer {
|
impl AdminApiServer {
|
||||||
pub fn new(garage: Arc<Garage>) -> Self {
|
pub fn new(
|
||||||
|
garage: Arc<Garage>,
|
||||||
|
#[cfg(feature = "metrics")] exporter: PrometheusExporter,
|
||||||
|
) -> Self {
|
||||||
let cfg = &garage.config.admin;
|
let cfg = &garage.config.admin;
|
||||||
let metrics_token = cfg
|
let metrics_token = cfg
|
||||||
.metrics_token
|
.metrics_token
|
||||||
|
@ -47,7 +50,7 @@ impl AdminApiServer {
|
||||||
Self {
|
Self {
|
||||||
garage,
|
garage,
|
||||||
#[cfg(feature = "metrics")]
|
#[cfg(feature = "metrics")]
|
||||||
exporter: opentelemetry_prometheus::exporter().init(),
|
exporter,
|
||||||
metrics_token,
|
metrics_token,
|
||||||
admin_token,
|
admin_token,
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
|
||||||
|
|
||||||
// ---- Initialize Garage internals ----
|
// ---- Initialize Garage internals ----
|
||||||
|
|
||||||
|
#[cfg(feature = "metrics")]
|
||||||
|
let metrics_exporter = opentelemetry_prometheus::exporter().init();
|
||||||
|
|
||||||
info!("Initializing background runner...");
|
info!("Initializing background runner...");
|
||||||
let watch_cancel = netapp::util::watch_ctrl_c();
|
let watch_cancel = netapp::util::watch_ctrl_c();
|
||||||
let (background, await_background_done) = BackgroundRunner::new(16, watch_cancel.clone());
|
let (background, await_background_done) = BackgroundRunner::new(16, watch_cancel.clone());
|
||||||
|
@ -50,7 +53,11 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Initialize Admin API server and metrics collector...");
|
info!("Initialize Admin API server and metrics collector...");
|
||||||
let admin_server = AdminApiServer::new(garage.clone());
|
let admin_server = AdminApiServer::new(
|
||||||
|
garage.clone(),
|
||||||
|
#[cfg(feature = "metrics")]
|
||||||
|
metrics_exporter,
|
||||||
|
);
|
||||||
|
|
||||||
info!("Launching internal Garage cluster communications...");
|
info!("Launching internal Garage cluster communications...");
|
||||||
let run_system = tokio::spawn(garage.system.clone().run(watch_cancel.clone()));
|
let run_system = tokio::spawn(garage.system.clone().run(watch_cancel.clone()));
|
||||||
|
|
Loading…
Reference in a new issue