Skip to content

Commit

Permalink
feat(remix): Deprecate autoInstrumentRemix: false (#14508)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored Nov 27, 2024
1 parent f82a570 commit a11630e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/migration/draft-v9-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
});
```

## `@sentry/remix`

- Deprecated `autoInstrumentRemix: false`. The next major version will default to behaving as if this option were `true` and the option itself will be removed.

## Server-side SDKs (`@sentry/node` and all dependents)

- Deprecated `processThreadBreadcrumbIntegration` in favor of `childProcessIntegration`. Functionally they are the same.
Expand Down
1 change: 1 addition & 0 deletions packages/remix/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export function getRemixDefaultIntegrations(options: RemixOptions): Integration[
return [
...getDefaultNodeIntegrations(options as NodeOptions).filter(integration => integration.name !== 'Http'),
httpIntegration(),
// eslint-disable-next-line deprecation/deprecation
options.autoInstrumentRemix ? remixIntegration() : undefined,
].filter(int => int) as Integration[];
}
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ export function instrumentBuild(
build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>),
options: RemixOptions,
): ServerBuild | (() => ServerBuild | Promise<ServerBuild>) {
// eslint-disable-next-line deprecation/deprecation
const autoInstrumentRemix = options?.autoInstrumentRemix || false;

if (typeof build === 'function') {
Expand Down Expand Up @@ -434,6 +435,7 @@ const makeWrappedCreateRequestHandler = (options: RemixOptions) =>
const newBuild = instrumentBuild(build, options);
const requestHandler = origCreateRequestHandler.call(this, newBuild, ...args);

// eslint-disable-next-line deprecation/deprecation
return wrapRequestHandler(requestHandler, newBuild, options.autoInstrumentRemix || false);
};
};
Expand Down
21 changes: 19 additions & 2 deletions packages/remix/src/utils/remixOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,22 @@ import type { Options } from '@sentry/types';

export type RemixOptions = (Options | BrowserOptions | NodeOptions) & {
captureActionFormDataKeys?: Record<string, string | boolean>;
autoInstrumentRemix?: boolean;
};
} & (
| {
/**
* Enables OpenTelemetry Remix instrumentation.
*
* Note: This option will be the default behavior and will be removed in the next major version.
*/
autoInstrumentRemix?: true;
}
| {
/**
* Enables OpenTelemetry Remix instrumentation
*
* @deprecated Setting this option to `false` is deprecated as the next major version will default to behaving as if this option were `true` and the option itself will be removed.
* It is recommended to set this option to `true`.
*/
autoInstrumentRemix?: false;
}
);

0 comments on commit a11630e

Please sign in to comment.