-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add time to first byte collection (#7)
* add adr and ttfb collection * update tests for ttfb
- Loading branch information
1 parent
eaf762f
commit 42f210d
Showing
7 changed files
with
153 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 001-web-vitals | ||
|
||
## Status | ||
|
||
Approved | ||
|
||
## Context | ||
|
||
There is good adoption of synthetic performance testing tools, particularly Google Lighthouse and [Page Speed Insights](https://pagespeed.web.dev). There are not as many widely deployed tools to anonymously collect field measurements of page speed performance from real users in a way that adequately captures their experience when using federal web properties. | ||
|
||
## Decision | ||
|
||
Google Analytics through the Digital Analytics Program within the federal government already has good adoption within the federal government. The `web-vitals.js` library from Google was selected as a way to instrument a website or application with performance collection. This library was chosen for its stability, as well as its completeness, as it is the basis of many commercial offerings (e.g. DataDog, Sentry) and its wide deployment through the Chrome Devtools Performance Panel. | ||
|
||
## Consequences | ||
|
||
This proposes an optional add-on for teams to be able to add and collect metrics on what a real user experiences as it relates to the universal performance indicators known as Core Web Vitals. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { onCLS, onINP, onFCP, onLCP } from 'web-vitals/attribution'; | ||
import { onCLS, onINP, onFCP, onLCP, onTTFB } from 'web-vitals/attribution'; | ||
|
||
export { onCLS, onINP, onFCP, onLCP }; | ||
export { onCLS, onINP, onFCP, onLCP, onTTFB }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { it, describe, expect } from 'vitest'; | ||
import { onCLS, onFCP, onINP, onLCP } from '../../src/web-vitals.js'; | ||
import { onCLS, onFCP, onINP, onLCP, onTTFB } from '../../src/web-vitals.js'; | ||
|
||
describe('DAP Performance Addon', () => { | ||
it('defines methods to track Core Web Vitals', () => { | ||
expect(typeof onCLS).toBe('function'); | ||
expect(typeof onFCP).toBe('function'); | ||
expect(typeof onINP).toBe('function'); | ||
expect(typeof onLCP).toBe('function'); | ||
expect(typeof onTTFB).toBe('function'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters