This commit is contained in:
Antonio Scandurra 2023-10-22 16:33:59 +02:00
parent 6ffeb048b3
commit 48033463c8
3 changed files with 22 additions and 10 deletions

View file

@ -41,9 +41,9 @@ struct ClickhouseEventRequestBody {
installation_id: Option<Arc<str>>,
session_id: Option<Arc<str>>,
is_staff: Option<bool>,
app_version: Option<Arc<str>>,
app_version: Option<String>,
os_name: &'static str,
os_version: Option<Arc<str>>,
os_version: Option<String>,
architecture: &'static str,
release_channel: Option<&'static str>,
events: Vec<ClickhouseEventWrapper>,
@ -190,7 +190,13 @@ impl Telemetry {
core_count: system.cpus().len() as u32,
};
let telemetry_settings = cx.update(|cx| *settings2::get::<TelemetrySettings>(cx));
let telemetry_settings = if let Ok(telemetry_settings) =
cx.update(|cx| *settings2::get::<TelemetrySettings>(cx))
{
telemetry_settings
} else {
break;
};
this.report_clickhouse_event(memory_event, telemetry_settings);
this.report_clickhouse_event(cpu_event, telemetry_settings);
@ -287,9 +293,15 @@ impl Telemetry {
installation_id: state.installation_id.clone(),
session_id: state.session_id.clone(),
is_staff: state.is_staff.clone(),
app_version: state.app_version.clone(),
os_name: state.os_name,
os_version: state.os_version.clone(),
app_version: state
.app_metadata
.app_version
.map(|version| version.to_string()),
os_name: state.app_metadata.os_name,
os_version: state
.app_metadata
.os_version
.map(|version| version.to_string()),
architecture: state.architecture,
release_channel: state.release_channel,

View file

@ -59,8 +59,8 @@ impl App {
let unit_entity = entities.insert(entities.reserve(), ());
let app_metadata = AppMetadata {
os_name: platform.os_name(),
os_version: platform.os_version().unwrap_or_default(),
app_version: platform.app_version().unwrap_or_default(),
os_version: platform.os_version().ok(),
app_version: platform.app_version().ok(),
};
Self(Arc::new_cyclic(|this| {
Mutex::new(AppContext {

View file

@ -184,8 +184,8 @@ pub trait PlatformTextSystem: Send + Sync {
#[derive(Clone, Debug)]
pub struct AppMetadata {
pub os_name: &'static str,
pub os_version: SemanticVersion,
pub app_version: SemanticVersion,
pub os_version: Option<SemanticVersion>,
pub app_version: Option<SemanticVersion>,
}
#[derive(PartialEq, Eq, Hash, Clone)]