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

core(trace-elements): add sentry debugging for impactedNodes #15915

Merged
merged 4 commits into from
Apr 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
json string
  • Loading branch information
adamraine committed Apr 5, 2024
commit 7ca4c307e1d1a2a8988a3330e9481f8d098c324c
19 changes: 17 additions & 2 deletions core/gather/gatherers/trace-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,32 @@
}
return biggestImpactNodeId;
} catch (err) {
// See https://github.com/GoogleChrome/lighthouse/issues/15870
// `impactedNodes` should always be an array here, but it can randomly be something else for
// currently unknown reasons. This exception handling will help us identify what
// `impactedNodes` really is and also prevent the error from being fatal.

// It's possible `impactedNodes` is not JSON serializable, so let's add more supplemental
// fields just in case.
const impactedNodesType = typeof impactedNodes;
const impactedNodesClassName = impactedNodes?.constructor?.name;

let impactedNodesJson;
let eventJson;
try {
impactedNodesJson = JSON.parse(JSON.stringify(impactedNodes));
eventJson = JSON.parse(JSON.stringify(event));
} catch {}

Sentry.captureException(err, {
extra: {
impactedNodes,
event,
impactedNodes: impactedNodesJson,
event: eventJson,
impactedNodesType,
impactedNodesClassName,
},
});
return;

Check warning on line 132 in core/gather/gatherers/trace-elements.js

View check run for this annotation

Codecov / codecov/patch

core/gather/gatherers/trace-elements.js#L107-L132

Added lines #L107 - L132 were not covered by tests
}
}

Expand Down
Loading