Skip to content

Commit ef40a4b

Browse files
committed
Add FID deprecation warn on web vital measure
When any web vital is measured the FID deprecation warning is logged. This should ensure that browser based scripts that are measuring web vitals will log a warning for users to see and action on -- move to using INP.
1 parent cefb446 commit ef40a4b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/js/modules/k6/browser/common/frame_session.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import (
3636

3737
const utilityWorldName = "__k6_browser_utility_world__"
3838

39+
var fidDeprecationWarningOnce sync.Once
40+
3941
// CPUProfile is used in throttleCPU.
4042
type CPUProfile struct {
4143
// rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
@@ -345,6 +347,10 @@ func (fs *FrameSession) parseAndEmitWebVitalMetric(object string) error {
345347
return fmt.Errorf("json couldn't be parsed: %w", err)
346348
}
347349

350+
fidDeprecationWarningOnce.Do(func() {
351+
fs.logger.Warnf("FrameSession:parseAndEmitWebVitalMetric", "FID has been deprecated and superseded by INP -- https://web.dev/blog/fid")
352+
})
353+
348354
metric, ok := fs.k6Metrics.WebVitals[wv.Name]
349355
if !ok {
350356
return fmt.Errorf("metric not registered %q", wv.Name)

0 commit comments

Comments
 (0)