Skip to content

feat: add config options for reportAll CLS and LCP #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2025

Conversation

williazz
Copy link
Contributor

@williazz williazz commented Mar 26, 2025

Revision 2

In web-vitals 4.x, CLS (along with INP) is only reported by default when visibility-change event fires. Previously, CLS was reported after first input. That means there is no way to make the integ test work unless we flip the reportAlChanges flag.

We want to release reportAllChanges flag for web vitals anyways. Since that feature unblocks the integ test in this pull request, then we can group them together for CLS+LCP and fast-forward merge to preserve the commit history.

Revision 1

The web-vitals library has upgraded to 4.x, and we need to keep pace. This is also necessary for INP.

One breaking change is that they renamed the incorrectly named LCP attribution resourceLoadTime to resourceLoadDuration. GoogleChrome/web-vitals#450

We will not rename this field yet unless we upgrade to another major version. So in the meantime we will keep the old name but take the same value.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ps863
Copy link
Member

ps863 commented Mar 26, 2025

Looks like integ test failed

@williazz williazz changed the title feat: upgrade web-vitals to 4.x feat: add config options for reportAll CLS and LCP Mar 26, 2025
@@ -187,6 +187,10 @@ const awsRum: AwsRum = new AwsRum(
| --- | --- | --- | --- |
| eventLimit | Number | `10` | The maximum number of resources to record load timing. <br/><br/>There may be many similar resources on a page (e.g., images) and recording all resources may add expense without adding value. The web client records all HTML files and JavaScript files, while recording a sample of stylesheets, images and fonts. Increasing the event limit increases the maximum number of sampled resources. |
| ignore | Function(event: PerformanceEntry) : any | `(entry: PerformanceEntry) => entry.entryType === 'resource' && !/^https?:/.test(entry.name)` | A function which accepts a [PerformanceEntry](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry) and returns a value that coerces to true when the PerformanceEntry should be ignored.</br></br> By default, [PerformanceResourceTiming](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming) entries with URLs that do not have http(s) schemes are ignored. This causes resources loaded by browser extensions to be ignored. |
| recordAllTypes | String[] | ['document', 'script', 'stylesheet', 'font'] | A list of resource types that are always recorded, no matter if the resource event limit has been reached. |
| sampleTypes | String[] | ['image', 'other'] | A list of resource types that are only recorded if the resource event limit has not been reached. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we link to any docs to show what users can specify here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in next revision

@limhjgrace limhjgrace self-requested a review March 27, 2025 00:10
@williazz williazz merged commit f1ebe53 into aws-observability:main Mar 27, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants