diff --git a/apps/wizarr-backend/wizarr_backend/app/__init__.py b/apps/wizarr-backend/wizarr_backend/app/__init__.py index 23a509a0..39d6d180 100644 --- a/apps/wizarr-backend/wizarr_backend/app/__init__.py +++ b/apps/wizarr-backend/wizarr_backend/app/__init__.py @@ -10,6 +10,7 @@ from .utils.clear_logs import clear_logs from .migrator import run_migrations +from utils.software_lifecycle import get_current_version from sentry_sdk import init as sentry_init # Get the base directory @@ -26,6 +27,7 @@ enable_tracing=True, traces_sample_rate=1.0, environment=app.debug and "development" or "production", + release=get_current_version(), ) # Base route for testing diff --git a/apps/wizarr-frontend/src/plugins/sentry.ts b/apps/wizarr-frontend/src/plugins/sentry.ts index 9b272d3e..2064f3ed 100644 --- a/apps/wizarr-frontend/src/plugins/sentry.ts +++ b/apps/wizarr-frontend/src/plugins/sentry.ts @@ -21,9 +21,21 @@ const isBugReporting = () => { return true; }; +const getVersion = () => { + const localStorage = window.localStorage.getItem("server"); + + if (localStorage !== null) { + const server = JSON.parse(localStorage); + return server.version; + } + + return true; +}; + const vuePluginSentry = { install: (app: App, options?: SentryOptions) => { const bugReporting = isBugReporting(); + const version = getVersion(); console.log("\x1b[32m%s\x1b[0m", "Sentry: Initializing"); console.log(bugReporting ? "\x1b[31m%s\x1b[0m" : "\x1b[32m%s\x1b[0m", "Sentry: Bug Reporting is " + (bugReporting ? "OFF" : "ON")); @@ -45,6 +57,7 @@ const vuePluginSentry = { }), ], environment: process.env.NODE_ENV, + release: version, tracesSampleRate: 1.0, replaysSessionSampleRate: 0.1, replaysOnErrorSampleRate: 1.0, diff --git a/apps/wizarr-frontend/src/stores/server.ts b/apps/wizarr-frontend/src/stores/server.ts index 882e8fd3..0e5d0c49 100644 --- a/apps/wizarr-frontend/src/stores/server.ts +++ b/apps/wizarr-frontend/src/stores/server.ts @@ -20,6 +20,9 @@ export const useServerStore = defineStore("server", { if (state.settings.bug_reporting === undefined) return true; return state.settings.bug_reporting === "true"; }, + version(state) { + return state.version; + } }, actions: { setServerData(server_data: Partial | undefined) {