Skip to content

Commit

Permalink
feat(msd): adding option to start with just staging (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaMilosa authored Sep 16, 2024
1 parent dfee9b0 commit 4baf7d7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions rs/ic-observability/multiservice-discovery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::vec;
use axum_otel_metrics::HttpMetricsLayerBuilder;
use clap::Parser;
use humantime::parse_duration;
use ic_management_types::Network;
use slog::{error, info, o, Drain, Logger};
use tokio::runtime::Runtime;
use tokio::sync::oneshot::{self};
Expand Down Expand Up @@ -41,6 +42,19 @@ fn main() {
)
}

fn get_staging_definition(cli_args: &CliArgs, log: Logger) -> Definition {
let staging = Network::staging_unchecked().unwrap();
Definition::new(
staging.get_nns_urls().clone(),
cli_args.targets_dir.clone(),
staging.name.clone(),
log.clone(),
None,
cli_args.poll_interval,
cli_args.registry_query_timeout,
)
}

if cli_args.render_prom_targets_to_stdout {
async fn sync(cli_args: &CliArgs, log: &Logger, shutdown_signal: impl futures_util::Future<Output = ()>) -> Option<RunningDefinition> {
let def = get_mainnet_definition(cli_args, log.clone());
Expand Down Expand Up @@ -102,6 +116,16 @@ fn main() {
)
.await;
});
} else if cli_args.start_with_staging {
rt.block_on(async {
let _ = supervisor
.start(
vec![get_staging_definition(&cli_args, log.clone())],
StartMode::AddToDefinitions,
metrics.running_definition_metrics.clone(),
)
.await;
})
}

//Configure server
Expand Down Expand Up @@ -195,6 +219,16 @@ Start the discovery without the IC Mainnet target.
)]
start_without_mainnet: bool,

#[clap(
long = "start-with-staging",
default_value = "false",
action,
help = r#"
Start the discovery with the IC Staging target.
"#
)]
start_with_staging: bool,

#[clap(
long = "render-prom-targets-to-stdout",
default_value = "false",
Expand Down

0 comments on commit 4baf7d7

Please sign in to comment.