Skip to content

Commit 7206304

Browse files
logaretmclaude
andcommitted
refactor(browser-utils): Share MAX_PLAUSIBLE_INP_DURATION between INP handlers
Export the constant from inp.ts and import it in webVitalSpans.ts to avoid the two definitions drifting apart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7df4cd4 commit 7206304

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

packages/browser-utils/src/metrics/inp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ELEMENT_NAME_TIMESTAMP_MAP = new Map<number, string>();
3737
* 60 seconds is the maximum for a plausible INP value
3838
* (source: Me)
3939
*/
40-
const MAX_PLAUSIBLE_INP_DURATION = 60;
40+
export const MAX_PLAUSIBLE_INP_DURATION = 60;
4141
/**
4242
* Start tracking INP webvital events.
4343
*/

packages/browser-utils/src/metrics/webVitalSpans.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ import {
1717
} from '@sentry/core';
1818
import { DEBUG_BUILD } from '../debug-build';
1919
import { WINDOW } from '../types';
20-
import { INP_ENTRY_MAP } from './inp';
20+
import { INP_ENTRY_MAP, MAX_PLAUSIBLE_INP_DURATION } from './inp';
2121
import type { InstrumentationHandlerCallback } from './instrument';
2222
import { addClsInstrumentationHandler, addInpInstrumentationHandler, addLcpInstrumentationHandler } from './instrument';
2323
import { listenForWebVitalReportEvents, msToSec, supportsWebVital } from './utils';
2424

25-
// Maximum plausible INP duration in seconds (matches standalone INP handler)
26-
const MAX_PLAUSIBLE_INP_DURATION = 60;
27-
2825
interface WebVitalSpanOptions {
2926
name: string;
3027
op: string;

0 commit comments

Comments
 (0)