-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce janus_main
#176
Introduce janus_main
#176
Conversation
For #105, I am going to need to add |
511ee5a
to
cb14bef
Compare
#[structopt( | ||
name = "janus-aggregator", | ||
about = "PPM aggregator server", | ||
rename_all = "kebab-case", | ||
version = env!("CARGO_PKG_VERSION"), | ||
)] | ||
struct Options { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This struct (and the equivalent ones in aggregation_job_driver.rs
and aggregation_job_creator.rs
exist solely so we can provide a #[structopt(...)]
block with the name
and about
values.
janus_server/src/binary_utils.rs
Outdated
fn common_options(&self) -> &CommonBinaryOptions; | ||
} | ||
|
||
// Common options that are used by all Janus binaries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is deliberately not a doccomment to work around a known issue in structopt. It's not clear if/when that will be fixed, but in any case, I learned today that structopt has been deprecated in favor of functionality built into clap
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
// Common options that are used by all Janus binaries. | |
#[cfg_attr(doc, doc = "Common options that are used by all Janus binaries.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works, thanks!
janus_server/src/binary_utils.rs
Outdated
let _metrics_exporter = install_metrics_exporter(config.metrics_config()) | ||
.context("failed to install metrics exporter")?; | ||
|
||
info!(?common_options, ?config, "Starting aggregation job creator"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this info line refers to the aggregation job creator specifically; I suspect we can get away without referencing which job is starting up, so the easiest fix might be to just change the string to something like "Starting up"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think in practice it'll be obvious which binary logged this because the log event will be annotated with a Kubernetes pod or deployment.
janus_server/src/binary_utils.rs
Outdated
fn common_options(&self) -> &CommonBinaryOptions; | ||
} | ||
|
||
// Common options that are used by all Janus binaries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
// Common options that are used by all Janus binaries. | |
#[cfg_attr(doc, doc = "Common options that are used by all Janus binaries.")] |
Factors out common binary startup work like parsing options and config, setting up metrics and logging and setting up a datastore connection into a function `binary_utils::janus_main`.
cb14bef
to
4571d84
Compare
Factors out common binary startup work like parsing options and config,
setting up metrics and logging and setting up a datastore connection
into a function
binary_utils::janus_main
.