mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
chore(android): start telemetry together with connlib session (#7151)
As a first step for integration Sentry into the Android app, we launch the Sentry Rust agent as soon as a `connlib` session starts up. At a later point, we can also integrate Sentry into the Android app itself using the Java / Kotlin SDK. --------- Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
1
rust/Cargo.lock
generated
1
rust/Cargo.lock
generated
@@ -1053,6 +1053,7 @@ dependencies = [
|
||||
"connlib-client-shared",
|
||||
"connlib-model",
|
||||
"firezone-logging",
|
||||
"firezone-telemetry",
|
||||
"ip_network",
|
||||
"jni",
|
||||
"libc",
|
||||
|
||||
@@ -14,6 +14,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"
|
||||
jni = { version = "0.21.1", features = ["invocation"] }
|
||||
libc = "0.2"
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::tun::Tun;
|
||||
use backoff::ExponentialBackoffBuilder;
|
||||
use connlib_client_shared::{Callbacks, DisconnectError, Session, V4RouteList, V6RouteList};
|
||||
use connlib_model::{ResourceId, ResourceView};
|
||||
use firezone_telemetry::{Telemetry, ANDROID_DSN};
|
||||
use ip_network::{Ipv4Network, Ipv6Network};
|
||||
use jni::{
|
||||
objects::{GlobalRef, JClass, JObject, JString, JValue},
|
||||
@@ -344,9 +345,11 @@ fn connect(
|
||||
let log_dir = string_from_jstring!(env, log_dir);
|
||||
let log_filter = string_from_jstring!(env, log_filter);
|
||||
let device_info = string_from_jstring!(env, device_info);
|
||||
|
||||
let device_info = serde_json::from_str(&device_info).unwrap();
|
||||
|
||||
let telemetry = Telemetry::default();
|
||||
telemetry.start(&api_url, env!("CARGO_PKG_VERSION"), ANDROID_DSN);
|
||||
|
||||
let handle = init_logging(&PathBuf::from(log_dir), log_filter);
|
||||
install_rustls_crypto_provider();
|
||||
|
||||
@@ -394,6 +397,7 @@ fn connect(
|
||||
Ok(SessionWrapper {
|
||||
inner: session,
|
||||
runtime,
|
||||
telemetry,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -451,6 +455,7 @@ pub struct SessionWrapper {
|
||||
inner: Session,
|
||||
|
||||
runtime: Runtime,
|
||||
telemetry: Telemetry,
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
@@ -463,7 +468,10 @@ pub unsafe extern "system" fn Java_dev_firezone_android_tunnel_ConnlibSession_di
|
||||
) {
|
||||
let session = session_ptr as *mut SessionWrapper;
|
||||
catch_and_throw(&mut env, |_| {
|
||||
Box::from_raw(session).inner.disconnect();
|
||||
let session = Box::from_raw(session);
|
||||
|
||||
session.inner.disconnect();
|
||||
session.telemetry.stop();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ pub const GATEWAY_DSN: Dsn = Dsn("https://f763102cc3937199ec483fbdae63dfdc@o4507
|
||||
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");
|
||||
pub const IPC_SERVICE_DSN: Dsn = Dsn("https://0590b89fd4479494a1e7ffa4dc705001@o4507971108339712.ingest.us.sentry.io/4508008896069632");
|
||||
pub const ANDROID_DSN: Dsn = Dsn("https://928a6ee1f6af9734100b8bc89b2dc87d@o4507971108339712.ingest.us.sentry.io/4508175126233088");
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Telemetry {
|
||||
|
||||
@@ -13,6 +13,9 @@ export default function Android() {
|
||||
{/* 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="7151">
|
||||
Adds always-on error reporting using sentry.io.
|
||||
</ChangeItem>
|
||||
</Unreleased>
|
||||
<Entry version="1.3.5" date={new Date("2024-10-03")}>
|
||||
<ChangeItem pull="6831">
|
||||
|
||||
Reference in New Issue
Block a user