diff --git a/Cargo.lock b/Cargo.lock index fcce5f2c9db4..fbe3e1f2893a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2430,12 +2430,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "cache-padded" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "981520c98f422fcc584dc1a95c334e6953900b9106bc47a9839b81790009eb21" - [[package]] name = "camino" version = "1.1.9" @@ -2809,9 +2803,9 @@ dependencies = [ [[package]] name = "cmsketch" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17a94b4d5dca45a6aa85960fbb1d60096203102716732e8997515cc8ff2b6fff" +checksum = "aeccf706e341a5fcdc7f309af21f75eb4dd68fd7474e171bfe1a5570ea48307a" dependencies = [ "paste", ] @@ -4606,6 +4600,46 @@ dependencies = [ "serde", ] +[[package]] +name = "fastrace" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25767929385a5128ff5a58c77d5fef43779bb580656801f72d4d32f7a97fea28" +dependencies = [ + "fastrace-macro", + "minstant", + "once_cell", + "parking_lot 0.12.1", + "pin-project", + "rand", + "rtrb", +] + +[[package]] +name = "fastrace-macro" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11870c0168b3d10fc7a7f0b6f9319fd7244d4caacc669ae86b3ecc5b6ca1b8c" +dependencies = [ + "proc-macro-error 1.0.4", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "fastrace-opentelemetry" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f33f99bae33fb7b952a933500e77cb9976b7672bb5d9def8e464663dfdfc107" +dependencies = [ + "fastrace", + "futures", + "log", + "opentelemetry", + "opentelemetry_sdk", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -4815,49 +4849,47 @@ dependencies = [ [[package]] name = "foyer" -version = "0.10.4" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca1a3a9bf97a9d592d69c2210c5524668788f72ef1b7ea3054cfc1f8a3fb1257" +checksum = "9becaef8b57eaf4b229b04d3298b689f93e6e47af8b64a4626c26284698c57cf" dependencies = [ "ahash 0.8.11", "anyhow", + "fastrace", "foyer-common", "foyer-memory", "foyer-storage", "futures", "madsim-tokio", - "minitrace", "pin-project", "tracing", ] [[package]] name = "foyer-common" -version = "0.8.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e109f1fd012cc2f0785db5711c73c388fca2d2ac6e2aabb4eaa3a8af98b4dcdb" +checksum = "b1f9cf220e4a7377ce73058d9a94daa0e3bf5d73381d10271c4ff78ba7854949" dependencies = [ "bytes", "cfg-if", "crossbeam", + "fastrace", "futures", "hashbrown 0.14.3", "itertools 0.13.0", "madsim-tokio", "metrics", - "minitrace", - "nix 0.29.0", "parking_lot 0.12.1", "pin-project", - "rustversion", "serde", ] [[package]] name = "foyer-intrusive" -version = "0.8.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7ad91ad11f2c94bb4b3b88acd447f3145224415d776f163d2b06a9ed24e63a" +checksum = "8dc9a7709b14917fc900fa0a255d7f58987d5f085edef61c5560e97d268450c6" dependencies = [ "foyer-common", "itertools 0.13.0", @@ -4865,21 +4897,20 @@ dependencies = [ [[package]] name = "foyer-memory" -version = "0.6.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29273589433f89d61347b196754bfa22357420d1adbf815d354c23512106a194" +checksum = "3e380013e4a5df7019a3c334732789f0affd0eae8fb75fd5d483b1cc76fe1cb4" dependencies = [ "ahash 0.8.11", "bitflags 2.6.0", "cmsketch", + "fastrace", "foyer-common", "foyer-intrusive", "futures", "hashbrown 0.14.3", "itertools 0.13.0", - "libc", "madsim-tokio", - "minitrace", "parking_lot 0.12.1", "pin-project", "serde", @@ -4888,9 +4919,9 @@ dependencies = [ [[package]] name = "foyer-storage" -version = "0.9.3" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f533cf09e39963cc3886f9f165d235c7d4f937f4b09b48c09827ac158876f4" +checksum = "1aa77365ba93fea4de7b3fcd510c52ccdcd4ff7b402dde0a0fa0822437b13b01" dependencies = [ "ahash 0.8.11", "allocator-api2", @@ -4900,16 +4931,17 @@ dependencies = [ "bincode 1.3.3", "bitflags 2.6.0", "bytes", + "clap", "either", + "fastrace", "foyer-common", "foyer-memory", + "fs4", "futures", "itertools 0.13.0", - "lazy_static", "libc", "lz4", "madsim-tokio", - "minitrace", "parking_lot 0.12.1", "pin-project", "rand", @@ -5008,6 +5040,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "fs4" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c6b3bd49c37d2aa3f3f2220233b29a7cd23f79d1fe70e5337d25fb390793de" +dependencies = [ + "rustix 0.38.31", + "windows-sys 0.52.0", +] + [[package]] name = "fs_extra" version = "1.3.0" @@ -7189,46 +7231,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "minitrace" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197d538cd69839d49a593c8c72df44291b0ea3296ecc0c85529002c53c8fbc6f" -dependencies = [ - "minitrace-macro", - "minstant", - "once_cell", - "parking_lot 0.12.1", - "pin-project", - "rand", - "rtrb", -] - -[[package]] -name = "minitrace-macro" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14efd4b574325fcb981bce1ac700b9ccf071ec2eb94f7a6a6b583a84f228ba47" -dependencies = [ - "proc-macro-error 1.0.4", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "minitrace-opentelemetry" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabb581e91af60aab44f6d49ee70646c87162ad25224cd6184ae67cfca08db05" -dependencies = [ - "futures", - "log", - "minitrace", - "opentelemetry", - "opentelemetry_sdk", -] - [[package]] name = "miniz_oxide" version = "0.7.2" @@ -8027,9 +8029,9 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b69a91d4893e713e06f724597ad630f1fa76057a5e1026c0ca67054a9032a76" +checksum = "4c365a63eec4f55b7efeceb724f1336f26a9cf3427b70e59e2cd2a5b947fba96" dependencies = [ "futures-core", "futures-sink", @@ -8041,57 +8043,56 @@ dependencies = [ [[package]] name = "opentelemetry-otlp" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a94c69209c05319cdf7460c6d4c055ed102be242a0a6245835d7bc42c6ec7f54" +checksum = "6b925a602ffb916fb7421276b86756027b37ee708f9dce2dbdcc51739f07e727" dependencies = [ "async-trait", "futures-core", - "http 0.2.9", + "http 1.1.0", "opentelemetry", "opentelemetry-proto", "opentelemetry_sdk", - "prost 0.12.1", + "prost 0.13.1", "thiserror", "tokio", - "tonic 0.11.0", + "tonic 0.12.1", ] [[package]] name = "opentelemetry-proto" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984806e6cf27f2b49282e2a05e288f30594f3dbc74eb7a6e99422bc48ed78162" +checksum = "30ee9f20bff9c984511a02f082dc8ede839e4a9bf15cc2487c8d6fea5ad850d9" dependencies = [ "opentelemetry", "opentelemetry_sdk", - "prost 0.12.1", - "tonic 0.11.0", + "prost 0.13.1", + "tonic 0.12.1", ] [[package]] name = "opentelemetry-semantic-conventions" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1869fb4bb9b35c5ba8a1e40c9b128a7b4c010d07091e864a29da19e4fe2ca4d7" +checksum = "1cefe0543875379e47eb5f1e68ff83f45cc41366a92dfd0d073d513bf68e9a05" [[package]] name = "opentelemetry_sdk" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae312d58eaa90a82d2e627fd86e075cf5230b3f11794e2ed74199ebbe572d4fd" +checksum = "692eac490ec80f24a17828d49b40b60f5aeaccdfe6a503f939713afd22bc28df" dependencies = [ "async-trait", "futures-channel", "futures-executor", "futures-util", "glob", - "lazy_static", "once_cell", "opentelemetry", - "ordered-float 4.1.1", "percent-encoding", "rand", + "serde_json", "thiserror", "tokio", "tokio-stream 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -11543,11 +11544,11 @@ dependencies = [ "console", "console-subscriber", "either", + "fastrace", + "fastrace-opentelemetry", "futures", "hostname 0.4.0", "madsim-tokio", - "minitrace", - "minitrace-opentelemetry", "opentelemetry", "opentelemetry-otlp", "opentelemetry-semantic-conventions", @@ -11967,12 +11968,9 @@ dependencies = [ [[package]] name = "rtrb" -version = "0.2.3" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e704dd104faf2326a320140f70f0b736d607c1caa1b1748a6c568a79819109" -dependencies = [ - "cache-padded", -] +checksum = "f3f94e84c073f3b85d4012b44722fa8842b9986d741590d4f2636ad0a5b14143" [[package]] name = "rumqttc" @@ -14416,33 +14414,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tonic" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" -dependencies = [ - "async-stream", - "async-trait", - "axum 0.6.20", - "base64 0.21.7", - "bytes", - "h2 0.3.26", - "http 0.2.9", - "http-body 0.4.5", - "hyper 0.14.27", - "hyper-timeout 0.4.1", - "percent-encoding", - "pin-project", - "prost 0.12.1", - "tokio", - "tokio-stream 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tonic" version = "0.12.1" @@ -14618,9 +14589,9 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f68803492bf28ab40aeccaecc7021096bd256baf7ca77c3d425d89b35a7be4e4" +checksum = "a9784ed4da7d921bc8df6963f8c80a0e4ce34ba6ba76668acadd3edbd985ff3b" dependencies = [ "js-sys", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index c34b414ad0a7..b613dc2d4821 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,7 @@ license = "Apache-2.0" repository = "https://github.com/risingwavelabs/risingwave" [workspace.dependencies] -foyer = { version = "0.10.4", features = ["nightly", "mtrace"] } +foyer = { version = "0.11.3", features = ["mtrace", "nightly"] } apache-avro = { git = "https://github.com/risingwavelabs/avro", rev = "25113ba88234a9ae23296e981d8302c290fdaa4b", features = [ "snappy", "zstandard", @@ -183,11 +183,10 @@ tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git" "profiling", "stats", ], rev = "64a2d9" } -# TODO(http-bump): bump to use tonic 0.12 once minitrace-opentelemetry is updated -opentelemetry = "0.23" -opentelemetry-otlp = "0.16" -opentelemetry_sdk = { version = "0.23", default-features = false } -opentelemetry-semantic-conventions = "0.15" +opentelemetry = "0.24" +opentelemetry-otlp = "0.17" +opentelemetry_sdk = { version = "0.24", default-features = false } +opentelemetry-semantic-conventions = "0.16" parking_lot = { version = "0.12", features = [ "arc_lock", "deadlock_detection", @@ -198,10 +197,24 @@ sea-orm = { version = "0.12.14", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", ] } -sqlx = { version = "0.7.3", default-features = false, features = ["bigdecimal", "chrono", "json", "mysql", "postgres", "runtime-tokio-native-tls", "rust_decimal", "sqlite", "time", "uuid"] } -tokio-stream = { git = "https://github.com/madsim-rs/tokio.git", rev = "0dd1055", features = ["net", "fs"] } +sqlx = { version = "0.7.3", default-features = false, features = [ + "bigdecimal", + "chrono", + "json", + "mysql", + "postgres", + "runtime-tokio-native-tls", + "rust_decimal", + "sqlite", + "time", + "uuid", +] } +tokio-stream = { git = "https://github.com/madsim-rs/tokio.git", rev = "0dd1055", features = [ + "net", + "fs", +] } tokio-util = "0.7" -tracing-opentelemetry = "0.24" +tracing-opentelemetry = "0.25" rand = { version = "0.8", features = ["small_rng"] } risingwave_backup = { path = "./src/storage/backup" } risingwave_batch = { path = "./src/batch" } diff --git a/src/common/src/config.rs b/src/common/src/config.rs index df106c8438b1..7e412909c5f2 100644 --- a/src/common/src/config.rs +++ b/src/common/src/config.rs @@ -24,7 +24,7 @@ use std::num::NonZeroUsize; use anyhow::Context; use clap::ValueEnum; use educe::Educe; -use foyer::{LfuConfig, LruConfig, RecoverMode, S3FifoConfig}; +use foyer::{Compression, LfuConfig, LruConfig, RecoverMode, RuntimeConfig, S3FifoConfig}; use risingwave_common_proc_macro::ConfigDoc; pub use risingwave_common_proc_macro::OverrideConfig; use risingwave_pb::meta::SystemParams; @@ -871,7 +871,7 @@ pub struct FileCacheConfig { pub indexer_shards: usize, #[serde(default = "default::file_cache::compression")] - pub compression: String, + pub compression: Compression, #[serde(default = "default::file_cache::flush_buffer_threshold_mb")] pub flush_buffer_threshold_mb: Option, @@ -888,6 +888,9 @@ pub struct FileCacheConfig { #[serde(default = "default::file_cache::recover_mode")] pub recover_mode: RecoverMode, + #[serde(default = "default::file_cache::runtime_config")] + pub runtime_config: RuntimeConfig, + #[serde(default, flatten)] #[config_doc(omitted)] pub unrecognized: Unrecognized, @@ -1702,7 +1705,7 @@ pub mod default { } pub mod file_cache { - use foyer::RecoverMode; + use foyer::{Compression, RecoverMode, RuntimeConfig, TokioRuntimeConfig}; pub fn dir() -> String { "".to_string() @@ -1736,8 +1739,8 @@ pub mod default { 64 } - pub fn compression() -> String { - "none".to_string() + pub fn compression() -> Compression { + Compression::None } pub fn flush_buffer_threshold_mb() -> Option { @@ -1747,6 +1750,10 @@ pub mod default { pub fn recover_mode() -> RecoverMode { RecoverMode::None } + + pub fn runtime_config() -> RuntimeConfig { + RuntimeConfig::Unified(TokioRuntimeConfig::default()) + } } pub mod cache_refill { diff --git a/src/config/example.toml b/src/config/example.toml index 7b8d5ab415d7..9a1a229df1cd 100644 --- a/src/config/example.toml +++ b/src/config/example.toml @@ -173,9 +173,13 @@ reclaimers = 4 recover_concurrency = 8 insert_rate_limit_mb = 0 indexer_shards = 64 -compression = "none" +compression = "None" recover_mode = "None" +[storage.data_file_cache.runtime_config.Unified] +worker_threads = 0 +max_blocking_threads = 0 + [storage.meta_file_cache] dir = "" capacity_mb = 1024 @@ -185,9 +189,13 @@ reclaimers = 4 recover_concurrency = 8 insert_rate_limit_mb = 0 indexer_shards = 64 -compression = "none" +compression = "None" recover_mode = "None" +[storage.meta_file_cache.runtime_config.Unified] +worker_threads = 0 +max_blocking_threads = 0 + [storage.cache_refill] data_refill_levels = [] timeout_ms = 6000 diff --git a/src/storage/src/opts.rs b/src/storage/src/opts.rs index a3a787f55c97..18a24aab55ae 100644 --- a/src/storage/src/opts.rs +++ b/src/storage/src/opts.rs @@ -92,8 +92,9 @@ pub struct StorageOpts { pub data_file_cache_recover_concurrency: usize, pub data_file_cache_insert_rate_limit_mb: usize, pub data_file_cache_indexer_shards: usize, - pub data_file_cache_compression: String, + pub data_file_cache_compression: foyer::Compression, pub data_file_cache_flush_buffer_threshold_mb: usize, + pub data_file_cache_runtime_config: foyer::RuntimeConfig, pub cache_refill_data_refill_levels: Vec, pub cache_refill_timeout_ms: u64, @@ -112,8 +113,9 @@ pub struct StorageOpts { pub meta_file_cache_recover_concurrency: usize, pub meta_file_cache_insert_rate_limit_mb: usize, pub meta_file_cache_indexer_shards: usize, - pub meta_file_cache_compression: String, + pub meta_file_cache_compression: foyer::Compression, pub meta_file_cache_flush_buffer_threshold_mb: usize, + pub meta_file_cache_runtime_config: foyer::RuntimeConfig, /// The storage url for storing backups. pub backup_storage_url: String, @@ -193,8 +195,9 @@ impl From<(&RwConfig, &SystemParamsReader, &StorageMemoryConfig)> for StorageOpt data_file_cache_recover_concurrency: c.storage.data_file_cache.recover_concurrency, data_file_cache_insert_rate_limit_mb: c.storage.data_file_cache.insert_rate_limit_mb, data_file_cache_indexer_shards: c.storage.data_file_cache.indexer_shards, - data_file_cache_compression: c.storage.data_file_cache.compression.clone(), + data_file_cache_compression: c.storage.data_file_cache.compression, data_file_cache_flush_buffer_threshold_mb: s.block_file_cache_flush_buffer_threshold_mb, + data_file_cache_runtime_config: c.storage.data_file_cache.runtime_config.clone(), meta_file_cache_dir: c.storage.meta_file_cache.dir.clone(), meta_file_cache_capacity_mb: c.storage.meta_file_cache.capacity_mb, meta_file_cache_file_capacity_mb: c.storage.meta_file_cache.file_capacity_mb, @@ -204,8 +207,9 @@ impl From<(&RwConfig, &SystemParamsReader, &StorageMemoryConfig)> for StorageOpt meta_file_cache_recover_concurrency: c.storage.meta_file_cache.recover_concurrency, meta_file_cache_insert_rate_limit_mb: c.storage.meta_file_cache.insert_rate_limit_mb, meta_file_cache_indexer_shards: c.storage.meta_file_cache.indexer_shards, - meta_file_cache_compression: c.storage.meta_file_cache.compression.clone(), + meta_file_cache_compression: c.storage.meta_file_cache.compression, meta_file_cache_flush_buffer_threshold_mb: s.meta_file_cache_flush_buffer_threshold_mb, + meta_file_cache_runtime_config: c.storage.meta_file_cache.runtime_config.clone(), cache_refill_data_refill_levels: c.storage.cache_refill.data_refill_levels.clone(), cache_refill_timeout_ms: c.storage.cache_refill.timeout_ms, cache_refill_concurrency: c.storage.cache_refill.concurrency, diff --git a/src/storage/src/store_impl.rs b/src/storage/src/store_impl.rs index d9261d67e24b..05b7dc705ce2 100644 --- a/src/storage/src/store_impl.rs +++ b/src/storage/src/store_impl.rs @@ -18,9 +18,7 @@ use std::sync::Arc; use std::time::Duration; use enum_as_inner::EnumAsInner; -use foyer::{ - DirectFsDeviceOptionsBuilder, HybridCacheBuilder, RateLimitPicker, RuntimeConfigBuilder, -}; +use foyer::{DirectFsDeviceOptionsBuilder, HybridCacheBuilder, RateLimitPicker}; use risingwave_common::monitor::GLOBAL_METRICS_REGISTRY; use risingwave_common_service::RpcNotificationClient; use risingwave_hummock_sdk::HummockSstableObjectId; @@ -663,17 +661,8 @@ impl StateStoreImpl { ) .with_recover_mode(opts.meta_file_cache_recover_mode) .with_recover_concurrency(opts.meta_file_cache_recover_concurrency) - .with_compression( - opts.meta_file_cache_compression - .as_str() - .try_into() - .map_err(HummockError::foyer_error)?, - ) - .with_runtime_config( - RuntimeConfigBuilder::new() - .with_thread_name("foyer.meta.runtime") - .build(), - ); + .with_compression(opts.meta_file_cache_compression) + .with_runtime_config(opts.meta_file_cache_runtime_config.clone()); if opts.meta_file_cache_insert_rate_limit_mb > 0 { builder = builder.with_admission_picker(Arc::new(RateLimitPicker::new( opts.meta_file_cache_insert_rate_limit_mb * MB, @@ -717,17 +706,8 @@ impl StateStoreImpl { ) .with_recover_mode(opts.data_file_cache_recover_mode) .with_recover_concurrency(opts.data_file_cache_recover_concurrency) - .with_compression( - opts.data_file_cache_compression - .as_str() - .try_into() - .map_err(HummockError::foyer_error)?, - ) - .with_runtime_config( - RuntimeConfigBuilder::new() - .with_thread_name("foyer.data.runtime") - .build(), - ); + .with_compression(opts.data_file_cache_compression) + .with_runtime_config(opts.data_file_cache_runtime_config.clone()); if opts.data_file_cache_insert_rate_limit_mb > 0 { builder = builder.with_admission_picker(Arc::new(RateLimitPicker::new( opts.data_file_cache_insert_rate_limit_mb * MB, diff --git a/src/utils/runtime/Cargo.toml b/src/utils/runtime/Cargo.toml index ff2902e7a4b4..44ad04bd40aa 100644 --- a/src/utils/runtime/Cargo.toml +++ b/src/utils/runtime/Cargo.toml @@ -58,8 +58,8 @@ opentelemetry_sdk = { workspace = true, features = [ "rt-tokio", ] } # only enable `rt-tokio` feature under non-madsim target workspace-hack = { path = "../../workspace-hack" } -minitrace = "0.6.7" -minitrace-opentelemetry = "0.6.7" +fastrace = "0.7" +fastrace-opentelemetry = "0.7" [lints] workspace = true diff --git a/src/utils/runtime/src/logger.rs b/src/utils/runtime/src/logger.rs index 8530a7c7a585..bf033ba23f33 100644 --- a/src/utils/runtime/src/logger.rs +++ b/src/utils/runtime/src/logger.rs @@ -18,8 +18,8 @@ use std::path::PathBuf; use std::time::Duration; use either::Either; -use minitrace_opentelemetry::OpenTelemetryReporter; -use opentelemetry::trace::SpanKind; +use fastrace_opentelemetry::OpenTelemetryReporter; +use opentelemetry::trace::{SpanKind, TracerProvider}; use opentelemetry::InstrumentationLibrary; use opentelemetry_sdk::Resource; use risingwave_common::metrics::MetricsLayer; @@ -444,6 +444,9 @@ pub fn init_risingwave_logger(settings: LoggerSettings) { // Installing the exporter requires a tokio runtime. let _entered = runtime.enter(); + // TODO(bugen): better service name + // https://github.com/jaegertracing/jaeger-ui/issues/336 + let service_name = format!("{}-{}", settings.name, id); let otel_tracer = opentelemetry_otlp::new_pipeline() .tracing() .with_exporter( @@ -451,19 +454,17 @@ pub fn init_risingwave_logger(settings: LoggerSettings) { .tonic() .with_endpoint(&endpoint), ) - .with_trace_config(sdk::trace::config().with_resource(sdk::Resource::new([ - KeyValue::new( - resource::SERVICE_NAME, - // TODO(bugen): better service name - // https://github.com/jaegertracing/jaeger-ui/issues/336 - format!("{}-{}", settings.name, id), - ), - KeyValue::new(resource::SERVICE_INSTANCE_ID, id.clone()), - KeyValue::new(resource::SERVICE_VERSION, env!("CARGO_PKG_VERSION")), - KeyValue::new(resource::PROCESS_PID, std::process::id().to_string()), - ]))) + .with_trace_config( + sdk::trace::Config::default().with_resource(sdk::Resource::new([ + KeyValue::new(resource::SERVICE_NAME, service_name.clone()), + KeyValue::new(resource::SERVICE_INSTANCE_ID, id.clone()), + KeyValue::new(resource::SERVICE_VERSION, env!("CARGO_PKG_VERSION")), + KeyValue::new(resource::PROCESS_PID, std::process::id().to_string()), + ])), + ) .install_batch(sdk::runtime::Tokio) - .unwrap(); + .unwrap() + .tracer(service_name); let exporter = opentelemetry_otlp::new_exporter() .tonic() @@ -512,7 +513,7 @@ pub fn init_risingwave_logger(settings: LoggerSettings) { layers.push(layer.boxed()); - // The reporter is used by minitrace in foyer for dynamically tail-based tracing. + // The reporter is used by fastrace in foyer for dynamically tail-based tracing. // // Code here only setup the OpenTelemetry reporter. To enable/disable the function, please use risectl. // @@ -526,12 +527,12 @@ pub fn init_risingwave_logger(settings: LoggerSettings) { SpanKind::Server, Cow::Owned(Resource::new([KeyValue::new( resource::SERVICE_NAME, - format!("minitrace-{id}"), + format!("fastrace-{id}"), )])), InstrumentationLibrary::builder("opentelemetry-instrumentation-foyer").build(), ); - minitrace::set_reporter(reporter, minitrace::collector::Config::default()); - tracing::info!("opentelemetry exporter for minitrace is set at {endpoint}"); + fastrace::set_reporter(reporter, fastrace::collector::Config::default()); + tracing::info!("opentelemetry exporter for fastrace is set at {endpoint}"); } // Metrics layer