Skip to content
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

feat!: Remove deprecated and unused code #15077

Merged
merged 3 commits into from
Jan 20, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ installGlobals();

const ABORT_DELAY = 5_000;

export const handleError = Sentry.wrapRemixHandleError;
export const handleError = Sentry.sentryHandleError;

export default function handleRequest(
request: Request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ installGlobals();

const ABORT_DELAY = 5_000;

export const handleError = Sentry.wrapRemixHandleError;
export const handleError = Sentry.sentryHandleError;

export default function handleRequest(
request: Request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ installGlobals();

const ABORT_DELAY = 5_000;

export const handleError = Sentry.wrapRemixHandleError;
export const handleError = Sentry.sentryHandleError;

export default function handleRequest(
request: Request,
Expand Down
9 changes: 0 additions & 9 deletions packages/browser-utils/src/metrics/web-vitals/types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,6 @@ export type MetricWithAttribution =
*/
export type MetricRatingThresholds = [number, number];

/**
* @deprecated Use metric-specific function types instead, such as:
* `(metric: LCPMetric) => void`. If a single callback type is needed for
* multiple metrics, use `(metric: MetricType) => void`.
*/
export interface ReportCallback {
(metric: MetricType): void;
}

export interface ReportOpts {
reportAllChanges?: boolean;
durationThreshold?: number;
Expand Down
2 changes: 0 additions & 2 deletions packages/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export {
} from './tracing/browserTracingIntegration';
export type { RequestInstrumentationOptions } from './tracing/request';
export {
// eslint-disable-next-line deprecation/deprecation
addTracingExtensions,
registerSpanErrorInstrumentation,
getActiveSpan,
getRootSpan,
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,11 +1079,13 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
/**
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
*/
// TODO(v10): Remove
export type BaseClient = Client;

/**
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
*/
// TODO(v10): Remove
export const BaseClient = Client;

/**
Expand Down
23 changes: 0 additions & 23 deletions packages/core/src/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { Client } from './client';
import type { Scope } from './scope';
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes';
import { SPAN_STATUS_ERROR, setHttpStatus, startInactiveSpan } from './tracing';
import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan';
Expand Down Expand Up @@ -201,27 +199,6 @@ function _addTracingHeadersToFetchRequest(
}
}

/**
* Adds sentry-trace and baggage headers to the various forms of fetch headers.
*
* @deprecated This function will not be exported anymore in v9.
*/
export function addTracingHeadersToFetchRequest(
request: string | unknown,
_client: Client | undefined,
_scope: Scope | undefined,
fetchOptionsObj: {
headers?:
| {
[key: string]: string[] | string | undefined;
}
| PolymorphicRequestHeaders;
},
span?: Span,
): PolymorphicRequestHeaders | undefined {
return _addTracingHeadersToFetchRequest(request as Request, fetchOptionsObj, span);
}

function getFullURL(url: string): string | undefined {
try {
const parsed = new URL(url);
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ export { rewriteFramesIntegration } from './integrations/rewriteframes';
export { zodErrorsIntegration } from './integrations/zoderrors';
export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter';
export { profiler } from './profiling';
export {
// eslint-disable-next-line deprecation/deprecation
addTracingHeadersToFetchRequest,
instrumentFetchRequest,
} from './fetch';
export { instrumentFetchRequest } from './fetch';
export { trpcMiddleware } from './trpc';
export { captureFeedback } from './feedback';
export type { ReportDialogOptions } from './report-dialog';
Expand Down
8 changes: 0 additions & 8 deletions packages/core/src/tracing/hubextensions.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/core/src/tracing/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export { registerSpanErrorInstrumentation } from './errors';
export { setCapturedScopesOnSpan, getCapturedScopesOnSpan } from './utils';
// eslint-disable-next-line deprecation/deprecation
export { addTracingExtensions } from './hubextensions';
export { startIdleSpan, TRACING_DEFAULTS } from './idleSpan';
export { SentrySpan } from './sentrySpan';
export { SentryNonRecordingSpan } from './sentryNonRecordingSpan';
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/utils-hoist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export {
parseSemver,
uuid4,
} from './misc';
// eslint-disable-next-line deprecation/deprecation
export { dynamicRequire, isNodeEnv, loadModule } from './node';
export { isNodeEnv, loadModule } from './node';
export { normalize, normalizeToSize, normalizeUrlToBase } from './normalize';
export {
addNonEnumerableProperty,
Expand Down Expand Up @@ -136,8 +135,6 @@ export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStack
export { callFrameToStackFrame, watchdogTimer } from './anr';
export { LRUMap } from './lru';
export {
// eslint-disable-next-line deprecation/deprecation
generatePropagationContext,
generateTraceId,
generateSpanId,
} from './propagationContext';
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/utils-hoist/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ export function isNodeEnv(): boolean {
* Requires a module which is protected against bundler minification.
*
* @param request The module path to resolve
* @deprecated This function will be removed in the next major version.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function dynamicRequire(mod: any, request: string): any {
function dynamicRequire(mod: any, request: string): any {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return mod.require(request);
}
Expand All @@ -48,17 +47,14 @@ export function loadModule<T>(moduleName: string): T | undefined {
let mod: T | undefined;

try {
// eslint-disable-next-line deprecation/deprecation
mod = dynamicRequire(module, moduleName);
} catch (e) {
// no-empty
}

if (!mod) {
try {
// eslint-disable-next-line deprecation/deprecation
const { cwd } = dynamicRequire(module, 'process');
// eslint-disable-next-line deprecation/deprecation
mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) as T;
} catch (e) {
// no-empty
Expand Down
13 changes: 0 additions & 13 deletions packages/core/src/utils-hoist/propagationContext.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
import type { PropagationContext } from '../types-hoist';
import { uuid4 } from './misc';

/**
* Returns a new minimal propagation context.
*
* @deprecated Use `generateTraceId` and `generateSpanId` instead.
*/
export function generatePropagationContext(): PropagationContext {
return {
traceId: generateTraceId(),
sampleRand: Math.random(),
};
}

/**
* Generate a random, valid trace ID.
*/
Expand Down
2 changes: 0 additions & 2 deletions packages/opentelemetry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export { getDynamicSamplingContextFromSpan } from '@sentry/core';
export { isSentryRequestSpan } from './utils/isSentryRequest';

export { enhanceDscWithOpenTelemetryRootSpanName } from './utils/enhanceDscWithOpenTelemetryRootSpanName';
// eslint-disable-next-line deprecation/deprecation
export { generateSpanContextForPropagationContext } from './utils/generateSpanContextForPropagationContext';

export { getActiveSpan } from './utils/getActiveSpan';
export {
Expand Down

This file was deleted.

16 changes: 0 additions & 16 deletions packages/remix/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ export {
export * from '@sentry/node';

export {
// eslint-disable-next-line deprecation/deprecation
wrapRemixHandleError,
sentryHandleError,
wrapHandleErrorWithSentry,
} from './utils/instrumentServer';
Expand Down Expand Up @@ -158,20 +156,6 @@ export function getRemixDefaultIntegrations(options: RemixOptions): Integration[
].filter(int => int) as Integration[];
}

/**
* Returns the given Express createRequestHandler function.
* This function is no-op and only returns the given function.
*
* @deprecated No need to wrap the Express request handler.
* @param createRequestHandlerFn The Remix Express `createRequestHandler`.
* @returns `createRequestHandler` function.
*/
export function wrapExpressCreateRequestHandler(createRequestHandlerFn: unknown): unknown {
DEBUG_BUILD && logger.warn('wrapExpressCreateRequestHandler is deprecated and no longer needed.');

return createRequestHandlerFn;
}

/** Initializes Sentry Remix SDK on Node. */
export function init(options: RemixOptions): NodeClient | undefined {
applySdkMetadata(options, 'remix', ['remix', 'node']);
Expand Down
5 changes: 0 additions & 5 deletions packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ export function sentryHandleError(err: unknown, { request }: DataFunctionArgs):
});
}

/**
* @deprecated Use `sentryHandleError` instead.
*/
export const wrapRemixHandleError = sentryHandleError;

/**
* Sentry wrapper for Remix's `handleError` function.
* Remix Docs: https://remix.run/docs/en/main/file-conventions/entry.server#handleerror
Expand Down
Loading