Skip to content

Commit

Permalink
telemetry: Allow user to opt out of sending usage statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Jul 30, 2024
1 parent fbfdf08 commit b9eda55
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
23 changes: 13 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ loadFonts()

const app = createApp(App)

Sentry.init({
app,
dsn: 'https://5176a29493da4d31a6384c55d291cd3d@o4507692193415168.ingest.us.sentry.io/4507692196036608',
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
tracesSampleRate: 0.1, // Capture 10% 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.
transport: Sentry.makeBrowserOfflineTransport(Sentry.makeFetchTransport),
})
// 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: 0.1, // Capture 10% 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.
transport: Sentry.makeBrowserOfflineTransport(Sentry.makeFetchTransport), // Cache events and send them when the user comes back online
})
}

app.component('FontAwesomeIcon', FontAwesomeIcon)
app.use(router).use(vuetify).use(createPinia()).use(FloatingVue).use(VueVirtualScroller)
Expand Down
10 changes: 9 additions & 1 deletion src/stores/development.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
})
10 changes: 9 additions & 1 deletion src/views/ConfigurationDevelopmentView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<template #content>
<div
class="max-h-[80vh] overflow-y-auto -mr-4"
:class="interfaceStore.isOnSmallScreen ? 'max-w-[85vw]' : 'max-w-[50vw]'"
:class="interfaceStore.isOnSmallScreen ? 'max-w-[85vw]' : 'max-w-[60vw]'"
>
<div
class="flex flex-col justify-between items-center w-full"
Expand All @@ -26,6 +26,14 @@
class="min-w-[155px]"
@update:model-value="reloadCockpit"
/>
<v-switch
v-model="devStore.enableUsageStatisticsTelemetry"
label="Usage statistics telemetry"
color="white"
hide-details
class="min-w-[155px]"
@update:model-value="reloadCockpit"
/>
<v-switch
v-model="devStore.enableSystemLogging"
label="Enable system logging"
Expand Down

0 comments on commit b9eda55

Please sign in to comment.