mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
chore: don't report authentication errors to sentry (#6948)
Do we want to track 401s in sentry? If we see a lot of them, something is likely wrong but I guess there is some level of 401s that users will just run into. Is there a way of marking these as "might not be a really bad error"? --------- Co-authored-by: Not Applicable <ReactorScram@users.noreply.github.com>
This commit is contained in:
@@ -48,3 +48,13 @@ pub enum DisconnectError {
|
||||
#[error("connection to the portal failed: {0}")]
|
||||
PortalConnectionFailed(#[from] phoenix_channel::Error),
|
||||
}
|
||||
|
||||
impl DisconnectError {
|
||||
pub fn is_authentication_error(&self) -> bool {
|
||||
let Self::PortalConnectionFailed(e) = self else {
|
||||
return false;
|
||||
};
|
||||
|
||||
e.is_authentication_error()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,15 @@ async fn connect_supervisor<CB>(
|
||||
tracing::info!("connlib exited gracefully");
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
telemetry::capture_error(&e);
|
||||
if e.is_authentication_error() {
|
||||
telemetry::capture_message(
|
||||
"Portal authentication error",
|
||||
telemetry::Level::Warning,
|
||||
);
|
||||
} else {
|
||||
telemetry::capture_error(&e);
|
||||
}
|
||||
|
||||
tracing::error!("connlib failed: {e}");
|
||||
callbacks.on_disconnect(&e);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//! Otherwise we would just make it a normal binary crate.
|
||||
|
||||
use anyhow::{Context as _, Result};
|
||||
use connlib_client_shared::{Callbacks, DisconnectError};
|
||||
use connlib_client_shared::Callbacks;
|
||||
use connlib_model::ResourceView;
|
||||
use firezone_bin_shared::platform::DnsControlMethod;
|
||||
use std::{
|
||||
@@ -97,16 +97,10 @@ pub struct CallbackHandler {
|
||||
impl Callbacks for CallbackHandler {
|
||||
fn on_disconnect(&self, error: &connlib_client_shared::DisconnectError) {
|
||||
tracing::error!(?error, "Got `on_disconnect` from connlib");
|
||||
let is_authentication_error = if let DisconnectError::PortalConnectionFailed(error) = error
|
||||
{
|
||||
error.is_authentication_error()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
self.cb_tx
|
||||
.try_send(ConnlibMsg::OnDisconnect {
|
||||
error_msg: error.to_string(),
|
||||
is_authentication_error,
|
||||
is_authentication_error: error.is_authentication_error(),
|
||||
})
|
||||
.expect("should be able to send OnDisconnect");
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ use arc_swap::ArcSwapOption;
|
||||
use std::time::Duration;
|
||||
|
||||
pub use sentry::{
|
||||
add_breadcrumb, capture_error, configure_scope, end_session, end_session_with_status,
|
||||
start_transaction, types::protocol::v7::SessionStatus, Breadcrumb, Hub, TransactionContext,
|
||||
add_breadcrumb, capture_error, capture_message, configure_scope, end_session,
|
||||
end_session_with_status, start_transaction, types::protocol::v7::SessionStatus, Breadcrumb,
|
||||
Hub, Level, TransactionContext,
|
||||
};
|
||||
|
||||
pub struct Dsn(&'static str);
|
||||
|
||||
Reference in New Issue
Block a user