Skip to content

Conversation

@vinistevam
Copy link
Contributor

@vinistevam vinistevam commented Nov 12, 2025

Explanation

This PR adds latency reporting to shield coverage and signature coverage results. The latency (in milliseconds) is included as part of the metrics property in each coverage response, allowing downstream consumers and analytics systems to track and analyze the performance of coverage checks.

Unit tests have been updated to verify correct latency values in the metrics.

Changes

  • Add metrics.latency to coverage and signature coverage responses.
  • Update backend and test logic to use Date.now() for latency measurements.
  • Extend unit test coverage to validate latency reporting in result metrics.

References

Fixes https://github.com/MetaMask/MetaMask-planning/issues/6136

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Add metrics.latency to coverage and signature coverage responses, measuring end-to-end latency (including retries) and update tests and changelog accordingly.

  • Backend:
    • Add metrics.latency to GetCoverageResultResponse and CoverageResult returned by ShieldRemoteBackend.
    • Measure end-to-end latency in #getCoverageResult using Date.now(), including retries/delays via polling policy.
  • Types:
    • Extend CoverageResult and GetCoverageResultResponse with metrics.latency in src/types.ts and src/backend.ts.
  • Tests:
    • Update src/backend.test.ts to assert presence and correctness of metrics.latency for both transaction and signature coverage, including retry-delay scenarios.
  • Changelog:
    • Document addition of latency metrics in packages/shield-controller/CHANGELOG.md.

Written by Cursor Bugbot for commit fc9d432. This will update automatically on new commits. Configure here.

@vinistevam vinistevam marked this pull request as ready for review November 12, 2025 14:53
@vinistevam vinistevam requested review from a team as code owners November 12, 2025 14:53
@chaitanyapotti chaitanyapotti merged commit 620cd4d into main Nov 13, 2025
271 checks passed
@chaitanyapotti chaitanyapotti deleted the fix/add-latency-metrics branch November 13, 2025 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants