Add opt-out for metric reporting

co-authored-by: kay <kay@zed.dev>
This commit is contained in:
Mikayla Maki 2023-01-10 15:49:54 -08:00
parent 866f0e1344
commit 37a4de1a84
6 changed files with 76 additions and 19 deletions

View file

@ -62,6 +62,15 @@ pub struct TelemetrySettings {
metrics: Option<bool>,
}
impl TelemetrySettings {
pub fn metrics(&self) -> bool {
self.metrics.unwrap()
}
pub fn diagnostics(&self) -> bool {
self.diagnostics.unwrap()
}
}
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
pub struct FeatureFlags {
pub experimental_themes: bool,
@ -503,6 +512,13 @@ impl Settings {
.unwrap_or_else(|| R::default())
}
pub fn telemetry(&self) -> TelemetrySettings {
TelemetrySettings {
diagnostics: Some(self.telemetry_diagnostics()),
metrics: Some(self.telemetry_metrics()),
}
}
pub fn telemetry_diagnostics(&self) -> bool {
self.telemetry_overrides
.diagnostics