Skip to content

Commit 794433e

Browse files
committed
ref(browser): Restructure browser-utils by domain
Reorganize browser-utils/src away from the catch-all metrics/ folder into clear domains: - instrumentation/ for event-source hooks (dom, history, location, xhr) plus the PerformanceObserver layer, renamed from metrics/instrument.ts to instrumentation/performanceObserver.ts to stop colliding with the folder - web-vitals/ for web-vital tracking, spans, inp, lcp, reportEvents, and the browser helpers merged into a single utils.ts - performance/ for generic performance-entry enrichment: entries, element/ user/resource timing, and shared utils browserMetrics.ts is split into web-vitals/tracking.ts and performance/ entries.ts, and utils.ts into web-vitals/reportEvents.ts and performance/ utils.ts. Public API (index.ts re-exports) is unchanged; only internal paths and the test tree move.
1 parent 43daa35 commit 794433e

34 files changed

Lines changed: 475 additions & 567 deletions

packages/browser-utils/src/index.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,49 @@ export {
44
addTtfbInstrumentationHandler,
55
addLcpInstrumentationHandler,
66
addInpInstrumentationHandler,
7-
} from './metrics/instrument';
7+
} from './instrumentation/performanceObserver';
88

99
export {
1010
addPerformanceEntries,
11-
addWebVitalsToSpan,
1211
startTrackingInteractions,
1312
startTrackingLongTasks,
1413
startTrackingLongAnimationFrames,
14+
} from './performance/entries';
15+
16+
export {
17+
addWebVitalsToSpan,
1518
// eslint-disable-next-line typescript/no-deprecated
1619
startTrackingWebVitals,
1720
registerInpInteractionListener,
18-
} from './metrics/browserMetrics';
21+
} from './web-vitals/tracking';
1922

2023
// eslint-disable-next-line typescript/no-deprecated
21-
export { elementTimingIntegration, startTrackingElementTiming } from './metrics/elementTiming';
24+
export { elementTimingIntegration, startTrackingElementTiming } from './performance/elementTiming';
2225

23-
export { userTimingIntegration } from './metrics/userTiming';
26+
export { userTimingIntegration } from './performance/userTiming';
2427

25-
export { extractNetworkProtocol } from './metrics/utils';
28+
export { extractNetworkProtocol } from './performance/utils';
2629

27-
export { trackClsAsSpan, trackInpAsSpan, trackLcpAsSpan } from './metrics/webVitalSpans';
30+
export { trackClsAsSpan, trackInpAsSpan, trackLcpAsSpan } from './web-vitals/spans';
2831

29-
export { whenIdleOrHidden } from './metrics/web-vitals-helpers/whenIdleOrHidden';
32+
export { whenIdleOrHidden } from './web-vitals/utils';
3033

31-
export { addClickKeypressInstrumentationHandler } from './instrument/dom';
34+
export { addClickKeypressInstrumentationHandler } from './instrumentation/dom';
3235

33-
export { addHistoryInstrumentationHandler } from './instrument/history';
36+
export { addHistoryInstrumentationHandler } from './instrumentation/history';
3437

3538
export { fetch, setTimeout, clearCachedImplementation, getNativeImplementation } from './getNativeImplementation';
3639

37-
export { addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY } from './instrument/xhr';
40+
export { addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY } from './instrumentation/xhr';
3841

3942
export { getBodyString, getFetchRequestArgBody, serializeFormData, parseXhrResponseHeaders } from './networkUtils';
4043

41-
export { resourceTimingToSpanAttributes } from './metrics/resourceTiming';
44+
export { resourceTimingToSpanAttributes } from './performance/resourceTiming';
4245

4346
export { htmlTreeAsString } from './htmlTreeAsString';
4447

4548
export { isElement } from './is';
4649

47-
export { getAbsoluteUrl } from './instrument/location';
50+
export { getAbsoluteUrl } from './instrumentation/location';
4851

4952
export type { FetchHint, NetworkMetaWarning, XhrHint } from './types';
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/browser-utils/src/metrics/instrument.ts renamed to packages/browser-utils/src/instrumentation/performanceObserver.ts

File renamed without changes.
File renamed without changes.

packages/browser-utils/src/metrics/web-vitals-helpers/getActivationStart.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/browser-utils/src/metrics/web-vitals-helpers/getNavigationEntry.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/browser-utils/src/metrics/web-vitals-helpers/globalListeners.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/browser-utils/src/metrics/web-vitals-helpers/onHidden.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)