diff --git a/.cargo/audit.toml b/.cargo/audit.toml index 7d08f42a..f790a5bf 100644 --- a/.cargo/audit.toml +++ b/.cargo/audit.toml @@ -4,4 +4,5 @@ ignore = [ "RUSTSEC-2021-0078", # Bound by Rusoto 0.42, Reqwest 0.9 requiring Hyper 0.12 "RUSTSEC-2021-0079", # Bound by Rusoto 0.42, Reqwest 0.9, a2 0.5 requiring Hyper 0.12 "RUSTSEC-2021-0124", # Bound by tokio restrictions, rusoto, reqwest, hyper... + "RUSTSEC-2023-0034", # Bound by Rusoto 0.42, Reqwest 0.9, a2 0.5 requiring Hyper 0.12 ] diff --git a/Cargo.lock b/Cargo.lock index 2f2aa275..2baae95f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -96,7 +96,7 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", - "h2 0.3.16", + "h2 0.3.18", "http 0.2.9", "httparse", "httpdate 1.0.2", @@ -832,7 +832,7 @@ dependencies = [ "derive_more", "futures-core", "futures-util", - "h2 0.3.16", + "h2 0.3.18", "http 0.2.9", "itoa 1.0.6", "log", @@ -2018,9 +2018,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" dependencies = [ "bytes 1.4.0", "fnv", @@ -2263,7 +2263,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.16", + "h2 0.3.18", "http 0.2.9", "http-body 0.4.5", "httparse", @@ -3704,7 +3704,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.16", + "h2 0.3.18", "http 0.2.9", "http-body 0.4.5", "hyper 0.14.25", diff --git a/autoendpoint/src/error.rs b/autoendpoint/src/error.rs index 35ee1bee..e90f5a80 100644 --- a/autoendpoint/src/error.rs +++ b/autoendpoint/src/error.rs @@ -159,7 +159,7 @@ impl ApiErrorKind { pub fn metric_label(&self) -> Option<&'static str> { Some(match self { ApiErrorKind::PayloadError(_) => "payload_error", - ApiErrorKind::Router(e) => e.metric_label().unwrap_or("router"), + ApiErrorKind::Router(e) => return e.metric_label(), ApiErrorKind::Validation(_) => "validation", ApiErrorKind::InvalidEncryption(_) => "invalid_encryption", diff --git a/autoendpoint/src/routers/mod.rs b/autoendpoint/src/routers/mod.rs index c2fc1f74..c30c6ae3 100644 --- a/autoendpoint/src/routers/mod.rs +++ b/autoendpoint/src/routers/mod.rs @@ -163,20 +163,20 @@ impl RouterError { } pub fn metric_label(&self) -> Option<&'static str> { + // NOTE: Some metrics are emitted for other Errors via handle_error + // callbacks, whereas some are emitted via this method. These 2 should + // be consoliated: https://mozilla-hub.atlassian.net/browse/SYNC-3695 let err = match self { - RouterError::Fcm(e) => match e { - FcmError::InvalidAppId(_) | FcmError::NoAppId => "fcm_badappid", - _ => "", - }, - RouterError::Adm(e) => match e { - AdmError::NoProfile | AdmError::InvalidProfile => "adm_profile", - _ => "", - }, - RouterError::Apns(e) => match e { - ApnsError::Unregistered => "apns_unregistered", - ApnsError::SizeLimit(_) => "apns_oversized", - _ => "", - }, + RouterError::Adm(e) if matches!(e, AdmError::InvalidProfile | AdmError::NoProfile) => { + "notification.bridge.error.adm.profile" + } + RouterError::Apns(ApnsError::SizeLimit(_)) => { + "notification.bridge.error.apns.oversized" + } + RouterError::Fcm(e) if matches!(e, FcmError::InvalidAppId(_) | FcmError::NoAppId) => { + "notification.bridge.error.fcm.badappid" + } + RouterError::TooMuchData(_) => "notification.bridge.error.too_much_data", _ => "", }; if !err.is_empty() { @@ -188,10 +188,18 @@ impl RouterError { pub fn is_sentry_event(&self) -> bool { match self { RouterError::Adm(e) => !matches!(e, AdmError::InvalidProfile | AdmError::NoProfile), + // apns handle_error emits a metric for ApnsError::Unregistered RouterError::Apns(ApnsError::SizeLimit(_)) | RouterError::Apns(ApnsError::Unregistered) => false, RouterError::Fcm(e) => !matches!(e, FcmError::InvalidAppId(_) | FcmError::NoAppId), - RouterError::TooMuchData(_) => false, + // common handle_error emits metrics for these + RouterError::Authentication + | RouterError::GCMAuthentication + | RouterError::Connect(_) + | RouterError::NotFound + | RouterError::RequestTimeout + | RouterError::TooMuchData(_) + | RouterError::Upstream { .. } => false, _ => true, } }