From f7acd9c1f938694385fa9b48171e186923a02dbc Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 27 Nov 2024 12:28:50 +0000 Subject: [PATCH 1/2] feat(remix): Deprecate `autoInstrumentRemix` --- 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 | 20 ++++++++++++++++++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/migration/draft-v9-migration-guide.md b/docs/migration/draft-v9-migration-guide.md index d341410231bf..782a12259898 100644 --- a/docs/migration/draft-v9-migration-guide.md +++ b/docs/migration/draft-v9-migration-guide.md @@ -87,6 +87,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..db7f2ecdec08 100644 --- a/packages/remix/src/utils/remixOptions.ts +++ b/packages/remix/src/utils/remixOptions.ts @@ -4,5 +4,21 @@ 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. + */ + autoInstrumentRemix?: false; + } + ); From e4175e5baf4ba8aa6c36f1a3257059c3e83f39b5 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 27 Nov 2024 12:37:49 +0000 Subject: [PATCH 2/2] Recommendation to true. --- packages/remix/src/utils/remixOptions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/remix/src/utils/remixOptions.ts b/packages/remix/src/utils/remixOptions.ts index db7f2ecdec08..9c33dc39f0d3 100644 --- a/packages/remix/src/utils/remixOptions.ts +++ b/packages/remix/src/utils/remixOptions.ts @@ -18,6 +18,7 @@ export type RemixOptions = (Options | BrowserOptions | NodeOptions) & { * 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; }