feat: Add an ingester2 command behind the rpc_write feature flag

pull/24376/head
Carol (Nichols || Goulding) 2022-11-30 16:26:05 -05:00
parent fa4d6810a4
commit fc694e7273
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,35 @@
//! Command line options for running an ingester for a router using the RPC write path to talk to.
use clap_blocks::run_config::RunConfig;
use observability_deps::tracing::*;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {}
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, clap::Parser)]
#[clap(
name = "run",
about = "Runs in ingester mode",
long_about = "Run the IOx ingester server.\n\nThe configuration options below can be \
set either with the command line flags or with the specified environment \
variable. If there is a file named '.env' in the current working directory, \
it is sourced before loading the configuration.
Configuration is loaded from the following sources (highest precedence first):
- command line arguments
- user set environment variables
- .env file contents
- pre-configured default values"
)]
pub struct Config {
#[clap(flatten)]
pub(crate) run_config: RunConfig,
}
pub async fn command(_config: Config) -> Result<()> {
info!("starting ingester2");
Ok(())
}

View File

@ -5,6 +5,8 @@ pub(crate) mod all_in_one;
mod compactor;
mod garbage_collector;
mod ingester;
#[cfg(feature = "rpc_write")]
mod ingester2;
mod main;
mod querier;
mod router;
@ -34,6 +36,10 @@ pub enum Error {
#[snafu(display("Error in ingester subcommand: {}", source))]
IngesterError { source: ingester::Error },
#[cfg(feature = "rpc_write")]
#[snafu(display("Error in ingester2 subcommand: {}", source))]
Ingester2Error { source: ingester2::Error },
#[snafu(display("Error in all in one subcommand: {}", source))]
AllInOneError { source: all_in_one::Error },
@ -64,6 +70,8 @@ impl Config {
#[cfg(feature = "rpc_write")]
Some(Command::RouterRpcWrite(config)) => config.run_config.logging_config(),
Some(Command::Ingester(config)) => config.run_config.logging_config(),
#[cfg(feature = "rpc_write")]
Some(Command::Ingester2(config)) => config.run_config.logging_config(),
Some(Command::AllInOne(config)) => &config.logging_config,
Some(Command::Test(config)) => config.run_config.logging_config(),
}
@ -88,6 +96,10 @@ enum Command {
/// Run the server in ingester mode
Ingester(ingester::Config),
/// Run the server in ingester2 mode
#[cfg(feature = "rpc_write")]
Ingester2(ingester2::Config),
/// Run the server in "all in one" mode (Default)
AllInOne(all_in_one::Config),
@ -116,6 +128,10 @@ pub async fn command(config: Config) -> Result<()> {
.await
.context(RouterRpcWriteSnafu),
Some(Command::Ingester(config)) => ingester::command(config).await.context(IngesterSnafu),
#[cfg(feature = "rpc_write")]
Some(Command::Ingester2(config)) => {
ingester2::command(config).await.context(Ingester2Snafu)
}
Some(Command::AllInOne(config)) => all_in_one::command(config).await.context(AllInOneSnafu),
Some(Command::Test(config)) => test::command(config).await.context(TestSnafu),
}