Skip to content

Commit 53a08bf

Browse files
author
Luca Forstner
authored
Merge pull request #9915 from getsentry/prepare-release/7.89.0
meta(changelog): Update changelog for 7.89.0
2 parents f1a677f + 9f173e1 commit 53a08bf

File tree

254 files changed

+8606
-1661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+8606
-1661
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,13 +864,16 @@ jobs:
864864
'create-remix-app-v2',
865865
'debug-id-sourcemaps',
866866
'nextjs-app-dir',
867+
'nextjs-14',
867868
'react-create-hash-router',
868869
'react-router-6-use-routes',
869870
'standard-frontend-react',
870871
'standard-frontend-react-tracing-import',
871872
'sveltekit',
873+
'sveltekit-2',
872874
'generic-ts3.8',
873875
'node-experimental-fastify-app',
876+
'node-hapi-app',
874877
]
875878
build-command:
876879
- false

.github/workflows/canary.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ jobs:
7373
- test-application: 'nextjs-app-dir'
7474
build-command: 'test:build-latest'
7575
label: 'nextjs-app-dir (latest)'
76+
- test-application: 'nextjs-14'
77+
build-command: 'test:build-canary'
78+
label: 'nextjs-14 (canary)'
79+
- test-application: 'nextjs-14'
80+
build-command: 'test:build-latest'
81+
label: 'nextjs-14 (latest)'
7682
- test-application: 'react-create-hash-router'
7783
build-command: 'test:build-canary'
7884
label: 'react-create-hash-router (canary)'

CHANGELOG.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,74 @@
44

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

7+
## 7.89.0
8+
9+
### Important Changes
10+
11+
#### Deprecations
12+
13+
- **feat(core): Deprecate `configureScope` (#9887)**
14+
- **feat(core): Deprecate `pushScope` & `popScope` (#9890)**
15+
16+
This release deprecates `configureScope`, `pushScope`, and `popScope`, which will be removed in the upcoming v8 major release.
17+
18+
#### Hapi Integration
19+
20+
- **feat(node): Add Hapi Integration (#9539)**
21+
22+
This release adds an integration for Hapi. It can be used as follows:
23+
24+
```ts
25+
const Sentry = require('@sentry/node');
26+
const Hapi = require('@hapi/hapi');
27+
28+
const init = async () => {
29+
const server = Hapi.server({
30+
// your server configuration ...
31+
});
32+
33+
Sentry.init({
34+
dsn: '__DSN__',
35+
tracesSampleRate: 1.0,
36+
integrations: [
37+
new Sentry.Integrations.Hapi({ server }),
38+
],
39+
});
40+
41+
server.route({
42+
// your route configuration ...
43+
});
44+
45+
await server.start();
46+
};
47+
```
48+
49+
#### SvelteKit 2.0
50+
51+
- **chore(sveltekit): Add SvelteKit 2.0 to peer dependencies (#9861)**
52+
53+
This release adds support for SvelteKit 2.0 in the `@sentry/sveltekit` package. If you're upgrading from SvelteKit 1.x to 2.x and already use the Sentry SvelteKit SDK, no changes apart from upgrading to this (or a newer) version are necessary.
54+
55+
### Other Changes
56+
57+
- feat(core): Add type & utility for function-based integrations (#9818)
58+
- feat(core): Update `withScope` to return callback return value (#9866)
59+
- feat(deno): Support `Deno.CronSchedule` for cron jobs (#9880)
60+
- feat(nextjs): Auto instrument generation functions (#9781)
61+
- feat(nextjs): Connect server component transactions if there is no incoming trace (#9845)
62+
- feat(node-experimental): Update to new Scope APIs (#9799)
63+
- feat(replay): Add `canvas.type` setting (#9877)
64+
- fix(nextjs): Export `createReduxEnhancer` (#9854)
65+
- fix(remix): Do not capture thrown redirect responses. (#9909)
66+
- fix(sveltekit): Add conditional exports (#9872)
67+
- fix(sveltekit): Avoid capturing 404 errors on client side (#9902)
68+
- fix(utils): Do not use `Event` type in worldwide (#9864)
69+
- fix(utils): Support crypto.getRandomValues in old Chromium versions (#9251)
70+
- fix(utils): Update `eventFromUnknownInput` to avoid scope pollution & `getCurrentHub` (#9868)
71+
- ref: Use `addBreadcrumb` directly & allow to pass hint (#9867)
72+
73+
Work in this release contributed by @adam187, and @jghinestrosa. Thank you for your contributions!
74+
775
## 7.88.0
876

977
### Important Changes

MIGRATION.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ npx @sentry/migr8@latest
88

99
This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!
1010

11+
## Deprecate `pushScope` & `popScope` in favor of `withScope`
12+
13+
Instead of manually pushing/popping a scope, you should use `Sentry.withScope(callback: (scope: Scope))` instead.
14+
15+
## Deprecate `configureScope` in favor of using `getCurrentScope()`
16+
17+
Instead of updating the scope in a callback via `configureScope()`, you should access it via `getCurrentScope()` and configure it directly:
18+
19+
```js
20+
Sentry.getCurrentScope().setTag('xx', 'yy');
21+
```
22+
1123
## Deprecate `addGlobalEventProcessor` in favor of `addEventProcessor`
1224

1325
Instead of using `addGlobalEventProcessor`, you should use `addEventProcessor` which does not add the event processor globally, but to the current client.

codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ codecov:
33
notify:
44
require_ci_to_pass: no
55

6+
ai_pr_review:
7+
enabled: true
8+
method: "label"
9+
label_name: "ci-codecov-ai-review"
10+
611
coverage:
712
precision: 2
813
round: down

packages/angular/src/tracing.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { ActivatedRouteSnapshot, Event, RouterState } from '@angular/router
77
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
88
import { NavigationCancel, NavigationError, Router } from '@angular/router';
99
import { NavigationEnd, NavigationStart, ResolveEnd } from '@angular/router';
10-
import { WINDOW, getCurrentHub } from '@sentry/browser';
10+
import { WINDOW, getCurrentScope } from '@sentry/browser';
1111
import type { Span, Transaction, TransactionContext } from '@sentry/types';
1212
import { logger, stripUrlQueryAndFragment, timestampInSeconds } from '@sentry/utils';
1313
import type { Observable } from 'rxjs';
@@ -50,14 +50,7 @@ export const instrumentAngularRouting = routingInstrumentation;
5050
* Grabs active transaction off scope
5151
*/
5252
export function getActiveTransaction(): Transaction | undefined {
53-
const currentHub = getCurrentHub();
54-
55-
if (currentHub) {
56-
const scope = currentHub.getScope();
57-
return scope.getTransaction();
58-
}
59-
60-
return undefined;
53+
return getCurrentScope().getTransaction();
6154
}
6255

6356
/**

packages/angular/test/tracing.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@ jest.mock('@sentry/browser', () => {
2121
const original = jest.requireActual('@sentry/browser');
2222
return {
2323
...original,
24-
getCurrentHub: () => {
24+
getCurrentScope() {
2525
return {
26-
getScope: () => {
27-
return {
28-
getTransaction: () => {
29-
return transaction;
30-
},
31-
};
26+
getTransaction: () => {
27+
return transaction;
3228
},
33-
} as unknown as Hub;
29+
};
3430
},
3531
};
3632
});

packages/astro/src/client/sdk.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BrowserOptions } from '@sentry/browser';
22
import { BrowserTracing, init as initBrowserSdk } from '@sentry/browser';
3-
import { configureScope, hasTracingEnabled } from '@sentry/core';
3+
import { getCurrentScope, hasTracingEnabled } from '@sentry/core';
44
import { addOrUpdateIntegration } from '@sentry/utils';
55

66
import { applySdkMetadata } from '../common/metadata';
@@ -20,9 +20,7 @@ export function init(options: BrowserOptions): void {
2020

2121
initBrowserSdk(options);
2222

23-
configureScope(scope => {
24-
scope.setTag('runtime', 'browser');
25-
});
23+
getCurrentScope().setTag('runtime', 'browser');
2624
}
2725

2826
function addClientIntegrations(options: BrowserOptions): void {

packages/astro/src/index.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export {
1717
captureMessage,
1818
captureCheckIn,
1919
withMonitor,
20+
// eslint-disable-next-line deprecation/deprecation
2021
configureScope,
2122
createTransport,
2223
// eslint-disable-next-line deprecation/deprecation

packages/astro/src/server/meta.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getDynamicSamplingContextFromClient } from '@sentry/core';
2-
import type { Hub, Span } from '@sentry/types';
2+
import type { Client, Scope, Span } from '@sentry/types';
33
import {
44
TRACEPARENT_REGEXP,
55
dynamicSamplingContextToSentryBaggageHeader,
@@ -22,9 +22,11 @@ import {
2222
*
2323
* @returns an object with the two serialized <meta> tags
2424
*/
25-
export function getTracingMetaTags(span: Span | undefined, hub: Hub): { sentryTrace: string; baggage?: string } {
26-
const scope = hub.getScope();
27-
const client = hub.getClient();
25+
export function getTracingMetaTags(
26+
span: Span | undefined,
27+
scope: Scope,
28+
client: Client | undefined,
29+
): { sentryTrace: string; baggage?: string } {
2830
const { dsc, sampled, traceId } = scope.getPropagationContext();
2931
const transaction = span?.transaction;
3032

packages/astro/src/server/middleware.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
22
captureException,
3-
configureScope,
43
continueTrace,
5-
getCurrentHub,
4+
getClient,
5+
getCurrentScope,
66
runWithAsyncContext,
77
startSpan,
88
} from '@sentry/node';
9-
import type { Hub, Span } from '@sentry/types';
9+
import type { Client, Scope, Span } from '@sentry/types';
1010
import { addNonEnumerableProperty, objectify, stripUrlQueryAndFragment } from '@sentry/utils';
1111
import type { APIContext, MiddlewareResponseHandler } from 'astro';
1212

@@ -69,7 +69,7 @@ export const handleRequest: (options?: MiddlewareOptions) => MiddlewareResponseH
6969
// if there is an active span, we know that this handle call is nested and hence
7070
// we don't create a new domain for it. If we created one, nested server calls would
7171
// create new transactions instead of adding a child span to the currently active span.
72-
if (getCurrentHub().getScope().getSpan()) {
72+
if (getCurrentScope().getSpan()) {
7373
return instrumentRequest(ctx, next, handlerOptions);
7474
}
7575
return runWithAsyncContext(() => {
@@ -106,9 +106,7 @@ async function instrumentRequest(
106106
}
107107

108108
if (options.trackClientIp) {
109-
configureScope(scope => {
110-
scope.setUser({ ip_address: ctx.clientAddress });
111-
});
109+
getCurrentScope().setUser({ ip_address: ctx.clientAddress });
112110
}
113111

114112
try {
@@ -141,8 +139,8 @@ async function instrumentRequest(
141139
span.setHttpStatus(originalResponse.status);
142140
}
143141

144-
const hub = getCurrentHub();
145-
const client = hub.getClient();
142+
const scope = getCurrentScope();
143+
const client = getClient();
146144
const contentType = originalResponse.headers.get('content-type');
147145

148146
const isPageloadRequest = contentType && contentType.startsWith('text/html');
@@ -165,7 +163,7 @@ async function instrumentRequest(
165163
start: async controller => {
166164
for await (const chunk of originalBody) {
167165
const html = typeof chunk === 'string' ? chunk : decoder.decode(chunk);
168-
const modifiedHtml = addMetaTagToHead(html, hub, span);
166+
const modifiedHtml = addMetaTagToHead(html, scope, client, span);
169167
controller.enqueue(new TextEncoder().encode(modifiedHtml));
170168
}
171169
controller.close();
@@ -187,12 +185,12 @@ async function instrumentRequest(
187185
* This function optimistically assumes that the HTML coming in chunks will not be split
188186
* within the <head> tag. If this still happens, we simply won't replace anything.
189187
*/
190-
function addMetaTagToHead(htmlChunk: string, hub: Hub, span?: Span): string {
188+
function addMetaTagToHead(htmlChunk: string, scope: Scope, client: Client, span?: Span): string {
191189
if (typeof htmlChunk !== 'string') {
192190
return htmlChunk;
193191
}
194192

195-
const { sentryTrace, baggage } = getTracingMetaTags(span, hub);
193+
const { sentryTrace, baggage } = getTracingMetaTags(span, scope, client);
196194
const content = `<head>\n${sentryTrace}\n${baggage}\n`;
197195
return htmlChunk.replace('<head>', content);
198196
}

packages/astro/src/server/sdk.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { configureScope } from '@sentry/core';
1+
import { getCurrentScope } from '@sentry/core';
22
import type { NodeOptions } from '@sentry/node';
33
import { init as initNodeSdk } from '@sentry/node';
44

@@ -13,7 +13,5 @@ export function init(options: NodeOptions): void {
1313

1414
initNodeSdk(options);
1515

16-
configureScope(scope => {
17-
scope.setTag('runtime', 'node');
18-
});
16+
getCurrentScope().setTag('runtime', 'node');
1917
}

packages/astro/test/server/meta.test.ts

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@ const mockedSpan = {
1010
environment: 'production',
1111
}),
1212
},
13-
};
13+
} as any;
1414

15-
const mockedHub = {
16-
getScope: () => ({
17-
getPropagationContext: () => ({
18-
traceId: '123',
19-
}),
15+
const mockedClient = {} as any;
16+
17+
const mockedScope = {
18+
getPropagationContext: () => ({
19+
traceId: '123',
2020
}),
21-
getClient: () => ({}),
22-
};
21+
} as any;
2322

2423
describe('getTracingMetaTags', () => {
2524
it('returns the tracing tags from the span, if it is provided', () => {
2625
{
27-
// @ts-expect-error - only passing a partial span object
28-
const tags = getTracingMetaTags(mockedSpan, mockedHub);
26+
const tags = getTracingMetaTags(mockedSpan, mockedScope, mockedClient);
2927

3028
expect(tags).toEqual({
3129
sentryTrace: '<meta name="sentry-trace" content="12345678901234567890123456789012-1234567890123456-1"/>',
@@ -35,10 +33,9 @@ describe('getTracingMetaTags', () => {
3533
});
3634

3735
it('returns propagationContext DSC data if no span is available', () => {
38-
const tags = getTracingMetaTags(undefined, {
39-
...mockedHub,
40-
// @ts-expect-error - only passing a partial scope object
41-
getScope: () => ({
36+
const tags = getTracingMetaTags(
37+
undefined,
38+
{
4239
getPropagationContext: () => ({
4340
traceId: '12345678901234567890123456789012',
4441
sampled: true,
@@ -49,8 +46,9 @@ describe('getTracingMetaTags', () => {
4946
trace_id: '12345678901234567890123456789012',
5047
},
5148
}),
52-
}),
53-
});
49+
} as any,
50+
mockedClient,
51+
);
5452

5553
expect(tags).toEqual({
5654
sentryTrace: expect.stringMatching(
@@ -73,7 +71,8 @@ describe('getTracingMetaTags', () => {
7371
toTraceparent: () => '12345678901234567890123456789012-1234567890123456-1',
7472
transaction: undefined,
7573
},
76-
mockedHub,
74+
mockedScope,
75+
mockedClient,
7776
);
7877

7978
expect(tags).toEqual({
@@ -93,10 +92,8 @@ describe('getTracingMetaTags', () => {
9392
toTraceparent: () => '12345678901234567890123456789012-1234567890123456-1',
9493
transaction: undefined,
9594
},
96-
{
97-
...mockedHub,
98-
getClient: () => undefined,
99-
},
95+
mockedScope,
96+
undefined,
10097
);
10198

10299
expect(tags).toEqual({

0 commit comments

Comments
 (0)