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

Pref-based sentry replay, client-specific sentry project support. #18616

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"@hirez_io/observer-spy": "^2.1.2",
"@johmun/vue-tags-input": "^2.1.0",
"@popperjs/core": "^2.11.8",
"@sentry/browser": "^7.74.1",
"@sentry/vue": "^7.114.0",
"@sentry/browser": "^8.18.0",
"@sentry/vue": "^8.18.0",
"@types/jest": "^29.5.6",
"@vueuse/core": "^10.5.0",
"@vueuse/math": "^10.9.0",
Expand Down
6 changes: 3 additions & 3 deletions client/src/onload/globalInits/initSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const initSentry = (galaxy, config) => {
Sentry.init({
Vue,
dsn: sentry_dsn_public,
integrations: [Sentry.browserTracingIntegration({ router }), Sentry.replayIntegration()],
replaysSessionSampleRate: 0,
integrations: [Sentry.browserTracingIntegration({ router })],
replaysSessionSampleRate: 0, // TODO: Set these two later when the replay integration is added when opted into?
replaysOnErrorSampleRate: 1.0,
release: release,
beforeSend(event, hint) {
Expand All @@ -33,7 +33,7 @@ export const initSentry = (galaxy, config) => {
},
});
if (email) {
Sentry.configureScope((scope) => {
Sentry.withScope((scope) => {
scope.setUser({
email: email,
});
Expand Down
28 changes: 28 additions & 0 deletions client/src/stores/userStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as Sentry from "@sentry/vue";
import { defineStore } from "pinia";
import { computed, ref } from "vue";

import { type AnonymousUser, type User } from "@/api";
import { getGalaxyInstance } from "@/app";
import { useUserLocalStorage } from "@/composables/userLocalStorage";
import { useHistoryStore } from "@/stores/historyStore";
import {
Expand All @@ -14,10 +16,25 @@ import {
interface Preferences {
theme: string;
favorites: { tools: string[] };
sentryReplay?: boolean;
extra_user_preferences?: string; // This is actually a big JSON string that needs parsing on access
}

type ListViewMode = "grid" | "list";

export function allowSentryReplay(userPreferences: Preferences | null) {
// TODO: refactor into extra prefs handling to simplify access, this is
// overly similar to tool caching pref handling.
if (userPreferences?.extra_user_preferences) {
const extra_user_preferences = JSON.parse(userPreferences.extra_user_preferences);
const key = "use_sentry_replay|use_sentry_replay_checkbox";
const hasKey = key in extra_user_preferences;
return hasKey ? ["true", true].includes(extra_user_preferences[key]) : false;
} else {
return false;
}
}

export const useUserStore = defineStore("userStore", () => {
const currentUser = ref<User | AnonymousUser | null>(null);
const currentPreferences = ref<Preferences | null>(null);
Expand Down Expand Up @@ -73,6 +90,17 @@ export const useUserStore = defineStore("userStore", () => {
// load first few histories for user to start pagination
await historyStore.loadHistories();
}
// If a user has sentry replay enabled, turn on the integration now.
// TODO: refactor and move this to a more appropriate place
const Galaxy = getGalaxyInstance();
if (Galaxy.Sentry && allowSentryReplay(currentPreferences.value)) {
const replay = Sentry.replayIntegration({
// extra config we might want to configure? Masking text?
});
if (replay) {
Galaxy.Sentry.addIntegration(replay);
}
}
})
.catch((e) => {
console.error("Failed to load user", e);
Expand Down
248 changes: 80 additions & 168 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1914,150 +1914,86 @@
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f"
integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==

"@sentry-internal/feedback@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.114.0.tgz#8a1c3d8bbd014c1823d30b9b1128eb244d357c3e"
integrity sha512-kUiLRUDZuh10QE9JbSVVLgqxFoD9eDPOzT0MmzlPuas8JlTmJuV4FtSANNcqctd5mBuLt2ebNXH0MhRMwyae4A==
dependencies:
"@sentry/core" "7.114.0"
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"

"@sentry-internal/replay-canvas@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.114.0.tgz#b81e2c2ebec01c436ad6e687e563ba456e33b615"
integrity sha512-6rTiqmKi/FYtesdM2TM2U+rh6BytdPjLP65KTUodtxohJ+r/3m+termj2o4BhIYPE1YYOZNmbZfwebkuQPmWeg==
dependencies:
"@sentry/core" "7.114.0"
"@sentry/replay" "7.114.0"
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"

"@sentry-internal/tracing@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.114.0.tgz#bdcd364f511e2de45db6e3004faf5685ca2e0f86"
integrity sha512-dOuvfJN7G+3YqLlUY4HIjyWHaRP8vbOgF+OsE5w2l7ZEn1rMAaUbPntAR8AF9GBA6j2zWNoSo8e7GjbJxVofSg==
dependencies:
"@sentry/core" "7.114.0"
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"

"@sentry-internal/tracing@7.74.1":
version "7.74.1"
resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.74.1.tgz#55ff387e61d2c9533a9a0d099d376332426c8e08"
integrity sha512-nNaiZreQxCitG2PzYPaC7XtyA9OMsETGYMKAtiK4p62/uTmeYbsBva9BoNx1XeiHRwbrVQYRMKQ9nV5e2jS4/A==
dependencies:
"@sentry/core" "7.74.1"
"@sentry/types" "7.74.1"
"@sentry/utils" "7.74.1"
tslib "^2.4.1 || ^1.9.3"

"@sentry/browser@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.114.0.tgz#b0741bff89189d16c8b19f0775fe6e078147ec33"
integrity sha512-ijJ0vOEY6U9JJADVYGkUbLrAbpGSQgA4zV+KW3tcsBLX9M1jaWq4BV1PWHdzDPPDhy4OgfOjIfaMb5BSPn1U+g==
dependencies:
"@sentry-internal/feedback" "7.114.0"
"@sentry-internal/replay-canvas" "7.114.0"
"@sentry-internal/tracing" "7.114.0"
"@sentry/core" "7.114.0"
"@sentry/integrations" "7.114.0"
"@sentry/replay" "7.114.0"
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"

"@sentry/browser@^7.74.1":
version "7.74.1"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.74.1.tgz#9302d440bbdcb018abd5fee5959dab4b2fe97383"
integrity sha512-OYWNne/KO60lOvkIpIlJUyiJt/9j8DGI57thSDFEYSmmbNqMitczUTBOaEStouvHKyfchqLZm1CZfWKt+z0VOA==
dependencies:
"@sentry-internal/tracing" "7.74.1"
"@sentry/core" "7.74.1"
"@sentry/replay" "7.74.1"
"@sentry/types" "7.74.1"
"@sentry/utils" "7.74.1"
tslib "^2.4.1 || ^1.9.3"

"@sentry/core@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.114.0.tgz#3efe86b92a5379c44dfd0fd4685266b1a30fa898"
integrity sha512-YnanVlmulkjgZiVZ9BfY9k6I082n+C+LbZo52MTvx3FY6RE5iyiPMpaOh67oXEZRWcYQEGm+bKruRxLVP6RlbA==
dependencies:
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"

"@sentry/core@7.74.1":
version "7.74.1"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.74.1.tgz#9e33cf59b754a994e4054c47c74df1d3fbd30d3c"
integrity sha512-LvEhOSfdIvwkr+PdlrT/aA/iOLhkXrSkvjqAQyogE4ddCWeYfS0NoirxNt1EaxMBAWKhYZRqzkA7WA4LDLbzlA==
dependencies:
"@sentry/types" "7.74.1"
"@sentry/utils" "7.74.1"
tslib "^2.4.1 || ^1.9.3"

"@sentry/integrations@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.114.0.tgz#baf249cfa9e359510f41e486a75bf184db18927d"
integrity sha512-BJIBWXGKeIH0ifd7goxOS29fBA8BkEgVVCahs6xIOXBjX1IRS6PmX0zYx/GP23nQTfhJiubv2XPzoYOlZZmDxg==
dependencies:
"@sentry/core" "7.114.0"
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"
localforage "^1.8.1"

"@sentry/replay@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.114.0.tgz#f552e4803cacb233a2f5f2a4afbf5bed9052a744"
integrity sha512-UvEajoLIX9n2poeW3R4Ybz7D0FgCGXoFr/x/33rdUEMIdTypknxjJWxg6fJngIduzwrlrvWpvP8QiZXczYQy2Q==
dependencies:
"@sentry-internal/tracing" "7.114.0"
"@sentry/core" "7.114.0"
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"

"@sentry/replay@7.74.1":
version "7.74.1"
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.74.1.tgz#dcb5040a3b0a9bda160b70cde5368ecbb4f0e782"
integrity sha512-qmbOl+jYdyhoHFbPp9WemKx8UojID5hVmuVLxNIP0ANqAwmE9OQEK9YFg2cf7L/TpKb1tqz0qLgi5MYIdcdpgQ==
dependencies:
"@sentry/core" "7.74.1"
"@sentry/types" "7.74.1"
"@sentry/utils" "7.74.1"

"@sentry/types@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.114.0.tgz#ab8009d5f6df23b7342121083bed34ee2452e856"
integrity sha512-tsqkkyL3eJtptmPtT0m9W/bPLkU7ILY7nvwpi1hahA5jrM7ppoU0IMaQWAgTD+U3rzFH40IdXNBFb8Gnqcva4w==

"@sentry/types@7.74.1":
version "7.74.1"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.74.1.tgz#b6f9b1bd266254f1f8b55fbcc92fa649ba2100ed"
integrity sha512-2jIuPc+YKvXqZETwr2E8VYnsH1zsSUR/wkIvg1uTVeVNyoowJv+YsOtCdeGyL2AwiotUBSPKu7O1Lz0kq5rMOQ==

"@sentry/utils@7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.114.0.tgz#59d30a79f4acff3c9268de0b345f0bcbc6335112"
integrity sha512-319N90McVpupQ6vws4+tfCy/03AdtsU0MurIE4+W5cubHME08HtiEWlfacvAxX+yuKFhvdsO4K4BB/dj54ideg==
dependencies:
"@sentry/types" "7.114.0"

"@sentry/utils@7.74.1":
version "7.74.1"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.74.1.tgz#e9a8453c954d02ebed2fd3dbe7588483d8f6d3cb"
integrity sha512-qUsqufuHYcy5gFhLZslLxA5kcEOkkODITXW3c7D+x+8iP/AJqa8v8CeUCVNS7RetHCuIeWAbbTClC4c411EwQg==
dependencies:
"@sentry/types" "7.74.1"
tslib "^2.4.1 || ^1.9.3"

"@sentry/vue@^7.114.0":
version "7.114.0"
resolved "https://registry.yarnpkg.com/@sentry/vue/-/vue-7.114.0.tgz#b8dabfe1bffa28828c9a478f7254e6b549965ee0"
integrity sha512-tHydxMJFpUcsmNCbXo59SqeNImX+3mMO+j3T0eLsDZy1NY2fSDFP6PFvuc72RsqiwCKeCKQmQDtAVa5Vt5ZlQA==
dependencies:
"@sentry/browser" "7.114.0"
"@sentry/core" "7.114.0"
"@sentry/types" "7.114.0"
"@sentry/utils" "7.114.0"
"@sentry-internal/browser-utils@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/browser-utils/-/browser-utils-8.18.0.tgz#b3d06a77bf80e8d00e4cd8fc11a242cb4e9fa534"
integrity sha512-1R7QXp7Gu6ovJGWvGjbgHcDcvDstsQba3miHtUCyDSH9kXtnAVLCAItDkseetFh+JLsjBXf3QFi2H3HPY4hRCw==
dependencies:
"@sentry/core" "8.18.0"
"@sentry/types" "8.18.0"
"@sentry/utils" "8.18.0"

"@sentry-internal/feedback@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-8.18.0.tgz#8055e7fcffe2c09505b0df66590859b7e59e3239"
integrity sha512-on6+4ZRkfdnsNgXecGQ6ME8aO26VTzkuM6y/kNN+bG2hSdxsmuU957B4x1Z5wEXiOWswuf3rhqGepg8JIdPkMQ==
dependencies:
"@sentry/core" "8.18.0"
"@sentry/types" "8.18.0"
"@sentry/utils" "8.18.0"

"@sentry-internal/replay-canvas@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-8.18.0.tgz#8b5aa194de1d2dc688c71803066e22276d33cdb3"
integrity sha512-fcuLJBrhw3Ql8sU8veUgDCRYo6toQldFU807cpYphQ0uEw2oVZwNNPDQSu1651Ykvp0P/x+9hk/jjJxMohrO9g==
dependencies:
"@sentry-internal/replay" "8.18.0"
"@sentry/core" "8.18.0"
"@sentry/types" "8.18.0"
"@sentry/utils" "8.18.0"

"@sentry-internal/replay@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/replay/-/replay-8.18.0.tgz#338ef7ce3d1ae1629d80315b293b5991b2886ba4"
integrity sha512-cCLib/HjD8UR0fB2F5hV6KsFBD6yTOEsi67RBllm5gT5vJt87VYoPliF6O7mmMNw8TWkQ0uc5laKld3q9ph+ug==
dependencies:
"@sentry-internal/browser-utils" "8.18.0"
"@sentry/core" "8.18.0"
"@sentry/types" "8.18.0"
"@sentry/utils" "8.18.0"

"@sentry/browser@8.18.0", "@sentry/browser@^8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-8.18.0.tgz#26840a95750f7b239af0cb350868acba536ba872"
integrity sha512-E2w9u76JcjxcmgvroJrB7bcbG5oBCYI/pME1CtprBgZSS9mMYDsyBe6JKqGHdw2wvT3xNxNtkm7hf1O6+3NWUQ==
dependencies:
"@sentry-internal/browser-utils" "8.18.0"
"@sentry-internal/feedback" "8.18.0"
"@sentry-internal/replay" "8.18.0"
"@sentry-internal/replay-canvas" "8.18.0"
"@sentry/core" "8.18.0"
"@sentry/types" "8.18.0"
"@sentry/utils" "8.18.0"

"@sentry/core@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-8.18.0.tgz#65fd100edc9ff6ba96f9ae1c24c960b54cf9e6a1"
integrity sha512-8moEMC3gp4W6mH9w5amb/zrYk6bNW8WGgcLRMCs5rguxny8YP5i8ISOJ0T0LP9x/RxSK/6xix5D2bzI/5ECzlw==
dependencies:
"@sentry/types" "8.18.0"
"@sentry/utils" "8.18.0"

"@sentry/types@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-8.18.0.tgz#501e57e19567d0ff13de0957efd2af29a0956699"
integrity sha512-5J+uOqptnmAnW3Rk31AHIqW36Wzvlo3UOM+p2wjSYGrC/PgcE47Klzr+w4UcOhN6AZqefalGd3vaUXz9NaFdRg==

"@sentry/utils@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-8.18.0.tgz#1c161a09470e0844bb41de04c7d2c798adcc8bce"
integrity sha512-7wq7cgaeSIGJncl9/2VMu81ZN5ep4lp4H1/+O8+xUxOmnPb/05ZZcbn9/VxVQvIoqZSZdwCLPeBz6PEVukvokA==
dependencies:
"@sentry/types" "8.18.0"

"@sentry/vue@^8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@sentry/vue/-/vue-8.18.0.tgz#2cee1a759807ced779c39fc3ef9ffdd04a8f7eec"
integrity sha512-0miQFk8MPKmWVLwj1KQ84r/1pk+QW8kbJa8rb9BzqmNzvqSxyec+3dg1Ysd8J9iwAGlB1IfDb2lI2nPExC1Gkg==
dependencies:
"@sentry/browser" "8.18.0"
"@sentry/core" "8.18.0"
"@sentry/types" "8.18.0"
"@sentry/utils" "8.18.0"

"@sinclair/typebox@^0.24.1":
version "0.24.27"
Expand Down Expand Up @@ -6909,11 +6845,6 @@ imask@^7.1.3:
dependencies:
"@babel/runtime-corejs3" "^7.22.6"

immediate@~3.0.5:
version "3.0.6"
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==

immutable@^4.0.0:
version "4.1.0"
resolved "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz"
Expand Down Expand Up @@ -8173,13 +8104,6 @@ levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"

lie@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e"
integrity sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==
dependencies:
immediate "~3.0.5"

liftoff@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/liftoff/-/liftoff-3.1.0.tgz"
Expand Down Expand Up @@ -8255,13 +8179,6 @@ loader-utils@^2.0.0:
emojis-list "^3.0.0"
json5 "^2.1.2"

localforage@^1.8.1:
version "1.10.0"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4"
integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==
dependencies:
lie "3.1.1"

locate-path@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz"
Expand Down Expand Up @@ -11311,11 +11228,6 @@ tslib@^2.4.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==

"tslib@^2.4.1 || ^1.9.3":
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

tus-js-client@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/tus-js-client/-/tus-js-client-3.1.1.tgz#87cb72e528d274d0a8ff62e9c18165f1e901ce9e"
Expand Down
18 changes: 18 additions & 0 deletions doc/source/admin/galaxy_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,21 @@
:Type: str


~~~~~~~~~~~~~~~~~~~~~
``sentry_client_dsn``
~~~~~~~~~~~~~~~~~~~~~

:Description:
Setting sentry_client_dsn will configure the DSN (see sentry_dsn)
for the Galaxy web client separately from the back-end, which is
useful for segmenting client-side errors. If unset, the client
will use the same project configured in sentry_dsn (if any). Note
that sentry best practices recommend routing errors from different
components of a service into discrete projects.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~
``sentry_event_level``
~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -5581,3 +5596,6 @@
This requires the help_forum_api_url to be set.
:Default: ``false``
:Type: bool



Loading
Loading