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 92571cd commit e7b9f1a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
21 changes: 12 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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,
}
})
8 changes: 8 additions & 0 deletions src/views/ConfigurationDevelopmentView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 e7b9f1a

Please sign in to comment.