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

add timing to debug logs for fides.js #5245

Merged
merged 2 commits into from
Aug 30, 2024
Merged

add timing to debug logs for fides.js #5245

merged 2 commits into from
Aug 30, 2024

Conversation

gilluminate
Copy link
Contributor

@gilluminate gilluminate commented Aug 29, 2024

Description Of Changes

Adds timings to our debug logs for fides.js

debug timings

Steps to Confirm

  • Run the demo site with console log open, preferable with an experience (like TCF) where the banner appears (eg. http://localhost:3001/fides-js-demo.html?geolocation=eea)

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Update CHANGELOG.md

Copy link

vercel bot commented Aug 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Aug 29, 2024 5:42pm

Copy link

cypress bot commented Aug 29, 2024

fides    Run #9742

Run Properties:  status check passed Passed #9742  •  git commit e8001aa292 ℹ️: Merge 46245f732c3b4b1e0761dd5b776020f90c7e308a into b7bb6bbbf74e36327f89054d909e...
Project fides
Branch Review refs/pull/5245/merge
Run status status check passed Passed #9742
Run duration 00m 39s
Commit git commit e8001aa292 ℹ️: Merge 46245f732c3b4b1e0761dd5b776020f90c7e308a into b7bb6bbbf74e36327f89054d909e...
Committer Jason Gill
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

Copy link
Contributor

@eastandwestwind eastandwestwind left a comment

Choose a reason for hiding this comment

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

Looks good, and I know my comments are on just the demo page, but nonetheless I want to be certain we're avoiding "property does not exist on type" errors.

window.addEventListener("FidesUIShown", () => {
// Log event timing
const fidesLoaded = performance
.getEntriesByType("resource")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can performance.getEntriesByType("resource") ever be null?

Copy link
Contributor Author

@gilluminate gilluminate Aug 29, 2024

Choose a reason for hiding this comment

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

not null, only empty array []

fidesTiming[
`fides.js (${(fidesLoaded.encodedBodySize / 1000).toFixed(2)} kB)`
] = {
"Time (ms)": parseFloat(fidesLoaded.responseEnd.toFixed(2)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can fidesLoaded be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only if fides.js didn't load on the demo page, and then we have bigger fish to fry 😄

.getEntriesByType("resource")
.find((entry) => entry.name.includes("fides"));
const fidesEvents = performance
.getEntriesByType("mark")
Copy link
Contributor

Choose a reason for hiding this comment

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

same here- can we rely on this existing?

Copy link
Contributor Author

@gilluminate gilluminate Aug 29, 2024

Choose a reason for hiding this comment

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

worst case it's empty array []

@gilluminate gilluminate merged commit e8f3440 into main Aug 30, 2024
13 checks passed
@gilluminate gilluminate deleted the log-timings branch August 30, 2024 15:39
Copy link

cypress bot commented Aug 30, 2024

fides    Run #9759

Run Properties:  status check passed Passed #9759  •  git commit e8f344029b: add timing to debug logs for fides.js (#5245)
Project fides
Branch Review main
Run status status check passed Passed #9759
Run duration 00m 38s
Commit git commit e8f344029b: add timing to debug logs for fides.js (#5245)
Committer Jason Gill
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

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.

2 participants