Skip to content

Conversation

@cwli24
Copy link
Contributor

@cwli24 cwli24 commented Nov 3, 2025

Re-introduces WebSocket instrumentation to capture metrics about its usage. When enabled by the 'websockets' feature flag, the agent will wrap the native API to record usage data around each instance and send it to New Relic as a "WebSocket" event on close.

Overview

  • Added socketId to error objects for better linkage with WebSocket events.
  • Removed deprecated WebSocket event handling code and associated metrics.
  • Added handling for page navigation away and adjusted tests.
  • Introduced new HTML test files for WebSocket error handling and multi-type message sending.
  • Updated existing tests to validate WebSocket metrics and error linkage.
  • Implemented a WebSocket echo server for testing various data types.
  • Edit third-party WebSocket wrappers to support new feature flags.

Related Issue(s)

https://new-relic.atlassian.net/browse/NR-455564

Testing

- Added socketId to error objects for better linkage with WebSocket events.
- Removed deprecated WebSocket event handling code and associated metrics.
- Introduced new HTML test files for WebSocket error handling and multi-type message sending.
- Updated existing tests to validate WebSocket metrics and error linkage.
- Implemented a WebSocket echo server for testing various data types.
- Enhanced third-party WebSocket wrappers to support new feature flags.
@cwli24 cwli24 marked this pull request as ready for review November 3, 2025 18:34
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Supportability Metric Usage Changes:

No matching changes found

Supportability Metrics .md File Changes:

supportability_metrics.md was changed? false

New supportability metrics require changes to supportability_metrics.md, as well as a new PR to Angler. Please ensure an Angler PR is created and linked to this PR.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Asset Size Report

Merging this pull request will result in the following asset size changes:

Agent Asset Previous Size New Size Diff
lite loader 25.96 kB / 9.8 kB (gzip) 25.97 kB / 9.79 kB (gzip) 0.04% / -0.08% (gzip)
lite async-chunk 53.84 kB / 18.05 kB (gzip) 53.84 kB / 18.05 kB (gzip) 0% / 0% (gzip)
pro loader 54.47 kB / 19.25 kB (gzip) 58.22 kB / 20.23 kB (gzip) 6.89% / 5.12% (gzip)
pro async-chunk 92.57 kB / 29.01 kB (gzip) 92.67 kB / 29.06 kB (gzip) 0.11% / 0.18% (gzip)
spa loader 63.32 kB / 21.95 kB (gzip) 67.08 kB / 23 kB (gzip) 5.93% / 4.82% (gzip)
spa async-chunk 117.98 kB / 36.32 kB (gzip) 118.08 kB / 36.38 kB (gzip) 0.09% / 0.16% (gzip)

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 86.76471% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.58%. Comparing base (f648e3f) to head (6902550).

Files with missing lines Patch % Lines
src/common/wrap/wrap-websocket.js 89.25% 13 Missing ⚠️
src/features/generic_events/aggregate/index.js 33.33% 2 Missing ⚠️
src/features/generic_events/instrument/index.js 66.66% 2 Missing ⚠️
src/features/jserrors/aggregate/index.js 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1614      +/-   ##
==========================================
+ Coverage   88.47%   88.58%   +0.11%     
==========================================
  Files         206      205       -1     
  Lines        7763     7852      +89     
  Branches     1593     1615      +22     
==========================================
+ Hits         6868     6956      +88     
- Misses        782      788       +6     
+ Partials      113      108       -5     
Flag Coverage Δ
unit-tests 81.99% <88.05%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Static Badge

Last ran on November 03, 2025 13:05:52 CST
Checking merge of (a3d7a26) into main (29f5bdf)

@metal-messiah metal-messiah self-assigned this Nov 3, 2025
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