Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/sentry/init_sentry.js')
-rw-r--r--app/assets/javascripts/sentry/init_sentry.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/app/assets/javascripts/sentry/init_sentry.js b/app/assets/javascripts/sentry/init_sentry.js
index dbd12dc36ce..6f32c8c4165 100644
--- a/app/assets/javascripts/sentry/init_sentry.js
+++ b/app/assets/javascripts/sentry/init_sentry.js
@@ -4,11 +4,10 @@ import {
defaultStackParser,
makeFetchTransport,
defaultIntegrations,
+ BrowserTracing,
// exports
captureException,
- captureMessage,
- withScope,
SDK_VERSION,
} from 'sentrybrowser';
@@ -19,6 +18,8 @@ const initSentry = () => {
const hub = getCurrentHub();
+ const page = document?.body?.dataset?.page;
+
const client = new BrowserClient({
// Sentry.init(...) options
dsn: gon.sentry_dsn,
@@ -37,7 +38,19 @@ const initSentry = () => {
// https://github.com/getsentry/sentry-javascript/blob/7.66.0/MIGRATION.md#explicit-client-options
transport: makeFetchTransport,
stackParser: defaultStackParser,
- integrations: defaultIntegrations,
+ integrations: [
+ ...defaultIntegrations,
+ new BrowserTracing({
+ beforeNavigate(context) {
+ return {
+ ...context,
+ // `page` acts as transaction name for performance tracing.
+ // If missing, use default Sentry behavior: window.location.pathname
+ name: page || window?.location?.pathname,
+ };
+ },
+ }),
+ ],
});
hub.bindClient(client);
@@ -45,7 +58,7 @@ const initSentry = () => {
hub.setTags({
revision: gon.revision,
feature_category: gon.feature_category,
- page: document?.body?.dataset?.page,
+ page,
});
if (gon.current_user_id) {
@@ -68,8 +81,6 @@ const initSentry = () => {
// eslint-disable-next-line no-underscore-dangle
window._Sentry = {
captureException,
- captureMessage,
- withScope,
SDK_VERSION, // used to verify compatibility with the Sentry instance
};
};