Skip to content
Snippets Groups Projects

Install two versions of Sentry Client SDK

Merged Miguel Rincon requested to merge mrincon-sentry-double-integration into master
All threads resolved!

What does this MR do and why?

This MR is a follow up to !102650 (merged).

It installs two versions of the Sentry browser SDK so we can toggle reporting errors to two a new Sentry instance:

  • Disabled feature flag: Use Sentry SDK v5 and report to the Sentry v9 DSN in the config (gitlab.yml)
  • Enabled feature flag: Use Sentry SDK v7 and report to the Sentry v22+ DSN in the settings (Admin UI values)

Note

20+ files changed! Wow!

Yes, I've had to change many files but most of the lines changes are small changes

  • Move current sentry js files to have a legacy_ prefix and add the new ones
  • Add the new Sentry 7 dependency with an alias, which leads to a few changes in webpack and jest config.
  • A few repetitive specs for the feature flag state checks.

I've split this change into different MRs, but this last one is the largest one:

Remove unusable Sentry feature flag (!104231 - merged)
Move and rename Sentry constants (!104247 - merged)
Install two versions of Sentry Client SDK (!102790 - merged) you are here :point_up:

Use case

This rollout is enabled by having two sets of Sentry settings in our gitlab instance at once, the GitLab instance config (from gitlab.yml) and the settings (the UI). A rollout could consist of:

  1. Ensure the Sentry config (e.g. in gitabl.yml) is present for the old Sentry instance (v9).
  2. Enable configure_sentry_in_application_settings the enable Admin UI Sentry settings.
  3. Visit /admin/application_settings/metrics_and_profiling to configure the Sentry settings for the new Sentry instance.
  4. Progressive rollout of enable_new_sentry_clientside_integration to users. Users with the feature flag enabled will begin reporting to the new instance.
    • The recommended rollout method is percentage: 5%, 10%, ...
  5. Once the rollout is complete, remove the dangling dependencies and remove this feature flag.

Screenshots or screen recordings

Errors appear to be reported the new Sentry instance:

2022-11-15_12.31.53

How to set up and validate locally

  1. Check out this branch and install run yarn.

  2. This MR installs two versions of the Sentry Browser GDK, so we should test two integrations:

Legacy Integration

  1. Ensure the feature flag for the new integration is disabled Feature.disable(:enable_new_sentry_clientside_integration)

  2. Add Sentry (v9) DSN in gitlab.yml:

  ## Error Reporting and Logging with Sentry
  sentry:
    enabled: true
    dsn: https://XXXX@sentry.gitlab.net/1
    clientside_dsn: https://XXXX@sentry.gitlab.net/1
    environment: 'development'
  1. Confirm events are captured by the old Sentry instance

New integration

  1. Enable the feature flags to enable the new integration and the UI settings panel:

    • Feature.enable(:enable_new_sentry_clientside_integration)
    • Feature.enable(:configure_sentry_in_application_settings)
  2. Setup the Sentry (newer version) DSN at: http://gdk.test:3000/admin/application_settings/metrics_and_profiling

  3. Confirm events are captured by the new Sentry instance

Simulate triggering an error

To ensure I can trigger an error consistently, I added a mock button in `/admin/runners`.
diff --git a/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue b/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue
index 2915e4600855..fd04e7b3e4e1 100644
--- a/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue
+++ b/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue
@@ -1,4 +1,5 @@
 <script>
+import * as Sentry from '@sentry/browser';
 import { GlLink } from '@gitlab/ui';
 import { createAlert } from '~/flash';
 import { updateHistory } from '~/lib/utils/url_utility';
@@ -152,6 +153,9 @@ export default {
     onPaginationInput(value) {
       this.search.pagination = value;
     },
+    reportError() {
+      Sentry.captureException(new Error('test error'));
+    },
   },
   filteredSearchNamespace: ADMIN_FILTERED_SEARCH_NAMESPACE,
   INSTANCE_TYPE,
@@ -160,6 +164,7 @@ export default {
 </script>
 <template>
   <div>
+    <gl-link @click="reportError">Report Error Here!</gl-link>
     <div
       class="gl-display-flex gl-align-items-center gl-flex-direction-column-reverse gl-md-flex-direction-row gl-mt-3 gl-md-mt-0"
     >

After I visit http://gdk.test:3000/admin/runners to report an error on each click.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Miguel Rincon

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Miguel Rincon
  • Miguel Rincon
  • Miguel Rincon requested review from @leipert

    requested review from @leipert

  • Miguel Rincon changed the description

    changed the description

  • mentioned in issue #382570 (closed)

  • Lukas Eipert
  • Lukas Eipert
  • Lukas Eipert
  • Lukas Eipert
  • Lukas Eipert
  • Miguel Rincon changed the description

    changed the description

  • Miguel Rincon added 1 commit

    added 1 commit

    • 41320293 - Install two versions of Sentry

    Compare with previous version

  • Miguel Rincon added 2 commits

    added 2 commits

    • 65b6ae3f - Install two versions of Sentry
    • eddb5367 - Load only one sentry version to reduce bundle size

    Compare with previous version

  • Miguel Rincon added 1 commit

    added 1 commit

    • 3c32d788 - Load only one sentry version to reduce bundle size

    Compare with previous version

  • Miguel Rincon requested review from @kmorrison1

    requested review from @kmorrison1

  • Miguel Rincon changed target branch from master to mrincon-sentry-remove-unsable-feature-flag

    changed target branch from master to mrincon-sentry-remove-unsable-feature-flag

  • Miguel Rincon added 304 commits

    added 304 commits

    • 3c32d788...6dd9b118 - 301 commits from branch mrincon-sentry-remove-unsable-feature-flag
    • 2aeb0f63 - Move sentry constants to separate file
    • 16118924 - Install two versions of Sentry
    • fb74323c - Load only one sentry version to reduce bundle size

    Compare with previous version

  • Miguel Rincon added 3 commits

    added 3 commits

    • 0c436012 - Move and rename Sentry constants
    • 0e0bc9c3 - Install two versions of Sentry
    • 3693b8f7 - Load only one sentry version to reduce bundle size

    Compare with previous version

  • Miguel Rincon changed target branch from mrincon-sentry-remove-unsable-feature-flag to mrincon-sentry-constants

    changed target branch from mrincon-sentry-remove-unsable-feature-flag to mrincon-sentry-constants

  • Miguel Rincon added 1 commit

    added 1 commit

    • 9deb13aa - Load only one sentry version to reduce bundle size

    Compare with previous version

  • Miguel Rincon mentioned in merge request !104247 (merged)

    mentioned in merge request !104247 (merged)

  • Miguel Rincon mentioned in merge request !104231 (merged)

    mentioned in merge request !104231 (merged)

  • Miguel Rincon changed the description

    changed the description

  • Miguel Rincon changed the description

    changed the description

  • Kevin Morrison requested review from @dcouture

    requested review from @dcouture

  • Kevin Morrison removed review request for @kmorrison1

    removed review request for @kmorrison1

  • Miguel Rincon deleted the mrincon-sentry-constants branch. This merge request now targets the master branch

    deleted the mrincon-sentry-constants branch. This merge request now targets the master branch

  • Miguel Rincon added 114 commits

    added 114 commits

    Compare with previous version

  • Dominic Couture
  • Miguel Rincon added 1 commit

    added 1 commit

    • c4a4af83 - Remove sentry SDK duplicated package.json entry

    Compare with previous version

  • Miguel Rincon added 1 commit

    added 1 commit

    • 1c0e3506 - Add tests to wrapper and fix failures

    Compare with previous version

  • Dominic Couture approved this merge request

    approved this merge request

  • Dominic Couture removed review request for @dcouture

    removed review request for @dcouture

  • :wave: @dcouture, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.

    For more info, please refer to the following links:

  • 🤖 GitLab Bot 🤖 added 1 deleted label

    added 1 deleted label

  • Miguel Rincon added 1 commit

    added 1 commit

    • bebf45f4 - Add tests to wrapper and fix failures

    Compare with previous version

  • Miguel Rincon requested review from @mikegreiling

    requested review from @mikegreiling

  • Author Maintainer

    @jon_jenkins can you help me review change? Thanks!

  • Miguel Rincon requested review from @jon_jenkins

    requested review from @jon_jenkins

  • requested review from @richard.chong

  • Miguel Rincon changed the description

    changed the description

  • Miguel Rincon changed the description

    changed the description

  • Jon Jenkins
  • Miguel Rincon added 1 commit

    added 1 commit

    Compare with previous version

  • 🤖 GitLab Bot 🤖 changed milestone to %15.7

    changed milestone to %15.7

  • Miguel Rincon changed the description

    changed the description

  • Everything else on my end looks great other than one discussion on regexes. Let me know what you think!

  • Miguel Rincon added 613 commits

    added 613 commits

    • 55438303...79761cbc - 607 commits from branch master
    • 1e90b3bd - Install two versions of Sentry
    • 88acb457 - Load only one sentry version to reduce bundle size
    • 2bf1b5fb - Improve test coverage for CSP
    • cb648c15 - Remove sentry SDK duplicated package.json entry
    • f254a626 - Add tests to wrapper and fix failures
    • 21faf634 - Address review comments

    Compare with previous version

  • Lukas Eipert
  • Lukas Eipert mentioned in issue #383349

    mentioned in issue #383349

  • Lukas Eipert approved this merge request

    approved this merge request

  • Miguel Rincon removed review request for @leipert

    removed review request for @leipert

  • Richard Chong approved this merge request

    approved this merge request

  • Richard Chong removed review request for @richard.chong

    removed review request for @richard.chong

  • Miguel Rincon mentioned in issue #383551

    mentioned in issue #383551

  • Mike Greiling approved this merge request

    approved this merge request

  • Mike Greiling
  • Mike Greiling removed review request for @mikegreiling

    removed review request for @mikegreiling

  • Jon Jenkins approved this merge request

    approved this merge request

  • @mrincon looks good to me as well! Thanks!

  • Jon Jenkins removed review request for @jon_jenkins

    removed review request for @jon_jenkins

  • Miguel Rincon resolved all threads

    resolved all threads

  • Miguel Rincon added 435 commits

    added 435 commits

    • 21faf634...7cb80375 - 428 commits from branch master
    • dfc3f50e - Install two versions of Sentry
    • 9d4a2fc6 - Load only one sentry version to reduce bundle size
    • e1e51772 - Improve test coverage for CSP
    • 8ed99486 - Remove sentry SDK duplicated package.json entry
    • 156e7854 - Add tests to wrapper and fix failures
    • 7df55747 - Address review comments
    • 80e500fd - Upgrade to latest Sentry 7 and make version checks

    Compare with previous version

  • Miguel Rincon requested review from @mikegreiling

    requested review from @mikegreiling

  • Miguel Rincon requested review from @smcgivern

    requested review from @smcgivern

  • Sean McGivern
  • Sean McGivern
  • Sean McGivern approved this merge request

    approved this merge request

  • Sean McGivern removed review request for @smcgivern

    removed review request for @smcgivern

  • Mike Greiling approved this merge request

    approved this merge request

  • Mike Greiling resolved all threads

    resolved all threads

  • merged

  • @mikegreiling, did you forget to run a pipeline before you merged this work? Based on our code review process, if the latest pipeline finished more than 2 hours ago, you should:

    1. Ensure the merge request is not in Draft status.
    2. Start a pipeline (especially important for Community contribution merge requests).
    3. Set the merge request to merge when pipeline succeeds.

    This is a guideline, not a rule. Please consider replying to this comment for transparency.

    This message was generated automatically. You're welcome to improve it.

  • Mike Greiling mentioned in commit e810e626

    mentioned in commit e810e626

  • Rémy Coutable mentioned in commit 6dcf7ca2

    mentioned in commit 6dcf7ca2

  • Rémy Coutable mentioned in merge request !105252 (merged)

    mentioned in merge request !105252 (merged)

  • Miguel Rincon mentioned in merge request !105323 (closed)

    mentioned in merge request !105323 (closed)

  • Miguel Rincon mentioned in merge request !105324 (merged)

    mentioned in merge request !105324 (merged)

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading