Skip to content
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

Use Performance API to get response status and sample accordingly #224

Merged
merged 3 commits into from
Nov 8, 2024

Conversation

phornig
Copy link
Collaborator

@phornig phornig commented Nov 7, 2024

Moved from fork to main repo

In cloud service depending on configuration we may not know the actual response status when injecting the RUM script, thus cannot determine if the 404 or standalone script should be included. This PR adds client-side code to determine the response status using the Performance API and trigger the 404 sampling when needed, effectively combining the 404 and standalone script into one.

The response code is read from the PerformanceNavigationTiming object. The responseStatus is supported by modern browsers except for Safari. As a fallback the ServerTiming object is inspected for a status property which is read from a server-timing header which needs to be injected by the server, e.g. in the CDN. This is also supported by Safari.

phornig and others added 3 commits November 5, 2024 13:44
Copy link

aem-code-sync bot commented Nov 7, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@kptdobe kptdobe merged commit 7702404 into main Nov 8, 2024
5 of 6 checks passed
@kptdobe kptdobe deleted the tracking404 branch November 8, 2024 08:50
adobe-bot pushed a commit that referenced this pull request Nov 8, 2024
# [2.9.0](v2.8.0...v2.9.0) (2024-11-08)

### Features

* use Performance API to get response status and sample accordingly ([#224](#224)) ([7702404](7702404))
@adobe-bot
Copy link
Collaborator

🎉 This PR is included in version 2.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants