Skip to content

Commit

Permalink
fix(config): make metrics_level opt backward compatible (#12541)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 authored Sep 27, 2023
1 parent d583594 commit 0726b59
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 27 deletions.
2 changes: 0 additions & 2 deletions ci/scripts/standalone-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ start_standalone() {
--listen-addr 127.0.0.1:5688 \
--prometheus-listener-addr 127.0.0.1:1222 \
--advertise-addr 127.0.0.1:5688 \
--metrics-level info \
--async-stack-trace verbose \
--connector-rpc-endpoint 127.0.0.1:50051 \
--parallelism 4 \
Expand All @@ -36,7 +35,6 @@ start_standalone() {
--advertise-addr 127.0.0.1:4566 \
--prometheus-listener-addr 127.0.0.1:2222 \
--health-check-listener-addr 127.0.0.1:6786 \
--metrics-level info \
--meta-addr http://127.0.0.1:5690" >"$1" 2>&1
}

Expand Down
6 changes: 0 additions & 6 deletions docker/docker-compose-with-hdfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ services:
- "compactor-0:6660"
- "--prometheus-listener-addr"
- "0.0.0.0:1260"
- "--metrics-level"
- "info"
- "--meta-address"
- "http://meta-node-0:5690"
- "--config-path"
Expand Down Expand Up @@ -46,8 +44,6 @@ services:
- "compute-node-0:5688"
- "--prometheus-listener-addr"
- "0.0.0.0:1222"
- "--metrics-level"
- "info"
- "--meta-address"
- "http://meta-node-0:5690"
- "--connector-rpc-endpoint"
Expand Down Expand Up @@ -136,8 +132,6 @@ services:
- /risingwave.toml
- "--prometheus-listener-addr"
- "0.0.0.0:2222"
- "--metrics-level"
- "info"
expose:
- "4566"
ports:
Expand Down
6 changes: 0 additions & 6 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ services:
- "compactor-0:6660"
- "--prometheus-listener-addr"
- "0.0.0.0:1260"
- "--metrics-level"
- "info"
- "--meta-address"
- "http://meta-node-0:5690"
- "--config-path"
Expand Down Expand Up @@ -48,8 +46,6 @@ services:
- "compute-node-0:5688"
- "--prometheus-listener-addr"
- "0.0.0.0:1222"
- "--metrics-level"
- "info"
- "--meta-address"
- "http://meta-node-0:5690"
- "--connector-rpc-endpoint"
Expand Down Expand Up @@ -139,8 +135,6 @@ services:
- /risingwave.toml
- "--prometheus-listener-addr"
- "0.0.0.0:2222"
- "--metrics-level"
- "info"
expose:
- "4566"
ports:
Expand Down
2 changes: 0 additions & 2 deletions src/cmd_all/scripts/standalone-demo-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ cargo run -p risingwave_cmd_all \
--listen-addr 127.0.0.1:5688 \
--prometheus-listener-addr 127.0.0.1:1222 \
--advertise-addr 127.0.0.1:5688 \
--metrics-level info \
--async-stack-trace verbose \
--connector-rpc-endpoint 127.0.0.1:50051 \
--parallelism 4 \
Expand All @@ -35,5 +34,4 @@ cargo run -p risingwave_cmd_all \
--advertise-addr 127.0.0.1:4566 \
--prometheus-listener-addr 127.0.0.1:2222 \
--health-check-listener-addr 127.0.0.1:6786 \
--metrics-level info \
--meta-addr http://127.0.0.1:5690"
2 changes: 0 additions & 2 deletions src/cmd_all/scripts/standalone-demo-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ start_standalone() {
--listen-addr 127.0.0.1:5688 \
--prometheus-listener-addr 127.0.0.1:1222 \
--advertise-addr 127.0.0.1:5688 \
--metrics-level info \
--async-stack-trace verbose \
--connector-rpc-endpoint 127.0.0.1:50051 \
--parallelism 4 \
Expand All @@ -42,7 +41,6 @@ start_standalone() {
--advertise-addr 127.0.0.1:4566 \
--prometheus-listener-addr 127.0.0.1:2222 \
--health-check-listener-addr 127.0.0.1:6786 \
--metrics-level info \
--meta-addr http://127.0.0.1:5690"
}

Expand Down
17 changes: 16 additions & 1 deletion src/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ pub struct StreamingConfig {
pub unrecognized: Unrecognized<Self>,
}

#[derive(Debug, Default, Clone, Copy, ValueEnum, Serialize, Deserialize)]
#[derive(Debug, Default, Clone, Copy, Serialize, Deserialize)]
pub enum MetricLevel {
#[default]
Disabled = 0,
Expand All @@ -431,6 +431,21 @@ pub enum MetricLevel {
Debug = 3,
}

impl clap::ValueEnum for MetricLevel {
fn value_variants<'a>() -> &'a [Self] {
&[Self::Disabled, Self::Critical, Self::Info, Self::Debug]
}

fn to_possible_value<'a>(&self) -> ::std::option::Option<clap::builder::PossibleValue> {
match self {
Self::Disabled => Some(clap::builder::PossibleValue::new("disabled").alias("0")),
Self::Critical => Some(clap::builder::PossibleValue::new("critical")),
Self::Info => Some(clap::builder::PossibleValue::new("info").alias("1")),
Self::Debug => Some(clap::builder::PossibleValue::new("debug")),
}
}
}

impl PartialEq<Self> for MetricLevel {
fn eq(&self, other: &Self) -> bool {
(*self as u8).eq(&(*other as u8))
Expand Down
4 changes: 1 addition & 3 deletions src/risedevtool/src/task/compactor_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ impl CompactorService {
config.listen_address, config.exporter_port
))
.arg("--advertise-addr")
.arg(format!("{}:{}", config.address, config.port))
.arg("--metrics-level")
.arg("info");
.arg(format!("{}:{}", config.address, config.port));
if let Some(compaction_worker_threads_number) =
config.compaction_worker_threads_number.as_ref()
{
Expand Down
2 changes: 0 additions & 2 deletions src/risedevtool/src/task/compute_node_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ impl ComputeNodeService {
))
.arg("--advertise-addr")
.arg(format!("{}:{}", config.address, config.port))
.arg("--metrics-level")
.arg("info")
.arg("--async-stack-trace")
.arg(&config.async_stack_trace)
.arg("--connector-rpc-endpoint")
Expand Down
4 changes: 1 addition & 3 deletions src/risedevtool/src/task/frontend_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ impl FrontendService {
.arg(format!(
"{}:{}",
config.listen_address, config.health_check_port
))
.arg("--metrics-level")
.arg("info");
));

let provide_meta_node = config.provide_meta_node.as_ref().unwrap();
if provide_meta_node.is_empty() {
Expand Down

0 comments on commit 0726b59

Please sign in to comment.