Use the page name as identifier in Sentry tracing
What does this MR do and why?
Sentry tracks performance data by different "transactions" (pageload
or navigation
are considered a transaction). The transactions have an identifier to differenciate them. By default the transaction identifier is location.pathname
.
location.pathname
is not an appropriate identifier for GitLab, for example, the projects:pipelines:index
page is recorded as two different endpoints when viewing different projects:
/gitlab-org/gitlab/-/pipelines/*
/gitlab-org/gitlab-ui/-/pipelines/*
Examples of transaction we record at the moment:
GitLab has a data-page
attribute in the <body>
that can differentiate endpoints better than location.pathname
. This change changes the identifier to be projects:pipelines:index
for all the project pipeline pages: which is the way we want to track.
Screenshots or screen recordings
before | after |
---|---|
How to set up and validate locally
- Enable 2 feature flags:
Feature.enable(:enable_new_sentry_clientside_integration)
-
Feature.enable(:configure_sentry_in_application_settings)
.
- Testing on GDK requires disabling CSP on your browser (I temporarily used https://chrome.google.com/webstore/detail/disable-content-security/ieelmcmcagommplceebfedjlakkhpden, caution, don't keep this extension installed)
- Get the clientside DSN at https://new-sentry.gitlab.net/settings/gitlab/projects/gitlabcom-clientside/keys/, it looks like
https://XXXX@new-sentry.gitlab.net/4
- Enable Sentry at Admin -> Metrics and profiling http://gdk.test:3000/admin/application_settings/metrics_and_profiling#js-sentry-settings, with the setting you see here, plus the DSN:
- We use a
1,0
inClientside traces sample rate
so our tracing report is always sent. - Refresh the page, that should already send a request to Sentry.
- Verify the requests sent to Sentry: They should contain the correct
transaction
name. (this page happens to beadmin:application_settings:metrics_and_profiling
) - Clean up! Disable Sentry in your local.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #339332 (closed)