Skip to content

Commit 3a4683e

Browse files
authored
feat(v8): Remove deprecated addInstrumentationHandler (#10693)
Removes `addInstrumentationHandler`, but does not move code into core just yet. ref #10100
1 parent db8f26e commit 3a4683e

File tree

2 files changed

+1
-47
lines changed

2 files changed

+1
-47
lines changed

packages/tracing-internal/src/common/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type PolymorphicRequestHeaders =
3030
};
3131

3232
/**
33-
* Create and track fetch request spans for usage in combination with `addInstrumentationHandler`.
33+
* Create and track fetch request spans for usage in combination with `addFetchInstrumentationHandler`.
3434
*
3535
* @returns Span if a span was created, otherwise void.
3636
*/

packages/utils/src/instrument/index.ts

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
// 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.
22

3-
import { DEBUG_BUILD } from '../debug-build';
4-
import { logger } from './../logger';
5-
import type {
6-
InstrumentHandlerCallback as _InstrumentHandlerCallback,
7-
InstrumentHandlerType as _InstrumentHandlerType,
8-
} from './_handlers';
93
import { resetInstrumentationHandlers } from './_handlers';
104
import { addConsoleInstrumentationHandler } from './console';
115
import { addClickKeypressInstrumentationHandler } from './dom';
@@ -15,46 +9,6 @@ import { addGlobalUnhandledRejectionInstrumentationHandler } from './globalUnhan
159
import { addHistoryInstrumentationHandler } from './history';
1610
import { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from './xhr';
1711

18-
/**
19-
* Add handler that will be called when given type of instrumentation triggers.
20-
* Use at your own risk, this might break without changelog notice, only used internally.
21-
* @hidden
22-
* @deprecated Use the proper function per instrumentation type instead!
23-
*/
24-
export function addInstrumentationHandler(type: _InstrumentHandlerType, callback: _InstrumentHandlerCallback): void {
25-
switch (type) {
26-
case 'console':
27-
return addConsoleInstrumentationHandler(callback);
28-
case 'dom':
29-
return addClickKeypressInstrumentationHandler(callback);
30-
case 'xhr':
31-
return addXhrInstrumentationHandler(callback);
32-
case 'fetch':
33-
return addFetchInstrumentationHandler(callback);
34-
case 'history':
35-
return addHistoryInstrumentationHandler(callback);
36-
case 'error':
37-
return addGlobalErrorInstrumentationHandler(callback);
38-
case 'unhandledrejection':
39-
return addGlobalUnhandledRejectionInstrumentationHandler(callback);
40-
default:
41-
DEBUG_BUILD && logger.warn('unknown instrumentation type:', type);
42-
}
43-
}
44-
45-
/**
46-
* @deprecated Use the specific handler data types from @sentry/types instead, e.g. HandlerDataFetch, HandlerDataConsole, ...
47-
*/
48-
type InstrumentHandlerCallback = _InstrumentHandlerCallback;
49-
50-
/**
51-
* @deprecated Use the specific handler functions instead, e.g. addConsoleInstrumentationHandler, ...
52-
*/
53-
type InstrumentHandlerType = _InstrumentHandlerType;
54-
55-
// eslint-disable-next-line deprecation/deprecation
56-
export type { InstrumentHandlerCallback, InstrumentHandlerType };
57-
5812
export {
5913
addConsoleInstrumentationHandler,
6014
addClickKeypressInstrumentationHandler,

0 commit comments

Comments
 (0)