Skip to content

Commit

Permalink
fix: DEV-3251: Sentry release frontend (HumanSignal#2891)
Browse files Browse the repository at this point in the history
Use APP_SETTINGS as the main source of the version
  • Loading branch information
nick-skriabin authored Sep 1, 2022
1 parent 8972ca9 commit 1a15645
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 8 additions & 2 deletions label_studio/frontend/src/config/Sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const initSentry = (history: RouterHistory) => {
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 0.25,
release: process.env.RELEASE_NAME,
release: getVersion(),
});
};

Expand All @@ -35,7 +35,7 @@ const setTags = () => {

if (APP_SETTINGS.version) {
Object.entries(APP_SETTINGS.version).forEach(([packageName, data]: [string, any]) => {
const {version, commit} = data ?? {};
const { version, commit } = data ?? {};

if (version) {
tags['version-' + packageName] = version;
Expand All @@ -49,4 +49,10 @@ const setTags = () => {
Sentry.setTags(tags);
};

const getVersion = () => {
const version = APP_SETTINGS.version?.["label-studio-os-package"]?.version;

return version ? version : process.env.RELEASE_NAME;
};

export const SentryRoute = ReactSentry.withSentryRouting(Route);
7 changes: 0 additions & 7 deletions label_studio/frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ const LOCAL_ENV = {
RELEASE_NAME: RELEASE,
};

const SENTRY = {
AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,
ORG: process.env.SENTRY_ORG,
PROJECT: process.env.SENTRY_PROJECT,
RELEASE,
}

const devtool = process.env.NODE_ENV === 'production' ? "source-map" : "cheap-module-source-map";

const output = {
Expand Down

0 comments on commit 1a15645

Please sign in to comment.