From e7b9f1a05a526ee1a04295ee1aa952e1c5b7f8ba Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Tue, 30 Jul 2024 16:06:11 -0300 Subject: [PATCH] telemetry: Allow user to opt out of sending usage statistics --- src/main.ts | 21 ++++++++++++--------- src/stores/development.ts | 10 +++++++++- src/views/ConfigurationDevelopmentView.vue | 8 ++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/main.ts b/src/main.ts index 0cfb2c1af..61688fbab 100644 --- a/src/main.ts +++ b/src/main.ts @@ -22,15 +22,18 @@ loadFonts() const app = createApp(App) -Sentry.init({ - app, - dsn: 'https://5176a29493da4d31a6384c55d291cd3d@o4507692193415168.ingest.us.sentry.io/4507692196036608', - integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()], - tracesSampleRate: 1.0, // Capture 100% of the transactions - tracePropagationTargets: [], - replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. - replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. -}) +// Only track usage statistics if the user has not opted out +if (window.localStorage.getItem('cockpit-enable-usage-statistics-telemetry')) { + Sentry.init({ + app, + dsn: 'https://5176a29493da4d31a6384c55d291cd3d@o4507692193415168.ingest.us.sentry.io/4507692196036608', + integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()], + tracesSampleRate: 1.0, // Capture 100% of the transactions + tracePropagationTargets: [], + replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. + replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. + }) +} app.component('FontAwesomeIcon', FontAwesomeIcon) app.use(router).use(vuetify).use(createPinia()).use(FloatingVue).use(VueVirtualScroller) diff --git a/src/stores/development.ts b/src/stores/development.ts index d16e7c01e..a2c1f42f3 100644 --- a/src/stores/development.ts +++ b/src/stores/development.ts @@ -6,12 +6,20 @@ import { useBlueOsStorage } from '@/composables/settingsSyncer' export const systemLoggingEnablingKey = 'cockpit-enable-system-logging' export const blueOsSettingsSyncEnablingKey = 'cockpit-enable-blueos-settings-sync' +export const enableUsageStatisticsTelemetryKey = 'cockpit-enable-usage-statistics-telemetry' export const useDevelopmentStore = defineStore('development', () => { const developmentMode = ref(false) const widgetDevInfoBlurLevel = ref(3) const enableSystemLogging = useBlueOsStorage(systemLoggingEnablingKey, true) const enableBlueOsSettingsSync = useStorage(blueOsSettingsSyncEnablingKey, true) + const enableUsageStatisticsTelemetry = useStorage(enableUsageStatisticsTelemetryKey, true) - return { developmentMode, widgetDevInfoBlurLevel, enableSystemLogging, enableBlueOsSettingsSync } + return { + developmentMode, + widgetDevInfoBlurLevel, + enableSystemLogging, + enableBlueOsSettingsSync, + enableUsageStatisticsTelemetry, + } }) diff --git a/src/views/ConfigurationDevelopmentView.vue b/src/views/ConfigurationDevelopmentView.vue index 8beed042d..a575b2446 100644 --- a/src/views/ConfigurationDevelopmentView.vue +++ b/src/views/ConfigurationDevelopmentView.vue @@ -26,6 +26,14 @@ class="min-w-[155px]" @update:model-value="reloadCockpit" /> +