Skip to content

meta(changelog): Update changelog for v8.0.0-alpha.7 #11308

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

Merged
merged 7 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ packages/deno/build-test
packages/deno/lib.deno.d.ts

# gatsby
packages/gatsby/gatsby-browser.d.ts
packages/gatsby/gatsby-node.d.ts
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

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

## 8.0.0-alpha.6
## 8.0.0-alpha.7

This is the sixth alpha release of Sentry JavaScript SDK v8, which includes a variety of breaking changes.
This is the seventh alpha release of Sentry JavaScript SDK v8, which includes a variety of breaking changes.

Read the [in-depth migration guide](./MIGRATION.md) to find out how to address any breaking changes in your code.

Expand All @@ -16,6 +16,14 @@ Read the [in-depth migration guide](./MIGRATION.md) to find out how to address a

We now use OpenTelemetry under the hood to power performance monitoring and tracing in the Next.js SDK.

- **feat(v8/gatsby): Update SDK initialization for gatsby (#11292)**

In v8, you cannot initialize the SDK anymore via Gatsby plugin options. Instead, you have to configure the SDK in a
`sentry.config.js` file.

We also removed the automatic initialization of `browserTracingIntegration`. You now have to add this integration
yourself.

### Removal/Refactoring of deprecated functionality

- feat(v8): Remove addGlobalEventProcessor (#11255)
Expand All @@ -31,6 +39,7 @@ We now use OpenTelemetry under the hood to power performance monitoring and trac
- ref(core): Remove `scope.setSpan()` and `scope.getSpan()` methods (#11051)
- ref(profiling-node): Remove usage of getCurrentHub (#11275)
- ref(v8): change integration.setupOnce signature (#11238)
- ref: remove node-experimental references (#11290)

### Other Changes

Expand All @@ -49,6 +58,10 @@ We now use OpenTelemetry under the hood to power performance monitoring and trac
- fix(node): Use `suppressTracing` to avoid capturing otel spans (#11288)
- fix(opentelemetry): Do not stomp span status when `startSpan` callback throws (#11170)

## 8.0.0-alpha.6

This version did not publish correctly due to a configuration issue.

## 8.0.0-alpha.5

This is the fifth alpha release of Sentry JavaScript SDK v8, which includes a variety of breaking changes.
Expand Down
116 changes: 115 additions & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ New minimum supported browsers:

For IE11 support please transpile your code to ES5 using babel or similar and add required polyfills.

**React**: We no longer support React 15 in version 8 of the React SDK.
**React**: The Next.js SDK now supports React 16+

**Next.js**: The Next.js SDK now supports Next.js 13.2.0+

## 2. Package removal

Expand Down Expand Up @@ -979,6 +981,118 @@ const config = {
export default withSentryConfig(config);
```

### Gatsby SDK

#### Removal of Gatsby Initialization via plugin options

In v8, we are removing the ability to initialize the Gatsby SDK via plugin options. Instead, you should create a
`sentry.config.js` file in the root of your project and initialize the SDK there.

```js
// v7 - gatsby-config.js
module.exports = {
// ...
plugins: [
{
resolve: '@sentry/gatsby',
options: {
dsn: process.env.SENTRY_DSN,
},
},
// ...
],
};
```

```js
// v8 - gatsby-config.js
module.exports = {
// ...
plugins: [
{
resolve: '@sentry/gatsby',
},
// ...
],
};

// v8 - sentry.config.js
import * as Sentry from '@sentry/gatsby';

Sentry.init({
dsn: '__PUBLIC_DSN__',
});
```

We've also added `enableClientWebpackPlugin` which allows you to enable or disable the `@sentry/webpack-plugin` in the
client-side build. By default, it is enabled.

```js
// v8 - gatsby-config.js
module.exports = {
// ...
plugins: [
{
resolve: '@sentry/gatsby',
options: {
enableClientWebpackPlugin: false,
},
},
// ...
],
};
```

#### Automatic adding of `browserTracingIntegration` for Gatsby

The Gatsby SDK no longer adds the `browserTracingIntegration` automatically. If you want to enable tracing in the
browser, you need to add it manually. Make sure to also configured a `tracePropagationTargets` value.

```js
// v7 - gatsby-config.js
module.exports = {
// ...
plugins: [
{
resolve: '@sentry/gatsby',
options: {
tracesSampleRate: 1.0,
},
},
// ...
],
};
```

```js
// v8 - gatsby-config.js
module.exports = {
// ...
plugins: [
{
resolve: '@sentry/gatsby',
},
// ...
],
};

// v8 - sentry.config.js
import * as Sentry from '@sentry/gatsby';

Sentry.init({
dsn: '__PUBLIC_DSN__',
integrations: [Sentry.browserTracingIntegration()],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,

// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
});
```

## 5. Behaviour Changes

- [Updated behaviour of `tracePropagationTargets` in the browser](./MIGRATION.md#updated-behaviour-of-tracepropagationtargets-in-the-browser-http-tracing-headers--cors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const buildStderr = fs.readFileSync('.tmp_build_stderr', 'utf-8');
assert.match(buildStdout, /○ \/client-component/);
assert.match(buildStdout, /● \/client-component\/parameter\/\[\.\.\.parameters\]/);
assert.match(buildStdout, /● \/client-component\/parameter\/\[parameter\]/);
assert.match(buildStdout, /λ \/server-component/);
assert.match(buildStdout, /λ \/server-component\/parameter\/\[\.\.\.parameters\]/);
assert.match(buildStdout, /λ \/server-component\/parameter\/\[parameter\]/);
assert.match(buildStdout, /(λ|ƒ) \/server-component/);
assert.match(buildStdout, /(λ|ƒ) \/server-component\/parameter\/\[\.\.\.parameters\]/);
assert.match(buildStdout, /(λ|ƒ) \/server-component\/parameter\/\[parameter\]/);

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ test.describe('client-side errors', () => {
test('captures error thrown on click', async ({ page }) => {
await page.goto('/client-error');

await expect(page.getByText('Client error')).toBeVisible();

const errorEventPromise = waitForError('sveltekit-2', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'Click Error';
});

const clickPromise = page.getByText('Throw error').click();
await page.getByText('Throw error').click();

await expect(errorEventPromise).resolves.toBeDefined();

const [errorEvent, _] = await Promise.all([errorEventPromise, clickPromise]);
const errorEvent = await errorEventPromise;

const errorEventFrames = errorEvent.exception?.values?.[0]?.stacktrace?.frames;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ test.describe('client-side errors', () => {
test('captures error thrown on click', async ({ page }) => {
await page.goto('/client-error');

await expect(page.getByText('Client error')).toBeVisible();

const errorEventPromise = waitForError('sveltekit', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'Click Error';
});

const clickPromise = page.getByText('Throw error').click();
await page.getByText('Throw error').click();

await expect(errorEventPromise).resolves.toBeDefined();

const [errorEvent, _] = await Promise.all([errorEventPromise, clickPromise]);
const errorEvent = await errorEventPromise;

const errorEventFrames = errorEvent.exception?.values?.[0]?.stacktrace?.frames;

Expand Down
4 changes: 2 additions & 2 deletions packages/bun/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
* @example
* ```
*
* const { addBreadcrumb } = require('@sentry/node-experimental');
* const { addBreadcrumb } = require('@sentry/node');
* addBreadcrumb({
* message: 'My Breadcrumb',
* // ...
Expand All @@ -76,7 +76,7 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
* @example
* ```
*
* const Sentry = require('@sentry/node-experimental');
* const Sentry = require('@sentry/node');
* Sentry.captureMessage('Hello, world!');
* Sentry.captureException(new Error('Good bye'));
* Sentry.captureEvent({
Expand Down
12 changes: 1 addition & 11 deletions packages/gatsby/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,14 @@ module.exports = {
jsx: true,
},
// ignore these because they're not covered by a `tsconfig`, which makes eslint throw an error
ignorePatterns: ['gatsby-browser.d.ts', 'gatsby-node.d.ts'],
ignorePatterns: ['gatsby-node.d.ts'],
overrides: [
{
files: ['scripts/**/*.ts'],
parserOptions: {
project: ['../../tsconfig.dev.json'],
},
},
{
files: ['./gatsby-browser.js'],
env: {
browser: true,
node: false,
},
parserOptions: {
sourceType: 'module',
},
},
],
extends: ['../../.eslintrc.js'],
};
81 changes: 21 additions & 60 deletions packages/gatsby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Official Sentry SDK for GatsbyJS

Register the package as a plugin in `gatsby-config.js`:
First register the package as a plugin in `gatsby-config.js`:

```javascript
module.exports = {
Expand All @@ -23,66 +23,32 @@ module.exports = {
};
```

Options will be passed directly to `Sentry.init`. See all available options in
[our docs](https://docs.sentry.io/error-reporting/configuration/?platform=javascript). The `environment` value defaults
to `NODE_ENV` (or `'development'` if `NODE_ENV` is not set).

## GitHub Actions

The `release` value is inferred from `GITHUB_SHA`.

## Netlify

The `release` value is inferred from `COMMIT_REF`.

## Vercel

To automatically capture the `release` value on Vercel you will need to register appropriate
[system environment variable](https://vercel.com/docs/v2/build-step#system-environment-variables) (e.g.
`VERCEL_GITHUB_COMMIT_SHA`) in your project.

## Sentry Performance

To enable tracing, supply either `tracesSampleRate` or `tracesSampler` to the options. This will turn on the
`BrowserTracing` integration for automatic instrumentation of pageloads and navigations.
Then configure your `Sentry.init` call:

```javascript
module.exports = {
// ...
plugins: [
{
resolve: '@sentry/gatsby',
options: {
dsn: process.env.SENTRY_DSN, // this is the default
import * as Sentry from '@sentry/gatsby';

// A rate of 1 means all traces will be sent, so it's good for testing.
// In production, you'll likely want to either choose a lower rate or use `tracesSampler` instead (see below).
tracesSampleRate: 1,
Sentry.init({
dsn: '__PUBLIC_DSN__',
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],

// Alternatively:
tracesSampler: samplingContext => {
// Examine provided context data (along with anything in the global namespace) to decide the sample rate
// for this transaction.
// Can return 0 to drop the transaction entirely.
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,

if ('...') {
return 0.5; // These are important - take a big sample
} else if ('...') {
return 0.01; // These are less important or happen much more frequently - only take 1% of them
} else if ('...') {
return 0; // These aren't something worth tracking - drop all transactions like this
} else {
return 0.1; // Default sample rate
}
},
},
},
// ...
],
};
// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,

// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
});
```

If you want to supply options to the `BrowserTracing` integration, use the `browserTracingOptions` parameter.
The Gatsby SDK also automatically sets up sourcemaps uploading for you. To disable this functionality, set the
`enableClientWebpackPlugin` option to be `false`.

```javascript
module.exports = {
Expand All @@ -91,12 +57,7 @@ module.exports = {
{
resolve: '@sentry/gatsby',
options: {
dsn: process.env.SENTRY_DSN, // this is the default
tracesSampleRate: 1, // or tracesSampler (see above)
browserTracingOptions: {
// disable creating spans for XHR requests
traceXHR: false,
},
enableClientWebpackPlugin: false,
},
},
// ...
Expand Down
Loading