mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-11-15 14:14:42 +00:00
Install tracing & metrics from within runtime
This commit is contained in:
parent
3f5bc1d311
commit
760b9d8c59
1 changed files with 17 additions and 9 deletions
26
src/main.rs
26
src/main.rs
|
@ -1,20 +1,28 @@
|
||||||
fn main() -> color_eyre::Result<()> {
|
fn main() -> color_eyre::Result<()> {
|
||||||
let config = pict_rs::PictRsConfiguration::build_default()?
|
run()
|
||||||
.install_tracing()?
|
|
||||||
.install_metrics()?;
|
|
||||||
|
|
||||||
run(config)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "io-uring")]
|
#[cfg(feature = "io-uring")]
|
||||||
fn run(config: pict_rs::PictRsConfiguration) -> color_eyre::Result<()> {
|
fn run() -> color_eyre::Result<()> {
|
||||||
tokio_uring::start(config.run())
|
tokio_uring::start(async move {
|
||||||
|
pict_rs::PictRsConfiguration::build_default()?
|
||||||
|
.install_tracing()?
|
||||||
|
.install_metrics()?
|
||||||
|
.run()
|
||||||
|
.await
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
fn run(config: pict_rs::PictRsConfiguration) -> color_eyre::Result<()> {
|
fn run() -> color_eyre::Result<()> {
|
||||||
tokio::runtime::Builder::new_multi_thread()
|
tokio::runtime::Builder::new_multi_thread()
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()?
|
.build()?
|
||||||
.block_on(config.run())
|
.block_on(async move {
|
||||||
|
pict_rs::PictRsConfiguration::build_default()?
|
||||||
|
.install_tracing()?
|
||||||
|
.install_metrics()?
|
||||||
|
.run_on_localset()
|
||||||
|
.await
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue