chore(apple): start telemetry together with connlib session (#7152)

This starts up telemetry together with each `connlib` session. At a
later point, we can also integrate the native Swift SDK into the MacOS /
iOS app to catch non-connlib specific problems.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
Thomas Eizinger
2024-10-25 06:59:52 +11:00
committed by GitHub
parent 4fe4001760
commit c12a02e348
5 changed files with 16 additions and 1 deletions

1
rust/Cargo.lock generated
View File

@@ -1080,6 +1080,7 @@ dependencies = [
"connlib-client-shared",
"connlib-model",
"firezone-logging",
"firezone-telemetry",
"ip_network",
"libc",
"oslog",

View File

@@ -13,6 +13,7 @@ backoff = "0.4.0"
connlib-client-shared = { workspace = true }
connlib-model = { workspace = true }
firezone-logging = { workspace = true }
firezone-telemetry = { workspace = true }
ip_network = "0.4"
libc = "0.2"
phoenix-channel = { workspace = true }

View File

@@ -8,6 +8,8 @@ use anyhow::Result;
use backoff::ExponentialBackoffBuilder;
use connlib_client_shared::{Callbacks, DisconnectError, Session, V4RouteList, V6RouteList};
use connlib_model::ResourceView;
use firezone_telemetry::Telemetry;
use firezone_telemetry::APPLE_DSN;
use ip_network::{Ipv4Network, Ipv6Network};
use phoenix_channel::get_user_agent;
use phoenix_channel::LoginUrl;
@@ -102,6 +104,8 @@ pub struct WrappedSession {
reason = "Logger handle must be kept alive until Session is dropped"
)]
logger: firezone_logging::file::Handle,
telemetry: Telemetry,
}
// SAFETY: `CallbackHandler.swift` promises to be thread-safe.
@@ -193,6 +197,9 @@ impl WrappedSession {
callback_handler: ffi::CallbackHandler,
device_info: String,
) -> Result<Self> {
let telemetry = Telemetry::default();
telemetry.start(&api_url, env!("CARGO_PKG_VERSION"), APPLE_DSN);
let logger = init_logging(log_dir.into(), log_filter)?;
install_rustls_crypto_provider();
@@ -239,6 +246,7 @@ impl WrappedSession {
inner: session,
runtime,
logger,
telemetry,
})
}
@@ -257,7 +265,8 @@ impl WrappedSession {
}
fn disconnect(self) {
self.inner.disconnect()
self.inner.disconnect();
self.telemetry.stop();
}
}

View File

@@ -15,6 +15,7 @@ pub struct Dsn(&'static str);
// > DSNs are safe to keep public because they only allow submission of new events and related event data; they do not allow read access to any information.
// <https://docs.sentry.io/concepts/key-terms/dsn-explainer/#dsn-utilization>
pub const APPLE_DSN: Dsn = Dsn("https://66c71f83675f01abfffa8eb977bcbbf7@o4507971108339712.ingest.us.sentry.io/4508175177023488");
pub const GATEWAY_DSN: Dsn = Dsn("https://f763102cc3937199ec483fbdae63dfdc@o4507971108339712.ingest.us.sentry.io/4508162914451456");
pub const GUI_DSN: Dsn = Dsn("https://2e17bf5ed24a78c0ac9e84a5de2bd6fc@o4507971108339712.ingest.us.sentry.io/4508008945549312");
pub const HEADLESS_DSN: Dsn = Dsn("https://bc27dca8bb37be0142c48c4f89647c13@o4507971108339712.ingest.us.sentry.io/4508010028728320");

View File

@@ -13,6 +13,9 @@ export default function Apple() {
{/* When you cut a release, remove any solved issues from the "known issues" lists over in `client-apps`. This must not be done when the issue's PR merges. */}
<Unreleased>
<ChangeItem>Handles DNS queries over TCP correctly.</ChangeItem>
<ChangeItem pull="7152">
Adds always-on error reporting using sentry.io.
</ChangeItem>
</Unreleased>
<Entry version="1.3.6" date={new Date("2024-10-02")}>
<ChangeItem pull="6831">