Skip to content

Commit 3c83357

Browse files
committed
ci: establish SENTRY_DSN_PERFORMANCE, and fix broken Sentry tags
1 parent d237d87 commit 3c83357

File tree

10 files changed

+33
-5
lines changed

10 files changed

+33
-5
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ jobs:
376376
TS_MIGRATION_DASHBOARD_TOKEN: ${{ secrets.TS_MIGRATION_DASHBOARD_TOKEN }}
377377

378378
build-source-map-explorer:
379+
if: ${{ github.event_name != 'merge_group' }} # Skip this job for the Merge Queue
379380
needs:
380381
- identify-builds
381382
- prep-deps

.github/workflows/run-benchmarks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
ARTIFACT_NAME: build-test${{ matrix.browser == 'firefox' && '-mv2' || '' }}-${{ matrix.buildType }}
4141
OUTPUT_NAME: benchmark-${{ matrix.browser }}-${{ matrix.buildType }}-${{ matrix.pageType }}.json
4242
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
43+
SENTRY_DSN_PERFORMANCE: ${{ vars.SENTRY_DSN_PERFORMANCE }}
4344
continue-on-error: true
4445
steps:
4546
- name: Checkout and setup environment

.github/workflows/run-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ jobs:
8686
ANALYTICS_DATA_DELETION_ENDPOINT: ${{ secrets.ANALYTICS_DATA_DELETION_ENDPOINT }}
8787
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
8888
SENTRY_DSN_DEV: ${{ secrets.SENTRY_DSN_DEV }}
89+
SENTRY_DSN_PERFORMANCE: ${{ vars.SENTRY_DSN_PERFORMANCE }}
8990
TZ: 'UTC' # Ensures the bundles are consistent across machine time zones
9091
VAPID_KEY: ${{ secrets.VAPID_KEY }}
9192
steps:

.github/workflows/run-e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060
# This is to support tests that set manifestFlags.testing.infuraProjectId, such as power-user.spec.ts
6161
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
62+
SENTRY_DSN_PERFORMANCE: ${{ vars.SENTRY_DSN_PERFORMANCE }}
6263
# For a `pull_request` event, the branch is `github.head_ref``.
6364
# For a `push` event, the branch is `github.ref_name`.
6465
BRANCH: ${{ github.head_ref || github.ref_name }}

.github/workflows/run-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585

8686
report-coverage:
8787
name: Report coverage
88+
if: ${{ github.event_name != 'merge_group' }} # Skip this job for the Merge Queue
8889
runs-on: ubuntu-latest
8990
timeout-minutes: 30
9091
needs:

app/scripts/lib/setupSentry.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const RELEASE = getSentryRelease(
2424
);
2525
const SENTRY_DSN = process.env.SENTRY_DSN;
2626
const SENTRY_DSN_DEV = process.env.SENTRY_DSN_DEV;
27+
const SENTRY_DSN_PERFORMANCE = process.env.SENTRY_DSN_PERFORMANCE;
2728
/* eslint-enable prefer-destructuring */
2829

2930
// This is a fake DSN that can be used to test Sentry without sending data to the real Sentry server.
@@ -101,6 +102,8 @@ function getClientOptions() {
101102
// `false`.
102103
sendClientReports: false,
103104
tracesSampleRate: getTracesSampleRate(sentryTarget),
105+
// If we are reporting to SENTRY_DSN_PERFORMANCE, we want to ignore all errors.
106+
ignoreErrors: sentryTarget === SENTRY_DSN_PERFORMANCE ? [/.*/u] : undefined,
104107
transport: makeTransport,
105108
};
106109
}
@@ -125,12 +128,12 @@ function getTracesSampleRate(sentryTarget) {
125128
}
126129

127130
if (flags.ci) {
128-
// Report very frequently on main branch, and never on other branches
131+
// Report more frequently on main branch, and less frequently on other branches
129132
// (Unless you use a `flags = {"sentry": {"tracesSampleRate": x.xx}}` override)
130133
if (flags.ci.branch === 'main') {
131134
return 0.015;
132135
}
133-
return 0;
136+
return 0.001;
134137
}
135138

136139
if (METAMASK_DEBUG) {
@@ -205,13 +208,19 @@ function getSentryEnvironment() {
205208
}
206209

207210
function getSentryTarget() {
211+
const manifestFlags = getManifestFlags();
212+
208213
if (
209214
process.env.IN_TEST &&
210-
(!SENTRY_DSN_DEV || !getManifestFlags().sentry?.forceEnable)
215+
(!SENTRY_DSN_DEV || !manifestFlags.sentry?.forceEnable)
211216
) {
212217
return SENTRY_DSN_FAKE;
213218
}
214219

220+
if (manifestFlags.ci?.enabled && SENTRY_DSN_PERFORMANCE) {
221+
return SENTRY_DSN_PERFORMANCE;
222+
}
223+
215224
if (METAMASK_ENVIRONMENT !== 'production') {
216225
return SENTRY_DSN_DEV;
217226
}

builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ env:
315315
- SEGMENT_HOST: null
316316
- SENTRY_DSN: null
317317
- SENTRY_DSN_DEV: null
318+
- SENTRY_DSN_PERFORMANCE: null
318319
# also INFURA_PROJECT_ID below
319320

320321
###

test/e2e/benchmarks/benchmark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function measurePageStandard(
4040
{
4141
fixtures: new FixtureBuilder().build(),
4242
disableServerMochaToBackground: true,
43-
title: 'benchmark-pageload',
43+
title: 'measurePageStandard',
4444
},
4545
async ({ driver, getNetworkReport, clearNetworkReport }) => {
4646
await unlockWallet(driver);

test/e2e/mock-e2e.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,19 @@ async function setupMocking(
331331
};
332332
});
333333

334+
// SENTRY_DSN_PERFORMANCE
335+
await server
336+
.forPost('https://sentry.io/api/4510302346608640/envelope/')
337+
.thenPassThrough({
338+
beforeRequest: (req) => {
339+
console.log(
340+
'Request going to Sentry metamask-performance ============',
341+
req.url,
342+
);
343+
return {};
344+
},
345+
});
346+
334347
await server
335348
.forGet('https://www.4byte.directory/api/v1/signatures/')
336349
.thenCallback(() => {

test/e2e/set-manifest-flags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function setManifestFlags(flags: ManifestFlags = {}) {
3232
enabled: true,
3333
branch: process.env.BRANCH,
3434
commitHash: process.env.HEAD_COMMIT_HASH,
35-
job: process.env.JOB_NAME,
35+
job: process.env.JOB_NAME?.split(' ')[0], // Remove matrix info
3636
matrixIndex: parseIntOrUndefined(process.env.MATRIX_INDEX),
3737
prNumber: parseIntOrUndefined(process.env.PR_NUMBER),
3838
};

0 commit comments

Comments
 (0)