diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-22 03:11:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-22 03:11:47 +0300 |
commit | 0bdb61ade7f12067dd524463af4f83994f1baa37 (patch) | |
tree | 987819d2a9e915df73874f66c52d1d9cdc889583 /app/assets/javascripts/sentry | |
parent | 8746f541fbcf2b89b30c3d4a1b290f5679186400 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/sentry')
-rw-r--r-- | app/assets/javascripts/sentry/init_sentry.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/assets/javascripts/sentry/init_sentry.js b/app/assets/javascripts/sentry/init_sentry.js index 5b4e5be1f10..81ae46b8dd6 100644 --- a/app/assets/javascripts/sentry/init_sentry.js +++ b/app/assets/javascripts/sentry/init_sentry.js @@ -20,6 +20,8 @@ const initSentry = () => { const hub = getCurrentHub(); + const page = document?.body?.dataset?.page; + const client = new BrowserClient({ // Sentry.init(...) options dsn: gon.sentry_dsn, @@ -38,7 +40,19 @@ const initSentry = () => { // https://github.com/getsentry/sentry-javascript/blob/7.66.0/MIGRATION.md#explicit-client-options transport: makeFetchTransport, stackParser: defaultStackParser, - integrations: [...defaultIntegrations, new BrowserTracing()], + 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); @@ -46,7 +60,7 @@ const initSentry = () => { hub.setTags({ revision: gon.revision, feature_category: gon.feature_category, - page: document?.body?.dataset?.page, + page, }); if (gon.current_user_id) { |