Skip to content

Commit

Permalink
feat: beta.5 (#19063)
Browse files Browse the repository at this point in the history
  • Loading branch information
HazAT committed May 28, 2020
1 parent 8e90724 commit 2f59d44
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 109 deletions.
57 changes: 19 additions & 38 deletions build-utils/sentry-instrumentation.js
Expand Up @@ -24,7 +24,7 @@ class SentryInstrumentation {

this.initialBuild = false;
this.Sentry = require('@sentry/node');
require('@sentry/apm');
require('@sentry/apm'); // This is required to patch Sentry

this.Sentry.init({
dsn: 'https://3d282d186d924374800aa47006227ce9@sentry.io/2053674',
Expand All @@ -46,22 +46,10 @@ class SentryInstrumentation {
);
}

/**
* Waits for Sentry SDK to finish requests
*/
async sdkFinish() {
const client = this.Sentry.getCurrentHub().getClient();
if (client) {
await client.flush();
}
}

/**
* Measures the file sizes of assets emitted from the entrypoints
*/
measureAssetSizes(compilation) {
const hub = this.Sentry.getCurrentHub();

[...compilation.entrypoints].forEach(([entrypointName, entry]) =>
entry.chunks.forEach(chunk =>
chunk.files
Expand All @@ -70,20 +58,21 @@ class SentryInstrumentation {
const asset = compilation.assets[assetName];
const sizeInKb = asset.size() / 1024;

const transaction = hub.startSpan({
const transaction = this.Sentry.startTransaction({
op: 'webpack-asset',
transaction: assetName,
name: assetName,
description: `webpack bundle size for ${entrypointName} -> ${assetName}`,
data: {
entrypointName,
file: assetName,
size: `${Math.round(sizeInKb)} KB`,
},
trimEnd: true,
});

const start = transaction.startTimestamp;

const span = hub.startSpan({
const span = transaction.startChild({
op: 'asset',
startTimestamp: start,
description: assetName,
Expand All @@ -93,10 +82,8 @@ class SentryInstrumentation {
size: `${Math.round(sizeInKb)} KB`,
},
});
span.startTimestamp = start;
span.finish();
span.timestamp = start + sizeInKb / 1000;
transaction.finish(true);
span.finish(start + sizeInKb / 1000);
transaction.finish();
})
)
);
Expand All @@ -107,19 +94,15 @@ class SentryInstrumentation {
return;
}

const hub = this.Sentry.getCurrentHub();

const transaction = hub.startSpan(
{
op: 'webpack-build',
transaction: !this.initialBuild ? 'initial-build' : 'incremental-build',
description: 'webpack build times',
},
true
);
transaction.startTimestamp = startTime;
const transaction = this.Sentry.startTransaction({
op: 'webpack-build',
name: !this.initialBuild ? 'initial-build' : 'incremental-build',
description: 'webpack build times',
startTimestamp: startTime,
trimEnd: true,
});

const span = transaction.child({
const span = transaction.startChild({
op: 'build',
description: 'webpack build',
data: {
Expand All @@ -131,12 +114,10 @@ class SentryInstrumentation {
: 'N/A',
loadavg: os.loadavg(),
},
startTimestamp: startTime,
});
span.startTimestamp = startTime;
span.finish();
span.timestamp = endTime;

transaction.finish(true);
span.finish(endTime);
transaction.finish();
}

apply(compiler) {
Expand All @@ -156,7 +137,7 @@ class SentryInstrumentation {
}

this.initialBuild = true;
await this.sdkFinish();
await this.Sentry.flush();
done();
}
);
Expand Down
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -20,12 +20,12 @@
"@emotion/babel-preset-css-prop": "^10.0.27",
"@emotion/core": "^10.0.27",
"@emotion/styled": "^10.0.27",
"@sentry/apm": "5.16.0-beta.3",
"@sentry/browser": "5.16.0-beta.3",
"@sentry/integrations": "5.16.0-beta.3",
"@sentry/apm": "5.16.0-beta.5",
"@sentry/browser": "5.16.0-beta.5",
"@sentry/integrations": "5.16.0-beta.5",
"@sentry/release-parser": "^0.5.0",
"@sentry/rrweb": "^0.1.1",
"@sentry/utils": "5.16.0-beta.3",
"@sentry/utils": "5.16.0-beta.5",
"@types/classnames": "^2.2.0",
"@types/clipboard": "^2.0.1",
"@types/color": "^3.0.0",
Expand Down Expand Up @@ -133,7 +133,7 @@
"devDependencies": {
"@babel/plugin-transform-react-jsx-source": "^7.2.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.3.1",
"@sentry/node": "^5.16.0-beta.3",
"@sentry/node": "5.16.0-beta.5",
"@storybook/addon-a11y": "^5.3.3",
"@storybook/addon-actions": "^5.3.3",
"@storybook/addon-docs": "^5.3.3",
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/static/sentry/app/bootstrap.tsx
Expand Up @@ -86,10 +86,10 @@ Sentry.init({
...window.__SENTRY__OPTIONS,
integrations: getSentryIntegrations(hasReplays),
tracesSampleRate,
_experiments: {useEnvelope: true},
async beforeSend(event) {
return normalizeTransactionName(appRoutes, event);
},
});

Sentry.addGlobalEventProcessor(async event => {
return normalizeTransactionName(appRoutes, event);
});

if (window.__SENTRY__USER) {
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/static/sentry/app/utils/apm.tsx
Expand Up @@ -57,7 +57,7 @@ export async function normalizeTransactionName(

set(event, ['tags', 'transaction.rename.router-match'], 'success');

const routePath = getRouteStringFromRoutes(renderProps.routes ?? []);
const routePath = getRouteStringFromRoutes(renderProps?.routes ?? []);

if (routePath.length === 0 || routePath === '/*') {
return resolve(window.location.pathname);
Expand Down
122 changes: 61 additions & 61 deletions yarn.lock
Expand Up @@ -1823,76 +1823,76 @@
react-lifecycles-compat "^3.0.4"
warning "^3.0.0"

"@sentry/apm@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/apm/-/apm-5.16.0-beta.3.tgz#e241cbd9a308e301a681c086e1096b47c04d225a"
integrity sha512-3PmDRh9Hsj+Wfnq5+eWq/RA7CvExlWHCEK2AJZ5pG1WjvWuQ9nj8MXiVNoIA7t2WGujCcEFoDJuUofsMTekdWA==
dependencies:
"@sentry/browser" "5.16.0-beta.3"
"@sentry/hub" "5.16.0-beta.3"
"@sentry/minimal" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.3"
"@sentry/utils" "5.16.0-beta.3"
"@sentry/apm@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/apm/-/apm-5.16.0-beta.5.tgz#ca715ea1ae8da1194d44fbbab7b6e4c3815491ec"
integrity sha512-sN2WWnx7TPMY95qk+rFoawCA8duCRzRYtRC3otQ3lp8KR0a9bnfVHDlQFntw/tp4tMSstX5YotJTalM7eI9dew==
dependencies:
"@sentry/browser" "5.16.0-beta.5"
"@sentry/hub" "5.16.0-beta.5"
"@sentry/minimal" "5.16.0-beta.5"
"@sentry/types" "5.16.0-beta.5"
"@sentry/utils" "5.16.0-beta.5"
tslib "^1.9.3"

"@sentry/browser@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.16.0-beta.3.tgz#176a0ed01e567c6c0fb59248801b9dcff97e3836"
integrity sha512-mHTrXBSRA9oCG9VukyrB2U6xiqQ2yK5oDsWdt1HDB8ApwOSdOZPfV5TbgfvNa6hEIbLhjbFC0AyQcRgkANveDg==
"@sentry/browser@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.16.0-beta.5.tgz#e230cd34950731ad702e6b728bbeeea9c7e4d14a"
integrity sha512-DTmvGDehbTLlic8ocO3xT32MaKs8WktDdAFT+xJlCbdnIuM3IYi/ucgKbbVDEIt+W0EuZzUofAaMWf5w/B+Xpg==
dependencies:
"@sentry/core" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.3"
"@sentry/utils" "5.16.0-beta.3"
"@sentry/core" "5.16.0-beta.5"
"@sentry/types" "5.16.0-beta.5"
"@sentry/utils" "5.16.0-beta.5"
tslib "^1.9.3"

"@sentry/core@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.16.0-beta.3.tgz#b2a60fb8a81c19f5321a9e3bb17d372aaed74a46"
integrity sha512-9owqHefHt2dv+2bxcic9inneOrji9El9PqkwbRNxIcsduO6+Tu6nFJokBlxUZFi1eKpuAoOjjp0loaYvStKfNw==
"@sentry/core@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.16.0-beta.5.tgz#e0fb8e91a6278b811b938380fab21b11acd07676"
integrity sha512-WLqfVgWl6bHjrx0RS+hy5NDko3EqVGyQ0sjl3tBgl38Rttcvs5V+5NRqBqL7UJXupVCB+uVO77ocnFzHYF6OBw==
dependencies:
"@sentry/hub" "5.16.0-beta.3"
"@sentry/minimal" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.3"
"@sentry/utils" "5.16.0-beta.3"
"@sentry/hub" "5.16.0-beta.5"
"@sentry/minimal" "5.16.0-beta.5"
"@sentry/types" "5.16.0-beta.5"
"@sentry/utils" "5.16.0-beta.5"
tslib "^1.9.3"

"@sentry/hub@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.16.0-beta.3.tgz#51c72daa459215654291f38cbdc7e8eb410cfd72"
integrity sha512-yGNnz4nafrjkk6XMDhpAcLwWUGPMShZKOOvYLrBa02Y7mOh+3mBcUaZmGnVA+X1M8idwE72LE1WRkJzBv6t9QA==
"@sentry/hub@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.16.0-beta.5.tgz#80310af8aac6bd183171e9756bfb3f14bff0e9d9"
integrity sha512-+IxvYSSUNPsk5sLD3LydoLt+vXchC2bb2CsOnI3+anXsaYKR9PCYgIQ6+6vBitwWASQkoiw9Jyqr4dmjufi5Bg==
dependencies:
"@sentry/types" "5.16.0-beta.3"
"@sentry/utils" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.5"
"@sentry/utils" "5.16.0-beta.5"
tslib "^1.9.3"

"@sentry/integrations@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-5.16.0-beta.3.tgz#8ecc5018a35b2917225c78dfdcda2d406616336d"
integrity sha512-pC4I1PKK+/FORGElPGFXT7thH3A+xqyPi4QQ8lBLkzKBNn/STvXZhx33nqLGnf6OoihZqpn9GNAGzvGpo7AR2w==
"@sentry/integrations@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-5.16.0-beta.5.tgz#4c55d81ec0e145625b974cfc9b37974103bd3550"
integrity sha512-MR6pWG9WJqytn4ZA+Y84rV7gA9pNucGrh2LzaJyHCnpVVPQFgmjw8dn7v2YGqdywCQQV49YZXW9H2+cB/q57Vw==
dependencies:
"@sentry/types" "5.16.0-beta.3"
"@sentry/utils" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.5"
"@sentry/utils" "5.16.0-beta.5"
tslib "^1.9.3"

"@sentry/minimal@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.16.0-beta.3.tgz#9340b21e7259f015efbfa932b6f48f42cdf72c0a"
integrity sha512-YUksBXrUp8lRwE40fsWRu6B7YJ/f1d+klyFxyc4ECDCWtByTa80SOwmvwhrApADzFa4g9v/wGXC+KTYybGb3Tg==
"@sentry/minimal@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.16.0-beta.5.tgz#6b8aa1913b79537dc69f2636a6ee94a12cd6e950"
integrity sha512-noGo5MJQf/7ureXyxWomGJbFwiFrQuTlrgZ5ZXwCCtnH4Qh5wlrusSmKgIs0/P42UtmiOLuExcQPtDgT4Z9y6Q==
dependencies:
"@sentry/hub" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.3"
"@sentry/hub" "5.16.0-beta.5"
"@sentry/types" "5.16.0-beta.5"
tslib "^1.9.3"

"@sentry/node@^5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.16.0-beta.3.tgz#5debe9c29dd9bbaf8acce9d665b2c1d48ab11b3c"
integrity sha512-69cIGhK+0H8PpWizJhvnpbFAoAsSvqGnHUk8tr3VjchdhgVqV1fZSPijqs2VIj/2RUN3r6Hl6XVGLr7Cu1gLmg==
"@sentry/node@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.16.0-beta.5.tgz#74f1014b4a0798a927578ca04b570e460733ca70"
integrity sha512-2zBtIoQaMyoGYYw9wb8Q76NuRhlofzVPz9q1oNR4uIKUhufbeDQr3ncrHPU19jqR8ui55MnFTyTdO75MjjQQfQ==
dependencies:
"@sentry/apm" "5.16.0-beta.3"
"@sentry/core" "5.16.0-beta.3"
"@sentry/hub" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.3"
"@sentry/utils" "5.16.0-beta.3"
"@sentry/apm" "5.16.0-beta.5"
"@sentry/core" "5.16.0-beta.5"
"@sentry/hub" "5.16.0-beta.5"
"@sentry/types" "5.16.0-beta.5"
"@sentry/utils" "5.16.0-beta.5"
cookie "^0.3.1"
https-proxy-agent "^4.0.0"
lru_map "^0.3.3"
Expand All @@ -1908,17 +1908,17 @@
resolved "https://registry.yarnpkg.com/@sentry/rrweb/-/rrweb-0.1.1.tgz#1e2ef7381d5c5725ea3bf3ac20987d50eee83dd1"
integrity sha512-bFzZ+NVaGFpkmBvSHsvM/Pc/wiy7UeP/ICofkY2iY5PwiRHpZCX5hLrLYA7o921VR847EKZB44fQYWZC1YFB1Q==

"@sentry/types@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.16.0-beta.3.tgz#0658562166aac515977b3a979ced9af01dca153c"
integrity sha512-UfIYazvDhOV/dcfFg8OvA8mR1mcOmRE3m2F6qn2jJiQbccKUSXKsaZRXdk/Dj2c0862VFY+wSxpVgG+Vjb0frQ==
"@sentry/types@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.16.0-beta.5.tgz#1735cd2a24a9259b301eb2f115c5db4422a948b0"
integrity sha512-/ARDVbBJIGCQywmzpX1x/EhSu3fJtyaaOE/ZGFAgHk4oTQKmw36ZgwksKYCsaEv5A0b7c+99/RwzWht1+SNh7Q==

"@sentry/utils@5.16.0-beta.3":
version "5.16.0-beta.3"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.16.0-beta.3.tgz#8d40d2b88e46ad97ac9356f5e627ece23dcb08b0"
integrity sha512-PXFWvC5kSvOSVPlK6xylmPcILNEjBkcBBPmWmvSR8r2he70JmeFDGHkhNP9LaLydcCBZ/eH59bCQqD1sWgTbow==
"@sentry/utils@5.16.0-beta.5":
version "5.16.0-beta.5"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.16.0-beta.5.tgz#36c96c93a0ccef33f1a039320a8ddc58d3d416a9"
integrity sha512-c93f04s2YE4yTWrfgQlFv/V8UQzJuf4ZvpJDssRhbuz1CiRNzPvCQsvEwuKJW2jgCaDjPD9r8KVws4FkGOKmcA==
dependencies:
"@sentry/types" "5.16.0-beta.3"
"@sentry/types" "5.16.0-beta.5"
tslib "^1.9.3"

"@storybook/addon-a11y@^5.3.3":
Expand Down

0 comments on commit 2f59d44

Please sign in to comment.