Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: followup to CircleCI Sentry reporting #27548

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

HowardBraham
Copy link
Contributor

@HowardBraham HowardBraham commented Oct 1, 2024

Description

Implementing some suggestions from @matthewwalsh0 from #27412

Also incorporates changes from @legobeat's #27268

  • Renamed doNotForceSentryForThisTest to doNotForceForThisTest because the Sentry is now implied by the parent property
  • Abstracted to addFlagsFromPrBody() and addFlagsFromGitMessage() functions
    • Only supports one flag right now (tracesSampleRate) but it's built to be easily extendable for anything
    • It's now an incredibly powerful general way to pass runtime flags into the Extension in CircleCI, either through the PR body or through the Git commit message
    • In either the PR body or the Git commit message, add a line like
      flags = {"sentry": {"tracesSampleRate": x.xx}}
      If you do both, Git commit message takes precedence
    • This changes the format from
      [flags.sentry.tracesSampleRate: x.xx] to
      flags = {"sentry": {"tracesSampleRate": x.xx}}

Note: This PR, as is, will hit the following error because it's trying to actually parse the sample code above with x.xx. The good news is it fails gracefully.

Error parsing flags from PR body, ignoring flags
 SyntaxError: Unexpected token 'x', ..."pleRate": x.xx}}" is not valid JSON

Open in GitHub Codespaces

Related issues

Followup to: #27412

Manual testing steps

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.

Copy link
Contributor

github-actions bot commented Oct 1, 2024

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.

@github-actions github-actions bot added the team-contributor-experience MetaMask Contributor Experience Group label Oct 1, 2024
@HowardBraham HowardBraham changed the title Sentry reporting develop ci: followup to CircleCI Sentry reporting Oct 1, 2024
@HowardBraham HowardBraham added team-tiger Tiger team (for tech debt reduction + performance improvements) and removed team-contributor-experience MetaMask Contributor Experience Group labels Oct 1, 2024
@HowardBraham HowardBraham self-assigned this Oct 1, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [a6d14e0]
Page Load Metrics (1780 ± 96 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint26025321647509244
domContentLoaded15502275175117483
load15572404178019996
domInteractive157042147
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -12 Bytes (-0.00%)

@HowardBraham HowardBraham force-pushed the sentry-reporting-develop branch 5 times, most recently from f8bbc5b to 7f0edcf Compare October 2, 2024 01:03
.circleci/scripts/git-diff-develop.ts Outdated Show resolved Hide resolved
.circleci/scripts/git-diff-develop.ts Outdated Show resolved Hide resolved
.circleci/scripts/git-diff-develop.ts Outdated Show resolved Hide resolved
}
return diffResult;
}

function writePrBodyToFile(prBody: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Why is the PR body written to file? Is there something that prevents it from being passed differently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. This needs to get to all of the test-e2e-* VMs. I'm trying to avoid calling api.github.com hundreds of times, and instead store it in artifacts.

@metamaskbot
Copy link
Collaborator

Builds ready [18502f9]
Page Load Metrics (2089 ± 186 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint25625301831589283
domContentLoaded168334042064384185
load169234092089388186
domInteractive18416678340
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -12 Bytes (-0.00%)

@HowardBraham HowardBraham marked this pull request as ready for review October 2, 2024 02:37
@HowardBraham HowardBraham requested review from kumavis and a team as code owners October 2, 2024 02:37
legobeat
legobeat previously approved these changes Oct 8, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [038a11c]
Page Load Metrics (1930 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint44926441849385185
domContentLoaded16672540190820297
load16862570193020297
domInteractive24112532512
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -12 Bytes (-0.00%)

matthewwalsh0
matthewwalsh0 previously approved these changes Oct 8, 2024
@Gudahtt
Copy link
Member

Gudahtt commented Oct 8, 2024

What is the intended purpose of this feature? i.e. when would we want to update the Sentry trace rate from a PR description. I see that this capability was added already in #27412, but I don't see a reference to its purpose there either.

Edit: I see, tracing is entirely disabled on PRs by default, so this would be for getting performance metrics from PRs I suppose. Makes sense.

Gudahtt
Gudahtt previously requested changes Oct 8, 2024
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

Generally this looks good! But it would be ideal to make the unrelated changes to git-diff-develop in a separate PR. This is recommended by our contributor guidelines not just to make review easier and more effective, but also to make the git history easier to audit.

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

sonarcloud bot commented Oct 8, 2024

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

@metamaskbot
Copy link
Collaborator

Builds ready [2d953bf]
Page Load Metrics (1860 ± 66 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16362217186214569
domContentLoaded16252212182214369
load16392216186013866
domInteractive249941199
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -66 Bytes (-0.00%)

@HowardBraham HowardBraham added this pull request to the merge queue Oct 10, 2024
Merged via the queue into develop with commit 687cf3a Oct 10, 2024
83 of 84 checks passed
@HowardBraham HowardBraham deleted the sentry-reporting-develop branch October 10, 2024 08:01
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2024
@metamaskbot metamaskbot added the release-12.7.0 Issue or pull request that will be included in release 12.7.0 label Oct 10, 2024
@@ -238,7 +238,7 @@ function getSentryEnvironment() {

function getSentryTarget() {
if (
getManifestFlags().sentry?.doNotForceSentryForThisTest ||
!getManifestFlags().sentry?.forceEnable ||
Copy link
Member

Choose a reason for hiding this comment

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

We need to change the || here to && because we flipped the meaning of the flag

@gauthierpetetin gauthierpetetin added release-12.6.0 Issue or pull request that will be included in release 12.6.0 and removed release-12.7.0 Issue or pull request that will be included in release 12.7.0 labels Oct 21, 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 Tiger team (for tech debt reduction + performance improvements)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants