Skip to content
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

feat: Register errors from error manager in jaeger #1753

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions dozer-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,15 @@ fn run() -> Result<(), OrchestrationError> {
set_ctrl_handler(shutdown_sender);

// Now we have access to telemetry configuration. Telemetry must be initialized in tokio runtime.
let _telemetry = dozer.runtime.block_on(async {
Telemetry::new(Some(&dozer.config.app_name), dozer.config.telemetry.clone())
});
let app_name = dozer.config.app_name.clone();
let app_id = dozer
.config
.cloud
.as_ref()
.map(|cloud| cloud.app_id.clone().unwrap_or(app_name));
let _telemetry = dozer
.runtime
.block_on(async { Telemetry::new(app_id.as_deref(), dozer.config.telemetry.clone()) });

if let Some(cmd) = cli.cmd {
// run individual servers
Expand Down
3 changes: 3 additions & 0 deletions dozer-core/src/error_manager.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::atomic::AtomicU32;

use dozer_types::tracing::error_span;
use dozer_types::{errors::internal::BoxedError, log::error};

/// `ErrorManager` records and counts the number of errors happened.
Expand Down Expand Up @@ -27,7 +28,9 @@ impl ErrorManager {
}

pub fn report(&self, error: BoxedError) {
error_span!("reported error", error = true, e = error);
error!("{}", error);

let count = self.count.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
if let Some(threshold) = self.threshold {
if count >= threshold {
Expand Down
Loading