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

meta(changelog): Update changelog for 7.89.0 #9915

Merged
merged 35 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3324a90
Merge pull request #9853 from getsentry/master
github-actions[bot] Dec 14, 2023
383c816
build: Enable codecov AI PR review (#9850)
AbhiPrasad Dec 14, 2023
1e8d2b3
ref: Use `getCurrentScope()`/`hub.getScope()` instead of `configureSc…
mydea Dec 15, 2023
da8c9c3
feat(nextjs): Auto instrument generation functions (#9781)
lforst Dec 15, 2023
30bb8b5
fix(utils): Do not use `Event` type in worldwide (#9864)
mydea Dec 15, 2023
ffc4181
ref: Use `getCurrentScope()` / `getClient` instead of `hub.xxx` (#9862)
mydea Dec 15, 2023
5bc9a38
fix(utils): Update `eventFromUnknownInput` to avoid scope pollution &…
mydea Dec 15, 2023
72c3488
ref(node): Refactor node integrations to use `processEvent` (#9018)
mydea Dec 15, 2023
e128936
fix(utils): Support crypto.getRandomValues in old Chromium versions (…
jghinestrosa Dec 15, 2023
53724c5
meta(feedback): Fix syntax error in README (#9875)
billyvg Dec 15, 2023
12c146b
fix(nextjs): Export `createReduxEnhancer` (#9854)
adam187 Dec 18, 2023
db4bef1
ref: Pass client instead of hub to `isSentryRequestUrl` (#9869)
mydea Dec 18, 2023
f2a4caa
feat(core): Update `withScope` to return callback return value (#9866)
mydea Dec 18, 2023
01a4cc9
feat(core): Add type & utility for function-based integrations (#9818)
mydea Dec 18, 2023
c0c5eca
feat(node): Add Hapi Integration (#9539)
onurtemizkan Dec 18, 2023
35906d0
ref: Use `addBreadcrumb` directly & allow to pass hint (#9867)
mydea Dec 18, 2023
f922414
build: Fix linting (#9888)
mydea Dec 18, 2023
e1d3633
ref(serverless): Avoid using `pushScope` (#9883)
mydea Dec 18, 2023
ada32b2
ref(nextjs): Simplify `wrapServerComponentWithSentry` (#9844)
lforst Dec 18, 2023
0efdb21
feat(core): Deprecate `configureScope` (#9887)
mydea Dec 18, 2023
b27c236
feat(core): Deprecate `pushScope` & `popScope` (#9890)
mydea Dec 18, 2023
f121585
feat(nextjs): Connect server component transactions if there is no in…
lforst Dec 18, 2023
8fb1a2f
feat(deno): Support `Deno.CronSchedule` for cron jobs (#9880)
timfish Dec 18, 2023
84299d0
feat(replay): Add `canvas.type` setting (#9877)
billyvg Dec 18, 2023
605fd50
feat(node-experimental): Update to new Scope APIs (#9799)
mydea Dec 19, 2023
32f4bf0
ref(deno): Refactor deno integration to avoid `setupOnce` (#9900)
mydea Dec 19, 2023
91a6b4e
ref(browser): Refactor browser integrations to avoid `setupOnce` (#9898)
mydea Dec 19, 2023
c9552a4
ref(node): Refactor LocalVariables integration to avoid `setupOnce` (…
mydea Dec 19, 2023
4e0c460
chore(sveltekit): Add SvelteKit 2.0 to peer dependencies (#9861)
Lms24 Dec 19, 2023
6d32228
fix(sveltekit): Add conditional exports (#9872)
Lms24 Dec 19, 2023
a856913
fix(remix): Do not capture thrown redirect responses. (#9909)
onurtemizkan Dec 19, 2023
31c769c
test(sveltekit): Add SvelteKit 2.0 E2E test app (#9873)
Lms24 Dec 19, 2023
cef3621
ref(sveltekit): Improve SvelteKit 2.0 404 server error handling (#9901)
Lms24 Dec 19, 2023
cf773fc
fix(sveltekit): Avoid capturing 404 errors on client side (#9902)
Lms24 Dec 19, 2023
9f173e1
meta(changelog): Update changelog for 7.89.0
lforst Dec 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -864,13 +864,16 @@ jobs:
'create-remix-app-v2',
'debug-id-sourcemaps',
'nextjs-app-dir',
'nextjs-14',
'react-create-hash-router',
'react-router-6-use-routes',
'standard-frontend-react',
'standard-frontend-react-tracing-import',
'sveltekit',
'sveltekit-2',
'generic-ts3.8',
'node-experimental-fastify-app',
'node-hapi-app',
]
build-command:
- false
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ jobs:
- test-application: 'nextjs-app-dir'
build-command: 'test:build-latest'
label: 'nextjs-app-dir (latest)'
- test-application: 'nextjs-14'
build-command: 'test:build-canary'
label: 'nextjs-14 (canary)'
- test-application: 'nextjs-14'
build-command: 'test:build-latest'
label: 'nextjs-14 (latest)'
- test-application: 'react-create-hash-router'
build-command: 'test:build-canary'
label: 'react-create-hash-router (canary)'
Expand Down
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,74 @@

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

## 7.89.0
Copy link
Member

Choose a reason for hiding this comment

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

Let's call out the configureScope, pushScope and popScope deprecations maybe?

Copy link
Member

Choose a reason for hiding this comment

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

I'd like to highlight Hapi as well in #9539


### Important Changes

#### Deprecations

- **feat(core): Deprecate `configureScope` (#9887)**
- **feat(core): Deprecate `pushScope` & `popScope` (#9890)**

This release deprecates `configureScope`, `pushScope`, and `popScope`, which will be removed in the upcoming v8 major release.

#### Hapi Integration

- **feat(node): Add Hapi Integration (#9539)**

This release adds an integration for Hapi. It can be used as follows:

```ts
const Sentry = require('@sentry/node');
const Hapi = require('@hapi/hapi');

const init = async () => {
const server = Hapi.server({
// your server configuration ...
});

Sentry.init({
dsn: '__DSN__',
tracesSampleRate: 1.0,
integrations: [
new Sentry.Integrations.Hapi({ server }),
],
});

server.route({
// your route configuration ...
});

await server.start();
};
```

#### SvelteKit 2.0

- **chore(sveltekit): Add SvelteKit 2.0 to peer dependencies (#9861)**

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.

### Other Changes

- feat(core): Add type & utility for function-based integrations (#9818)
- feat(core): Update `withScope` to return callback return value (#9866)
- feat(deno): Support `Deno.CronSchedule` for cron jobs (#9880)
- feat(nextjs): Auto instrument generation functions (#9781)
- feat(nextjs): Connect server component transactions if there is no incoming trace (#9845)
- feat(node-experimental): Update to new Scope APIs (#9799)
- feat(replay): Add `canvas.type` setting (#9877)
- fix(nextjs): Export `createReduxEnhancer` (#9854)
- fix(remix): Do not capture thrown redirect responses. (#9909)
- fix(sveltekit): Add conditional exports (#9872)
- fix(sveltekit): Avoid capturing 404 errors on client side (#9902)
- fix(utils): Do not use `Event` type in worldwide (#9864)
- fix(utils): Support crypto.getRandomValues in old Chromium versions (#9251)
- fix(utils): Update `eventFromUnknownInput` to avoid scope pollution & `getCurrentHub` (#9868)
- ref: Use `addBreadcrumb` directly & allow to pass hint (#9867)

Work in this release contributed by @adam187, and @jghinestrosa. Thank you for your contributions!

## 7.88.0

### Important Changes
Expand Down
12 changes: 12 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ npx @sentry/migr8@latest

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

## Deprecate `pushScope` & `popScope` in favor of `withScope`

Instead of manually pushing/popping a scope, you should use `Sentry.withScope(callback: (scope: Scope))` instead.

## Deprecate `configureScope` in favor of using `getCurrentScope()`

Instead of updating the scope in a callback via `configureScope()`, you should access it via `getCurrentScope()` and configure it directly:

```js
Sentry.getCurrentScope().setTag('xx', 'yy');
```

## Deprecate `addGlobalEventProcessor` in favor of `addEventProcessor`

Instead of using `addGlobalEventProcessor`, you should use `addEventProcessor` which does not add the event processor globally, but to the current client.
Expand Down
5 changes: 5 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ codecov:
notify:
require_ci_to_pass: no

ai_pr_review:
enabled: true
method: "label"
label_name: "ci-codecov-ai-review"

coverage:
precision: 2
round: down
Expand Down
11 changes: 2 additions & 9 deletions packages/angular/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ActivatedRouteSnapshot, Event, RouterState } from '@angular/router
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
import { NavigationCancel, NavigationError, Router } from '@angular/router';
import { NavigationEnd, NavigationStart, ResolveEnd } from '@angular/router';
import { WINDOW, getCurrentHub } from '@sentry/browser';
import { WINDOW, getCurrentScope } from '@sentry/browser';
import type { Span, Transaction, TransactionContext } from '@sentry/types';
import { logger, stripUrlQueryAndFragment, timestampInSeconds } from '@sentry/utils';
import type { Observable } from 'rxjs';
Expand Down Expand Up @@ -50,14 +50,7 @@ export const instrumentAngularRouting = routingInstrumentation;
* Grabs active transaction off scope
*/
export function getActiveTransaction(): Transaction | undefined {
const currentHub = getCurrentHub();

if (currentHub) {
const scope = currentHub.getScope();
return scope.getTransaction();
}

return undefined;
return getCurrentScope().getTransaction();
}

/**
Expand Down
12 changes: 4 additions & 8 deletions packages/angular/test/tracing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ jest.mock('@sentry/browser', () => {
const original = jest.requireActual('@sentry/browser');
return {
...original,
getCurrentHub: () => {
getCurrentScope() {
return {
getScope: () => {
return {
getTransaction: () => {
return transaction;
},
};
getTransaction: () => {
return transaction;
},
} as unknown as Hub;
};
},
};
});
Expand Down
6 changes: 2 additions & 4 deletions packages/astro/src/client/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BrowserOptions } from '@sentry/browser';
import { BrowserTracing, init as initBrowserSdk } from '@sentry/browser';
import { configureScope, hasTracingEnabled } from '@sentry/core';
import { getCurrentScope, hasTracingEnabled } from '@sentry/core';
import { addOrUpdateIntegration } from '@sentry/utils';

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

initBrowserSdk(options);

configureScope(scope => {
scope.setTag('runtime', 'browser');
});
getCurrentScope().setTag('runtime', 'browser');
}

function addClientIntegrations(options: BrowserOptions): void {
Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export {
captureMessage,
captureCheckIn,
withMonitor,
// eslint-disable-next-line deprecation/deprecation
configureScope,
createTransport,
// eslint-disable-next-line deprecation/deprecation
Expand Down
10 changes: 6 additions & 4 deletions packages/astro/src/server/meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getDynamicSamplingContextFromClient } from '@sentry/core';
import type { Hub, Span } from '@sentry/types';
import type { Client, Scope, Span } from '@sentry/types';
import {
TRACEPARENT_REGEXP,
dynamicSamplingContextToSentryBaggageHeader,
Expand All @@ -22,9 +22,11 @@ import {
*
* @returns an object with the two serialized <meta> tags
*/
export function getTracingMetaTags(span: Span | undefined, hub: Hub): { sentryTrace: string; baggage?: string } {
const scope = hub.getScope();
const client = hub.getClient();
export function getTracingMetaTags(
span: Span | undefined,
scope: Scope,
client: Client | undefined,
): { sentryTrace: string; baggage?: string } {
const { dsc, sampled, traceId } = scope.getPropagationContext();
const transaction = span?.transaction;

Expand Down
22 changes: 10 additions & 12 deletions packages/astro/src/server/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
captureException,
configureScope,
continueTrace,
getCurrentHub,
getClient,
getCurrentScope,
runWithAsyncContext,
startSpan,
} from '@sentry/node';
import type { Hub, Span } from '@sentry/types';
import type { Client, Scope, Span } from '@sentry/types';
import { addNonEnumerableProperty, objectify, stripUrlQueryAndFragment } from '@sentry/utils';
import type { APIContext, MiddlewareResponseHandler } from 'astro';

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

if (options.trackClientIp) {
configureScope(scope => {
scope.setUser({ ip_address: ctx.clientAddress });
});
getCurrentScope().setUser({ ip_address: ctx.clientAddress });
}

try {
Expand Down Expand Up @@ -141,8 +139,8 @@ async function instrumentRequest(
span.setHttpStatus(originalResponse.status);
}

const hub = getCurrentHub();
const client = hub.getClient();
const scope = getCurrentScope();
const client = getClient();
const contentType = originalResponse.headers.get('content-type');

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

const { sentryTrace, baggage } = getTracingMetaTags(span, hub);
const { sentryTrace, baggage } = getTracingMetaTags(span, scope, client);
const content = `<head>\n${sentryTrace}\n${baggage}\n`;
return htmlChunk.replace('<head>', content);
}
Expand Down
6 changes: 2 additions & 4 deletions packages/astro/src/server/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { configureScope } from '@sentry/core';
import { getCurrentScope } from '@sentry/core';
import type { NodeOptions } from '@sentry/node';
import { init as initNodeSdk } from '@sentry/node';

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

initNodeSdk(options);

configureScope(scope => {
scope.setTag('runtime', 'node');
});
getCurrentScope().setTag('runtime', 'node');
}
39 changes: 18 additions & 21 deletions packages/astro/test/server/meta.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ const mockedSpan = {
environment: 'production',
}),
},
};
} as any;

const mockedHub = {
getScope: () => ({
getPropagationContext: () => ({
traceId: '123',
}),
const mockedClient = {} as any;

const mockedScope = {
getPropagationContext: () => ({
traceId: '123',
}),
getClient: () => ({}),
};
} as any;

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

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

it('returns propagationContext DSC data if no span is available', () => {
const tags = getTracingMetaTags(undefined, {
...mockedHub,
// @ts-expect-error - only passing a partial scope object
getScope: () => ({
const tags = getTracingMetaTags(
undefined,
{
getPropagationContext: () => ({
traceId: '12345678901234567890123456789012',
sampled: true,
Expand All @@ -49,8 +46,9 @@ describe('getTracingMetaTags', () => {
trace_id: '12345678901234567890123456789012',
},
}),
}),
});
} as any,
mockedClient,
);

expect(tags).toEqual({
sentryTrace: expect.stringMatching(
Expand All @@ -73,7 +71,8 @@ describe('getTracingMetaTags', () => {
toTraceparent: () => '12345678901234567890123456789012-1234567890123456-1',
transaction: undefined,
},
mockedHub,
mockedScope,
mockedClient,
);

expect(tags).toEqual({
Expand All @@ -93,10 +92,8 @@ describe('getTracingMetaTags', () => {
toTraceparent: () => '12345678901234567890123456789012-1234567890123456-1',
transaction: undefined,
},
{
...mockedHub,
getClient: () => undefined,
},
mockedScope,
undefined,
);

expect(tags).toEqual({
Expand Down
Loading
Loading