Skip to content

Commit

Permalink
Merge pull request #9965 from getsentry/prepare-release/7.91.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 authored Dec 22, 2023
2 parents d76ed4f + f08bec8 commit 17f490e
Show file tree
Hide file tree
Showing 369 changed files with 4,878 additions and 3,394 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = {
},
},
{
files: ['scenarios/**', 'rollup/**'],
files: ['scenarios/**', 'packages/rollup-utils/**'],
parserOptions: {
sourceType: 'module',
},
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ jobs:
- 'CHANGELOG.md'
- '.github/**'
- 'jest/**'
- 'rollup/**'
- 'scripts/**'
- 'packages/core/**'
- 'packages/rollup-utils/**'
- 'packages/tracing/**'
- 'packages/tracing-internal/**'
- 'packages/utils/**'
Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:
# so no need to reinstall them
- name: Compute dependency cache key
id: compute_lockfile_hash
run: echo "hash=${{ hashFiles('yarn.lock') }}" >> "$GITHUB_OUTPUT"
run: echo "hash=${{ hashFiles('yarn.lock', '**/package.json') }}" >> "$GITHUB_OUTPUT"

- name: Check dependency cache
uses: actions/cache@v3
Expand Down
6 changes: 3 additions & 3 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = [
name: '@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped)',
path: 'packages/browser/build/bundles/bundle.tracing.replay.feedback.min.js',
gzip: true,
limit: '75 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped)',
Expand Down Expand Up @@ -101,7 +101,7 @@ module.exports = [
path: 'packages/browser/build/bundles/bundle.min.js',
gzip: false,
brotli: false,
limit: '70 KB',
limit: '80 KB',
},

// Browser CDN bundles (ES5)
Expand All @@ -110,7 +110,7 @@ module.exports = [
name: '@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped)',
path: 'packages/browser/build/bundles/bundle.tracing.es5.min.js',
gzip: true,
limit: '35 KB',
limit: '40 KB',
},

// React
Expand Down
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,68 @@

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

## 7.91.0

### Important Changes

- **feat: Add server runtime metrics aggregator (#9894)**

The release adds alpha support for [Sentry developer metrics](https://github.com/getsentry/sentry/discussions/58584) in the server runtime SDKs (`@sentry/node`, `@sentry/deno`, `@sentry/nextjs` server-side, etc.). Via the newly introduced APIs, you can now flush metrics directly to Sentry.

To enable capturing metrics, you first need to add the `metricsAggregator` experiment to your `Sentry.init` call.

```js
Sentry.init({
dsn: '__DSN__',
_experiments: {
metricsAggregator: true,
},
});
```

Then you'll be able to add `counters`, `sets`, `distributions`, and `gauges` under the `Sentry.metrics` namespace.

```js
// Add 4 to a counter named `hits`
Sentry.metrics.increment('hits', 4);

// Add 2 to gauge named `parallel_requests`, tagged with `type: "a"`
Sentry.metrics.gauge('parallel_requests', 2, { tags: { type: 'a' } });

// Add 4.6 to a distribution named `response_time` with unit seconds
Sentry.metrics.distribution('response_time', 4.6, { unit: 'seconds' });

// Add 2 to a set named `valuable.ids`
Sentry.metrics.set('valuable.ids', 2);
```

- **feat(node): Rework ANR to use worker script via an integration (#9945)**

The [ANR tracking integration for Node](https://docs.sentry.io/platforms/node/configuration/application-not-responding/) has been reworked to use an integration. ANR tracking now requires a minimum Node version of 16 or higher. Previously you had to call `Sentry.enableANRDetection` before running your application, now you can simply add the `Anr` integration to your `Sentry.init` call.

```js
import * as Sentry from '@sentry/node';

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })],
});
```

### Other Changes

- feat(breadcrumbs): Send component names on UI breadcrumbs (#9946)
- feat(core): Add `getGlobalScope()` method (#9920)
- feat(core): Add `getIsolationScope()` method (#9957)
- feat(core): Add `span.end()` to replace `span.finish()` (#9954)
- feat(core): Ensure `startSpan` & `startSpanManual` fork scope (#9955)
- feat(react): Send component name on spans (#9949)
- feat(replay): Send component names in replay breadcrumbs (#9947)
- feat(sveltekit): Add options to configure fetch instrumentation script for CSP (#9969)
- feat(tracing): Send component name on interaction spans (#9948)
- feat(utils): Add function to extract relevant component name (#9921)
- fix(core): Rethrow caught promise rejections in `startSpan`, `startSpanManual`, `trace` (#9958)

## 7.90.0

- feat(replay): Change to use preset quality values (#9903)
Expand Down
3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"suspicious": {
"all": false,
"noControlCharactersInRegex": "error"
},
"nursery": {
"noUnusedImports": "error"
}
},
"ignore": [".vscode/*", "**/*.json"]
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"build": "node ./scripts/verify-packages-versions.js && run-s build:types build:transpile build:bundle",
"build": "node ./scripts/verify-packages-versions.js && run-s build:transpile build:types build:bundle",
"build:bundle": "lerna run build:bundle",
"build:dev": "lerna run build:types,build:transpile",
"build:dev:filter": "lerna run build:dev --include-filtered-dependencies --include-filtered-dependents --scope",
Expand All @@ -18,12 +18,12 @@
"clean:deps": "lerna clean --yes && rm -rf node_modules && yarn",
"clean:all": "run-s clean:build clean:caches clean:deps",
"codecov": "codecov",
"fix": "run-s fix:lerna fix:biome",
"fix": "run-p fix:lerna fix:biome",
"fix:lerna": "lerna run fix",
"fix:biome": "biome check --apply-unsafe .",
"fix:biome": "biome check --apply .",
"changelog": "ts-node ./scripts/get-commit-list.ts",
"link:yarn": "lerna exec yarn link",
"lint": "run-s lint:lerna lint:biome",
"lint": "run-p lint:lerna lint:biome",
"lint:lerna": "lerna run lint",
"lint:biome": "biome check .",
"validate:es5": "lerna run validate:es5",
Expand Down Expand Up @@ -69,6 +69,7 @@
"packages/remix",
"packages/replay",
"packages/replay-worker",
"packages/rollup-utils",
"packages/serverless",
"packages/svelte",
"packages/sveltekit",
Expand Down Expand Up @@ -99,7 +100,6 @@
"@types/rimraf": "^3.0.2",
"@types/sinon": "^7.0.11",
"@vitest/coverage-c8": "^0.29.2",
"acorn": "^8.7.0",
"chai": "^4.1.2",
"codecov": "^3.6.5",
"deepmerge": "^4.2.2",
Expand All @@ -116,7 +116,6 @@
"mocha": "^6.1.4",
"nodemon": "^2.0.16",
"npm-run-all": "^4.1.5",
"recast": "^0.20.5",
"replace-in-file": "^4.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.67.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/angular/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class TraceService implements OnDestroy {

if (activeTransaction) {
if (this._routingSpan) {
this._routingSpan.finish();
this._routingSpan.end();
}
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
Expand Down Expand Up @@ -131,7 +131,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
runOutsideAngular(() => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this._routingSpan!.finish();
this._routingSpan!.end();
});
this._routingSpan = null;
}
Expand Down Expand Up @@ -196,7 +196,7 @@ export class TraceDirective implements OnInit, AfterViewInit {
*/
public ngAfterViewInit(): void {
if (this._tracingSpan) {
this._tracingSpan.finish();
this._tracingSpan.end();
}
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@ export function TraceClassDecorator(): ClassDecorator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
target.prototype.ngAfterViewInit = function (...args: any[]): ReturnType<typeof originalAfterViewInit> {
if (tracingSpan) {
tracingSpan.finish();
tracingSpan.end();
}
if (originalAfterViewInit) {
return originalAfterViewInit.apply(this, args);
Expand Down
15 changes: 7 additions & 8 deletions packages/angular/test/tracing.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component } from '@angular/core';
import type { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
import type { Hub } from '@sentry/types';

import { TraceClassDecorator, TraceDirective, TraceMethodDecorator, instrumentAngularRouting } from '../src';
import { getParameterizedRouteFromSnapshot } from '../src/tracing';
Expand Down Expand Up @@ -154,7 +153,7 @@ describe('Angular Tracing', () => {

const finishMock = jest.fn();
transaction.startChild = jest.fn(() => ({
finish: finishMock,
end: finishMock,
}));

await env.navigateInAngular('/');
Expand All @@ -173,7 +172,7 @@ describe('Angular Tracing', () => {

const finishMock = jest.fn();
transaction.startChild = jest.fn(() => ({
finish: finishMock,
end: finishMock,
}));

await env.navigateInAngular('/');
Expand All @@ -199,7 +198,7 @@ describe('Angular Tracing', () => {

const finishMock = jest.fn();
transaction.startChild = jest.fn(() => ({
finish: finishMock,
end: finishMock,
}));

await env.navigateInAngular('/somewhere');
Expand Down Expand Up @@ -233,7 +232,7 @@ describe('Angular Tracing', () => {

const finishMock = jest.fn();
transaction.startChild = jest.fn(() => ({
finish: finishMock,
end: finishMock,
}));

await env.navigateInAngular('/cancel');
Expand Down Expand Up @@ -376,7 +375,7 @@ describe('Angular Tracing', () => {
});

transaction.startChild = jest.fn(() => ({
finish: finishMock,
end: finishMock,
}));

directive.componentName = 'test-component';
Expand All @@ -403,7 +402,7 @@ describe('Angular Tracing', () => {
});

transaction.startChild = jest.fn(() => ({
finish: finishMock,
end: finishMock,
}));

directive.ngOnInit();
Expand Down Expand Up @@ -437,7 +436,7 @@ describe('Angular Tracing', () => {
it('Instruments `ngOnInit` and `ngAfterViewInit` methods of the decorated class', async () => {
const finishMock = jest.fn();
const startChildMock = jest.fn(() => ({
finish: finishMock,
end: finishMock,
}));

const customStartTransaction = jest.fn((ctx: any) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
"scripts": {
"build": "run-p build:transpile build:types",
"build:dev": "yarn build",
"build:transpile": "rollup -c rollup.npm.config.js --bundleConfigAsCjs",
"build:transpile": "rollup -c rollup.npm.config.mjs",
"build:types": "tsc -p tsconfig.types.json",
"build:watch": "run-p build:transpile:watch build:types:watch",
"build:dev:watch": "yarn build:watch",
"build:transpile:watch": "rollup -c rollup.npm.config.js --bundleConfigAsCjs --watch",
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
"circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';

const variants = makeNPMConfigVariants(
makeBaseNPMConfig({
Expand Down
2 changes: 2 additions & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export {
getCurrentHub,
getClient,
getCurrentScope,
getGlobalScope,
getIsolationScope,
Hub,
makeMain,
Scope,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/server/middleware.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as SentryNode from '@sentry/node';
import type { Client } from '@sentry/types';
import { SpyInstance, vi } from 'vitest';
import { vi } from 'vitest';

import { handleRequest, interpolateRouteFromUrlAndParams } from '../../src/server/middleware';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<body>
<button id="button1" type="button">Button 1</button>
<button id="button2" type="button">Button 2</button>
<button id="annotated-button" type="button" data-sentry-component="AnnotatedButton">Button 3</button>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,39 @@ sentryTest('captures Breadcrumb for clicks & debounces them for a second', async
},
]);
});

sentryTest(
'uses the annotated component name in the breadcrumb messages and adds it to the data object',
async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });

await page.route('**/foo', route => {
return route.fulfill({
status: 200,
body: JSON.stringify({
userNames: ['John', 'Jane'],
}),
headers: {
'Content-Type': 'application/json',
},
});
});

const promise = getFirstSentryEnvelopeRequest<Event>(page);

await page.goto(url);
await page.click('#annotated-button');
await page.evaluate('Sentry.captureException("test exception")');

const eventData = await promise;

expect(eventData.breadcrumbs).toEqual([
{
timestamp: expect.any(Number),
category: 'ui.click',
message: 'body > AnnotatedButton',
data: { 'ui.component_name': 'AnnotatedButton' },
},
]);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<body>
<input id="input1" type="text" />
<input id="input2" type="text" />
<input id="annotated-input" data-sentry-component="AnnotatedInput" type="text" />
</body>
</html>
Loading

0 comments on commit 17f490e

Please sign in to comment.