diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-17 23:28:23 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-14 10:52:13 +0100 |
commit | 8c2fb0c066af7f68fdcfcdec96fa030af059bf63 (patch) | |
tree | 58a416058e31eda2cdb3a15c07e565a9ad674857 /src/garage | |
parent | b6561f6e1bcb6a8de13a186405a480e356df89d8 (diff) | |
download | garage-8c2fb0c066af7f68fdcfcdec96fa030af059bf63.tar.gz garage-8c2fb0c066af7f68fdcfcdec96fa030af059bf63.zip |
Add tracing integration with opentelemetry
Diffstat (limited to 'src/garage')
-rw-r--r-- | src/garage/Cargo.toml | 2 | ||||
-rw-r--r-- | src/garage/cli/init.rs | 2 | ||||
-rw-r--r-- | src/garage/main.rs | 2 | ||||
-rw-r--r-- | src/garage/server.rs | 6 |
4 files changed, 8 insertions, 4 deletions
diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml index 22e0f0f0..351fa62f 100644 --- a/src/garage/Cargo.toml +++ b/src/garage/Cargo.toml @@ -32,7 +32,7 @@ garage_admin = { version = "0.6.0", path = "../admin" } bytes = "1.0" git-version = "0.3.4" hex = "0.4" -log = "0.4" +tracing = { version = "0.1.30", features = ["log-always"] } pretty_env_logger = "0.4" rand = "0.8" async-trait = "0.1.7" diff --git a/src/garage/cli/init.rs b/src/garage/cli/init.rs index 80283c8f..511b53a6 100644 --- a/src/garage/cli/init.rs +++ b/src/garage/cli/init.rs @@ -1,7 +1,5 @@ use std::path::PathBuf; -use log::warn; - use garage_util::error::*; pub const READ_KEY_ERROR: &str = "Unable to read node key. It will be generated by your garage node the first time is it launched. Ensure that your garage node is currently running. (The node key is supposed to be stored in your metadata directory.)"; diff --git a/src/garage/main.rs b/src/garage/main.rs index 870455e1..7de7740f 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -2,7 +2,7 @@ //! Garage CLI, used to interact with a running Garage instance, and to launch a Garage instance #[macro_use] -extern crate log; +extern crate tracing; mod admin; mod cli; diff --git a/src/garage/server.rs b/src/garage/server.rs index cd32d708..6ef36273 100644 --- a/src/garage/server.rs +++ b/src/garage/server.rs @@ -7,6 +7,7 @@ use garage_util::config::*; use garage_util::error::Error; use garage_admin::metrics::*; +use garage_admin::tracing_setup::*; use garage_api::run_api_server; use garage_model::garage::Garage; use garage_web::run_web_server; @@ -45,6 +46,11 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> { info!("Initializing Garage main data store..."); let garage = Garage::new(config.clone(), db, background); + info!("Initialize tracing..."); + if let Some(export_to) = config.admin_api.otlp_export_traces_to { + init_tracing(&export_to, garage.system.id)?; + } + let run_system = tokio::spawn(garage.system.clone().run(watch_cancel.clone())); info!("Create admin RPC handler..."); |