From 53eab7f11554b106cd64758a9c7276d1eea2e18d Mon Sep 17 00:00:00 2001 From: MrCroxx Date: Tue, 25 Jun 2024 11:28:27 +0800 Subject: [PATCH] refactor(meta): add system parameters for minitrace Signed-off-by: MrCroxx --- proto/meta.proto | 3 +++ src/common/src/system_param/mod.rs | 8 +++++++- src/common/src/system_param/reader.rs | 12 ++++++++++++ src/config/docs.md | 3 +++ src/config/example.toml | 3 +++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/proto/meta.proto b/proto/meta.proto index 4a67dd0455e5c..c1187eabb1014 100644 --- a/proto/meta.proto +++ b/proto/meta.proto @@ -603,6 +603,9 @@ message SystemParams { optional string wasm_storage_url = 14 [deprecated = true]; optional bool enable_tracing = 15; optional bool use_new_object_prefix_strategy = 16; + optional bool minitrace = 17; + optional uint32 minitrace_tiered_cache_read_ms = 18; + optional uint32 minitrace_tiered_cache_write_ms = 19; } message GetSystemParamsRequest {} diff --git a/src/common/src/system_param/mod.rs b/src/common/src/system_param/mod.rs index c8382d35fee81..9b5cd457293de 100644 --- a/src/common/src/system_param/mod.rs +++ b/src/common/src/system_param/mod.rs @@ -87,7 +87,10 @@ macro_rules! for_all_params { { max_concurrent_creating_streaming_jobs, u32, Some(1_u32), true, "Max number of concurrent creating streaming jobs.", }, { pause_on_next_bootstrap, bool, Some(false), true, "Whether to pause all data sources on next bootstrap.", }, { enable_tracing, bool, Some(false), true, "Whether to enable distributed tracing.", }, - { use_new_object_prefix_strategy, bool, None, false, "Whether to split object prefix.", }, + { use_new_object_prefix_strategy, bool, None, false, "Whether to split object prefix.", }, + { minitrace, bool, Some(false), true, "Whether to enable minitrace tracing.", }, + { minitrace_tiered_cache_read_ms, u32, Some(1000), true, "Threshold to record tiered cache read with minitrace.", }, + { minitrace_tiered_cache_write_ms, u32, Some(1000), true, "Threshold to record tiered cache write with minitrace.", }, } }; } @@ -444,6 +447,9 @@ mod tests { (PAUSE_ON_NEXT_BOOTSTRAP_KEY, "false"), (ENABLE_TRACING_KEY, "true"), (USE_NEW_OBJECT_PREFIX_STRATEGY_KEY, "false"), + (MINITRACE_KEY, "false"), + (MINITRACE_TIERED_CACHE_READ_MS_KEY, "1000"), + (MINITRACE_TIERED_CACHE_WRITE_MS_KEY, "1000"), ("a_deprecated_param", "foo"), ]; diff --git a/src/common/src/system_param/reader.rs b/src/common/src/system_param/reader.rs index 9a2c6e49534af..0c39ed2be28fe 100644 --- a/src/common/src/system_param/reader.rs +++ b/src/common/src/system_param/reader.rs @@ -168,4 +168,16 @@ where .enable_tracing .unwrap_or_else(default::enable_tracing) } + + fn minitrace(&self) -> bool { + self.inner().minitrace.unwrap_or(false) + } + + fn minitrace_tiered_cache_read_ms(&self) -> u32 { + self.inner().minitrace_tiered_cache_read_ms.unwrap_or(1000) + } + + fn minitrace_tiered_cache_write_ms(&self) -> u32 { + self.inner().minitrace_tiered_cache_write_ms.unwrap_or(1000) + } } diff --git a/src/config/docs.md b/src/config/docs.md index c473e68a8bfdd..fa8fc7a373c15 100644 --- a/src/config/docs.md +++ b/src/config/docs.md @@ -165,6 +165,9 @@ This page is automatically generated by `./risedev generate-example-config` | data_directory | Remote directory for storing data and metadata objects. | | | enable_tracing | Whether to enable distributed tracing. | false | | max_concurrent_creating_streaming_jobs | Max number of concurrent creating streaming jobs. | 1 | +| minitrace | Whether to enable minitrace tracing. | false | +| minitrace_tiered_cache_read_ms | Threshold to record tiered cache read with minitrace. | 1000 | +| minitrace_tiered_cache_write_ms | Threshold to record tiered cache write with minitrace. | 1000 | | parallel_compact_size_mb | The size of parallel task for one compact/flush job. | 512 | | pause_on_next_bootstrap | Whether to pause all data sources on next bootstrap. | false | | sstable_size_mb | Target size of the Sstable. | 256 | diff --git a/src/config/example.toml b/src/config/example.toml index 27ffd9653be11..d40962e15805b 100644 --- a/src/config/example.toml +++ b/src/config/example.toml @@ -242,3 +242,6 @@ bloom_false_positive = 0.001 max_concurrent_creating_streaming_jobs = 1 pause_on_next_bootstrap = false enable_tracing = false +minitrace = false +minitrace_tiered_cache_read_ms = 1000 +minitrace_tiered_cache_write_ms = 1000