From a11630ed55669568a492db2a53902a9424803812 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 27 Nov 2024 18:05:24 +0100 Subject: [PATCH] feat(remix): Deprecate `autoInstrumentRemix: false` (#14508) --- docs/migration/draft-v9-migration-guide.md | 4 ++++ packages/remix/src/index.server.ts | 1 + packages/remix/src/utils/instrumentServer.ts | 2 ++ packages/remix/src/utils/remixOptions.ts | 21 ++++++++++++++++++-- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/migration/draft-v9-migration-guide.md b/docs/migration/draft-v9-migration-guide.md index 01138e2c2d42..a4701a5ae66f 100644 --- a/docs/migration/draft-v9-migration-guide.md +++ b/docs/migration/draft-v9-migration-guide.md @@ -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. diff --git a/packages/remix/src/index.server.ts b/packages/remix/src/index.server.ts index 2e7dd3708806..3e0c9b4da968 100644 --- a/packages/remix/src/index.server.ts +++ b/packages/remix/src/index.server.ts @@ -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[]; } diff --git a/packages/remix/src/utils/instrumentServer.ts b/packages/remix/src/utils/instrumentServer.ts index fbd874a12df9..119c1554d235 100644 --- a/packages/remix/src/utils/instrumentServer.ts +++ b/packages/remix/src/utils/instrumentServer.ts @@ -399,6 +399,7 @@ export function instrumentBuild( build: ServerBuild | (() => ServerBuild | Promise), options: RemixOptions, ): ServerBuild | (() => ServerBuild | Promise) { + // eslint-disable-next-line deprecation/deprecation const autoInstrumentRemix = options?.autoInstrumentRemix || false; if (typeof build === 'function') { @@ -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); }; }; diff --git a/packages/remix/src/utils/remixOptions.ts b/packages/remix/src/utils/remixOptions.ts index 4f73eca92ff3..9c33dc39f0d3 100644 --- a/packages/remix/src/utils/remixOptions.ts +++ b/packages/remix/src/utils/remixOptions.ts @@ -4,5 +4,22 @@ import type { Options } from '@sentry/types'; export type RemixOptions = (Options | BrowserOptions | NodeOptions) & { captureActionFormDataKeys?: Record; - 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; + } + );