From 419c53ec62de6e97a517abd5fdd4cbde3a942a34 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Oct 2023 12:57:54 +0000 Subject: Add latest changes from gitlab-org/gitlab@16-5-stable-ee --- app/assets/javascripts/sentry/init_sentry.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'app/assets/javascripts/sentry/init_sentry.js') 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 }; }; -- cgit v1.2.3