Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add telemetry with sentry.io #1166

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@j2only/slide-unlock": "^0.5.5",
"@mdi/font": "^7.0.96",
"@mdi/js": "^7.2.96",
"@sentry/vue": "^8.20.0",
"@types/hammerjs": "^2.0.45",
"@vueuse/core": "9.8.1",
"@vueuse/math": "^10.1.2",
Expand Down
16 changes: 16 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { library } from '@fortawesome/fontawesome-svg-core'
import { far } from '@fortawesome/free-regular-svg-icons'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import * as Sentry from '@sentry/vue'
import FloatingVue from 'floating-vue'
import { createPinia } from 'pinia'
import { createApp } from 'vue'
Expand All @@ -20,6 +21,21 @@ library.add(fas, far)
loadFonts()

const app = createApp(App)

// 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://24f33bd0a8e35e7505da20846dcbca92@o4507696465707008.ingest.us.sentry.io/4507696619061248',
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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never used the replay options ( only available in paid ) but I think itś supposed to generate a "video-like" session of users using the app, looking forward to see it in action :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also curious 👀

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)
app.mount('#app')
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
Loading