Skip to content

ci: Sentry reporting only on develop branch, with Git message overrides#27412

Merged
HowardBraham merged 1 commit intodevelopfrom
sentry-reporting-develop
Sep 28, 2024
Merged

ci: Sentry reporting only on develop branch, with Git message overrides#27412
HowardBraham merged 1 commit intodevelopfrom
sentry-reporting-develop

Conversation

@HowardBraham
Copy link
Copy Markdown
Contributor

@HowardBraham HowardBraham commented Sep 26, 2024

Description

Vaibhav asked for new Sentry reporting rates from CircleCI:

  • 10 times as frequent from the develop branch
  • Never from other branches

I also put in an override, such that if your Git message includes [flags.sentry.tracesSampleRate: x.xx] (a decimal number from 0.00 to 1.00), it will set tracesSampleRate to that fraction.

Moved what used to be at _flags.doNotForceSentryForThisTest to _flags.sentry.doNotForceSentryForThisTest

Open in GitHub Codespaces

Related issues

Improves on: #26588

Manual testing steps

  • You shouldn't see any Sentry reporting from this branch
  • Try a commit on top of this with a Git message including [flags.sentry.tracesSampleRate: 1.00], and it should report to Sentry

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@HowardBraham HowardBraham added the team-tiger-deprecated DEPRECATED: team no longer exists label Sep 26, 2024
@HowardBraham HowardBraham self-assigned this Sep 26, 2024
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@HowardBraham HowardBraham changed the title ci: sentry reporting only on develop branch, with git message overrides ci: Sentry reporting only on develop branch, with Git message overrides Sep 26, 2024
@HowardBraham HowardBraham force-pushed the sentry-reporting-develop branch from abd82c5 to 75ab8e0 Compare September 26, 2024 02:21
@HowardBraham HowardBraham marked this pull request as ready for review September 26, 2024 02:21
@HowardBraham HowardBraham requested a review from a team as a code owner September 26, 2024 02:21
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [abd82c5]
Page Load Metrics (1976 ± 116 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint31425301876426204
domContentLoaded153923871941226108
load154725381976242116
domInteractive21109572110
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 225 Bytes (0.00%)

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [75ab8e0]
Page Load Metrics (1820 ± 85 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15542409181117785
domContentLoaded15102360178617082
load15562415182017885
domInteractive17172543617
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 225 Bytes (0.00%)

Copy link
Copy Markdown

@v-goyal v-goyal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

doNotForceSentryForThisTest?: boolean;
sentry?: {
tracesSampleRate?: number;
doNotForceSentryForThisTest?: boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, could we remove the Sentry from this property as it's now implied by the parent property?

// Report very frequently on develop branch, and never on other branches
// (Unless you do a [flags.sentry.tracesSampleRate: x.xx] override)
if (flags.circleci.branch === 'develop') {
return 0.03;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, is it worth some constants for all these values for easier maintenance? Such as TRACES_SAMPLE_RATE_CIRCLE_CI_DEVELOP, TRACES_SAMPLE_RATE_CIRCLE_CI_OTHER, TRACES_SAMPLE_RATE_DEBUG etc?

}

// Grab the tracesSampleRate from the git message if it's set
function getTracesSampleRateFromGitMessage(): number | undefined {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal is to support this for specific PRs, is it possible to read this from the PR title or description via CircleCI?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthewwalsh0 This would require network calls to the GitHub API, which if we don't want to do it hundreds of times, is best done in get-changed-files-with-git-diff

Let's see if anyone even wants to use this system before we spend a lot of additional time on it.


// Search gitMessage for `[flags.sentry.tracesSampleRate: 0.000 to 1.000]`
const tracesSampleRateMatch = gitMessage.match(
/\[flags\.sentry\.tracesSampleRate: (0*(\.\d+)?|1(\.0*)?)\]/u,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, is it worth abstracting this into a getConfigFromGitMessage(flag: string): string so this can be used in future?

@HowardBraham HowardBraham merged commit d1b778c into develop Sep 28, 2024
@HowardBraham HowardBraham deleted the sentry-reporting-develop branch September 28, 2024 00:34
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.6.0 Issue or pull request that will be included in release 12.6.0 team-tiger-deprecated DEPRECATED: team no longer exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants