Skip to content

feat(v8): Remove deprecated addInstrumentationHandler #10693

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

Merged
merged 1 commit into from
Feb 20, 2024
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
2 changes: 1 addition & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type PolymorphicRequestHeaders =
};

/**
* Create and track fetch request spans for usage in combination with `addInstrumentationHandler`.
* Create and track fetch request spans for usage in combination with `addFetchInstrumentationHandler`.
*
* @returns Span if a span was created, otherwise void.
*/
Expand Down
46 changes: 0 additions & 46 deletions packages/utils/src/instrument/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// TODO(v8): Consider moving this file (or at least parts of it) into the browser package. The registered handlers are mostly non-generic and we risk leaking runtime specific code into generic packages.

import { DEBUG_BUILD } from '../debug-build';
import { logger } from './../logger';
import type {
InstrumentHandlerCallback as _InstrumentHandlerCallback,
InstrumentHandlerType as _InstrumentHandlerType,
} from './_handlers';
import { resetInstrumentationHandlers } from './_handlers';
import { addConsoleInstrumentationHandler } from './console';
import { addClickKeypressInstrumentationHandler } from './dom';
Expand All @@ -15,46 +9,6 @@ import { addGlobalUnhandledRejectionInstrumentationHandler } from './globalUnhan
import { addHistoryInstrumentationHandler } from './history';
import { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from './xhr';

/**
* Add handler that will be called when given type of instrumentation triggers.
* Use at your own risk, this might break without changelog notice, only used internally.
* @hidden
* @deprecated Use the proper function per instrumentation type instead!
*/
export function addInstrumentationHandler(type: _InstrumentHandlerType, callback: _InstrumentHandlerCallback): void {
switch (type) {
case 'console':
return addConsoleInstrumentationHandler(callback);
case 'dom':
return addClickKeypressInstrumentationHandler(callback);
case 'xhr':
return addXhrInstrumentationHandler(callback);
case 'fetch':
return addFetchInstrumentationHandler(callback);
case 'history':
return addHistoryInstrumentationHandler(callback);
case 'error':
return addGlobalErrorInstrumentationHandler(callback);
case 'unhandledrejection':
return addGlobalUnhandledRejectionInstrumentationHandler(callback);
default:
DEBUG_BUILD && logger.warn('unknown instrumentation type:', type);
}
}

/**
* @deprecated Use the specific handler data types from @sentry/types instead, e.g. HandlerDataFetch, HandlerDataConsole, ...
*/
type InstrumentHandlerCallback = _InstrumentHandlerCallback;

/**
* @deprecated Use the specific handler functions instead, e.g. addConsoleInstrumentationHandler, ...
*/
type InstrumentHandlerType = _InstrumentHandlerType;

// eslint-disable-next-line deprecation/deprecation
export type { InstrumentHandlerCallback, InstrumentHandlerType };

export {
addConsoleInstrumentationHandler,
addClickKeypressInstrumentationHandler,
Expand Down