Skip to content

Commit 921a8ec

Browse files
committed
feat(remix): Remove autoInstrumentRemix option
1 parent 86a911c commit 921a8ec

File tree

16 files changed

+67
-339
lines changed

16 files changed

+67
-339
lines changed

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/instrument.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ Sentry.init({
66
environment: 'qa', // dynamic sampling bias to keep transactions
77
dsn: process.env.E2E_TEST_DSN,
88
tunnel: 'http://localhost:3031/', // proxy server
9-
autoInstrumentRemix: true, // auto instrument Remix
109
integrations: [Sentry.nativeNodeFetchIntegration()],
1110
});

dev-packages/e2e-tests/test-applications/create-remix-app-express/instrument.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Sentry.init({
77
dsn: process.env.E2E_TEST_DSN,
88
tunnel: 'http://localhost:3031/', // proxy server
99
sendDefaultPii: true, // Testing the FormData
10-
autoInstrumentRemix: true, // auto instrument Remix
1110
captureActionFormDataKeys: {
1211
file: true,
1312
text: true,

dev-packages/e2e-tests/test-applications/create-remix-app-v2/instrument.server.cjs

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ Sentry.init({
55
environment: 'qa', // dynamic sampling bias to keep transactions
66
dsn: process.env.E2E_TEST_DSN,
77
tunnel: 'http://localhost:3031/', // proxy server
8-
autoInstrumentRemix: true, // auto instrument Remix
98
});

dev-packages/e2e-tests/test-applications/create-remix-app/instrument.server.cjs

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ Sentry.init({
55
environment: 'qa', // dynamic sampling bias to keep transactions
66
dsn: process.env.E2E_TEST_DSN,
77
tunnel: 'http://localhost:3031/', // proxy server
8-
autoInstrumentRemix: true, // auto instrument Remix
98
});

docs/migration/v8-to-v9.md

+11
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ If you need to support older browsers, we recommend transpiling your code using
8282

8383
- When `skipOpenTelemetrySetup: true` is configured, `httpIntegration({ spans: false })` will be configured by default. This means that you no longer have to specify this yourself in this scenario. With this change, no spans are emitted once `skipOpenTelemetrySetup: true` is configured, without any further configuration being needed.
8484

85+
### `@sentry/remix`
86+
87+
- The Remix SDK now uses OpenTelemetry instrumentation by default. This is identical to have used the v7 SDK with `autoInstrumentRemix: true`.
88+
8589
### Uncategorized (TODO)
8690

8791
- Next.js withSentryConfig returning Promise
@@ -114,6 +118,7 @@ It will be removed in a future major version.
114118
- [General](#general)
115119
- [Server-side SDKs (Node, Deno, Bun, ...)](#server-side-sdks-node-deno-bun-)
116120
- [Next.js SDK](#nextjs-sdk)
121+
- [Remix SDK](#remix-sdk)
117122
- [Vue/Nuxt SDK](#vuenuxt-sdk)
118123

119124
### General
@@ -136,6 +141,12 @@ It will be removed in a future major version.
136141

137142
- `experimental_captureRequestError`
138143

144+
### Remix SDK
145+
146+
- `options.autoInstrumentRemix`
147+
148+
The `autoInstrumentRemix` has been removed from the Remix SDK. The default behaviour of the Remix SDK is now as if `autoInstrumentRemix` was set to `true`.
149+
139150
### Vue/Nuxt SDK
140151

141152
- vueComponent tracking options

packages/remix/README.md

+16-109
Original file line numberDiff line numberDiff line change
@@ -10,137 +10,44 @@
1010
[![npm dm](https://img.shields.io/npm/dm/@sentry/remix.svg)](https://www.npmjs.com/package/@sentry/remix)
1111
[![npm dt](https://img.shields.io/npm/dt/@sentry/remix.svg)](https://www.npmjs.com/package/@sentry/remix)
1212

13-
## General
14-
1513
This package is a wrapper around `@sentry/node` for the server and `@sentry/react` for the client, with added
1614
functionality related to Remix.
1715

18-
To use this SDK, initialize Sentry in your Remix entry points for both the client and server.
19-
20-
```ts
21-
// entry.client.tsx
22-
23-
import { useLocation, useMatches } from '@remix-run/react';
24-
import * as Sentry from '@sentry/remix';
25-
import { useEffect } from 'react';
26-
27-
Sentry.init({
28-
dsn: '__DSN__',
29-
tracesSampleRate: 1,
30-
integrations: [
31-
Sentry.browserTracingIntegration({
32-
useEffect,
33-
useLocation,
34-
useMatches,
35-
}),
36-
],
37-
// ...
38-
});
39-
```
16+
## Compatibility
4017

41-
```ts
42-
// entry.server.tsx
18+
Currently, the minimum supported version of Remix is `1.0.0`.
4319

44-
import { prisma } from '~/db.server';
20+
## Installation
4521

46-
import * as Sentry from '@sentry/remix';
22+
To get started installing the SDK, use the Sentry Remix Wizard by running the following command in your terminal or
23+
read the [Getting Started Docs](https://docs.sentry.io/platforms/javascript/guides/remix/):
4724

48-
Sentry.init({
49-
dsn: '__DSN__',
50-
tracesSampleRate: 1,
51-
integrations: [new Sentry.Integrations.Prisma({ client: prisma })],
52-
// ...
53-
});
25+
```sh
26+
npx @sentry/wizard@latest -i remix
5427
```
5528

56-
Also, wrap your Remix root with `withSentry` to catch React component errors and to get parameterized router
57-
transactions.
58-
59-
```ts
60-
// root.tsx
61-
62-
import {
63-
Links,
64-
LiveReload,
65-
Meta,
66-
Outlet,
67-
Scripts,
68-
ScrollRestoration,
69-
} from "@remix-run/react";
29+
The wizard will prompt you to log in to Sentry. After the wizard setup is completed, the SDK will automatically capture
30+
unhandled errors, and monitor performance.
7031

71-
import { withSentry } from "@sentry/remix";
32+
## Custom Usage
7233

73-
function App() {
74-
return (
75-
<html>
76-
<head>
77-
<Meta />
78-
<Links />
79-
</head>
80-
<body>
81-
<Outlet />
82-
<ScrollRestoration />
83-
<Scripts />
84-
<LiveReload />
85-
</body>
86-
</html>
87-
);
88-
}
89-
90-
export default withSentry(App);
91-
```
92-
93-
You can disable or configure `ErrorBoundary` using a second parameter to `withSentry`.
34+
To set context information or to send manual events, you can use `@sentry/remix` as follows:
9435

9536
```ts
96-
97-
withSentry(App, {
98-
wrapWithErrorBoundary: false
99-
});
100-
101-
// or
102-
103-
withSentry(App, {
104-
errorBoundaryOptions: {
105-
fallback: <p>An error has occurred</p>
106-
}
107-
});
108-
```
109-
110-
To set context information or send manual events, use the exported functions of `@sentry/remix`.
111-
112-
```ts
113-
import * as Sentry from '@sentry/remix';
37+
import * as Sentry from '@sentry/nextjs';
11438

11539
// Set user information, as well as tags and further extras
116-
Sentry.setExtra('battery', 0.7);
11740
Sentry.setTag('user_mode', 'admin');
11841
Sentry.setUser({ id: '4711' });
42+
Sentry.setContext('application_area', { location: 'checkout' });
11943

12044
// Add a breadcrumb for future events
12145
Sentry.addBreadcrumb({
122-
message: 'My Breadcrumb',
46+
message: '"Add to cart" clicked',
12347
// ...
12448
});
12549

126-
// Capture exceptions, messages or manual events
50+
// Capture exceptions or messages
51+
Sentry.captureException(new Error('Oh no.'));
12752
Sentry.captureMessage('Hello, world!');
128-
Sentry.captureException(new Error('Good bye'));
129-
Sentry.captureEvent({
130-
message: 'Manual',
131-
stacktrace: [
132-
// ...
133-
],
134-
});
13553
```
136-
137-
## Sourcemaps and Releases
138-
139-
The Remix SDK provides a script that automatically creates a release and uploads sourcemaps. To generate sourcemaps with
140-
Remix, you need to call `remix build` with the `--sourcemap` option.
141-
142-
On release, call `sentry-upload-sourcemaps` to upload source maps and create a release. To see more details on how to
143-
use the command, call `sentry-upload-sourcemaps --help`.
144-
145-
For more advanced configuration,
146-
[directly use `sentry-cli` to upload source maps.](https://github.com/getsentry/sentry-cli).

packages/remix/package.json

+5-18
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
"engines": {
1313
"node": ">=14.18"
1414
},
15-
"files": [
16-
"/build",
17-
"/scripts"
18-
],
15+
"files": ["/build", "/scripts"],
1916
"main": "build/cjs/index.server.js",
2017
"module": "build/esm/index.server.js",
2118
"browser": "build/esm/index.client.js",
@@ -43,9 +40,7 @@
4340
},
4441
"typesVersions": {
4542
"<4.9": {
46-
"build/types/index.d.ts": [
47-
"build/types-ts3.8/index.d.ts"
48-
]
43+
"build/types/index.d.ts": ["build/types-ts3.8/index.d.ts"]
4944
}
5045
},
5146
"publishConfig": {
@@ -92,15 +87,10 @@
9287
"fix": "eslint . --format stylish --fix",
9388
"lint": "eslint . --format stylish",
9489
"test": "yarn test:unit",
95-
"test:integration": "run-s test:integration:otel test:integration:legacy",
96-
"test:integration:otel": "export USE_OTEL=1 && run-s test:integration:v1 test:integration:v2",
97-
"test:integration:legacy": "export USE_OTEL=0 && run-s test:integration:v1 test:integration:v2",
90+
"test:integration": "run-s test:integration:v1 test:integration:v2",
9891
"test:integration:v1": "run-s test:integration:clean test:integration:prepare test:integration:client test:integration:server",
9992
"test:integration:v2": "export REMIX_VERSION=2 && yarn test:integration:v1",
100-
"test:integration:ci": "run-s test:integration:ci:otel test:integration:ci:legacy",
101-
"test:integration:ci:otel": "USE_OTEL=1 yarn test:integration:ci:common",
102-
"test:integration:ci:legacy": "USE_OTEL=0 yarn test:integration:ci:common",
103-
"test:integration:ci:common": "run-s test:integration:clean test:integration:prepare test:integration:client:ci test:integration:server",
93+
"test:integration:ci": "run-s test:integration:clean test:integration:prepare test:integration:client:ci test:integration:server",
10494
"test:integration:prepare": "(cd test/integration && yarn install)",
10595
"test:integration:clean": "(cd test/integration && rimraf .cache node_modules build)",
10696
"test:integration:client": "yarn playwright install-deps && yarn playwright test test/integration/test/client/ --project='chromium'",
@@ -113,8 +103,5 @@
113103
"volta": {
114104
"extends": "../../package.json"
115105
},
116-
"sideEffects": [
117-
"./esm/index.server.js",
118-
"./src/index.server.ts"
119-
]
106+
"sideEffects": ["./esm/index.server.js", "./src/index.server.ts"]
120107
}

packages/remix/playwright.config.ts

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ const config: PlaywrightTestConfig = {
1313
// Note that 3 is a random number selected to work well with our CI setup
1414
workers: process.env.CI ? 3 : undefined,
1515
webServer: {
16-
env: {
17-
NODE_OPTIONS: process.env.USE_OTEL === '1' ? '--require ./instrument.server.cjs' : '',
18-
},
1916
command: '(cd test/integration/ && yarn build && yarn start)',
2017
port: 3000,
2118
},

packages/remix/src/index.server.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ export function getRemixDefaultIntegrations(options: RemixOptions): Integration[
169169
return [
170170
...getDefaultNodeIntegrations(options as NodeOptions).filter(integration => integration.name !== 'Http'),
171171
httpIntegration(),
172-
// eslint-disable-next-line deprecation/deprecation
173-
options.autoInstrumentRemix ? remixIntegration() : undefined,
172+
remixIntegration(),
174173
].filter(int => int) as Integration[];
175174
}
176175

@@ -202,7 +201,7 @@ export function init(options: RemixOptions): NodeClient | undefined {
202201

203202
const client = nodeInit(options as NodeOptions);
204203

205-
instrumentServer(options);
204+
instrumentServer();
206205

207206
return client;
208207
}

0 commit comments

Comments
 (0)