Skip to content

Commit

Permalink
Fix crash logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiimk committed Aug 31, 2024
1 parent 41e918b commit 5be9782
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.34.1] - 2024-08-30
### Fixed
- Critical errors were not logged due to logging guard destroyed before the call to tracing

## [0.34.0] - 2024-08-30
### Changed
- Upgrade kamu-cli version to `0.198.2`
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ resolver = "2"

[workspace.dependencies]
# Utils
graceful-shutdown = { path = "src/utils/graceful-shutdown", version = "0.34.0", default-features = false }
observability = { path = "src/utils/observability", version = "0.34.0", default-features = false }
graceful-shutdown = { path = "src/utils/graceful-shutdown", version = "0.34.1", default-features = false }
observability = { path = "src/utils/observability", version = "0.34.1", default-features = false }
# Utils (core)
container-runtime = { git = "https://github.com/kamu-data/kamu-cli", tag = "v0.198.2", version = "0.198.2", default-features = false }
database-common = { git = "https://github.com/kamu-data/kamu-cli", tag = "v0.198.2", version = "0.198.2", default-features = false }
Expand Down Expand Up @@ -60,7 +60,7 @@ kamu-auth-rebac-sqlite = { git = "https://github.com/kamu-data/kamu-cli", tag =


[workspace.package]
version = "0.34.0"
version = "0.34.1"
edition = "2021"
homepage = "https://github.com/kamu-data/kamu-platform"
repository = "https://github.com/kamu-data/kamu-platform"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Business Source License 1.1

Licensor: Kamu Data, Inc.

Licensed Work: Kamu Platform Version 0.34.0
Licensed Work: Kamu Platform Version 0.34.1
The Licensed Work is © 2023 Kamu Data, Inc.

Additional Use Grant: You may use the Licensed Work for any purpose,
Expand Down
22 changes: 11 additions & 11 deletions src/app/api-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use internal_error::InternalError;

/////////////////////////////////////////////////////////////////////////////////////////

fn main() {
Expand All @@ -30,22 +28,24 @@ fn main() {

let rt = builder.enable_all().build().unwrap();

match rt.block_on(main_async(matches, config)) {
Ok(_) => {}
Err(err) => {
eprintln!("Error: {err}\nDetails: {err:#?}");
std::process::exit(1)
}
}
let code = rt.block_on(main_async(matches, config));

std::process::exit(code)
}

async fn main_async(
args: clap::ArgMatches,
config: kamu_api_server::config::ApiServerConfig,
) -> Result<(), InternalError> {
) -> i32 {
use kamu_api_server::app;

let _guard = app::init_observability();

kamu_api_server::app::run(args, config).await
match kamu_api_server::app::run(args, config).await {
Ok(_) => {}
Err(err) => {
eprintln!("Error: {err}\nDetails: {err:#?}");
1
}
}
}
19 changes: 10 additions & 9 deletions src/app/oracle-provider/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// by the Apache License, Version 2.0.

use clap::Parser;
use internal_error::InternalError;
use kamu_oracle_provider::{Cli, Config};

/////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -27,16 +26,18 @@ fn main() {
.build()
.unwrap();

match rt.block_on(main_async(args, config)) {
Ok(_) => {}
let code = rt.block_on(main_async(args, config));

std::process::exit(code)
}

async fn main_async(args: Cli, config: Config) -> i32 {
let _guard = kamu_oracle_provider::app::init_observability();
match kamu_oracle_provider::app::run(args, config).await {
Ok(_) => 0,
Err(err) => {
tracing::error!(error = %err, error_dbg = ?err, "Provider exited with error");
std::process::exit(1)
1
}
}
}

async fn main_async(args: Cli, config: Config) -> Result<(), InternalError> {
let _guard = kamu_oracle_provider::app::init_observability();
kamu_oracle_provider::app::run(args, config).await
}

0 comments on commit 5be9782

Please sign in to comment.