Skip to content

Commit

Permalink
feat: Register errors from error manager in jaeger (#1753)
Browse files Browse the repository at this point in the history
  • Loading branch information
karolisg authored Jul 20, 2023
1 parent fe5aaad commit d42ad90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dozer-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,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

0 comments on commit d42ad90

Please sign in to comment.