Skip to content

feat: Add more inspection events#1494

Merged
ellisong merged 2 commits into
mainfrom
inspection-events
Jun 11, 2025
Merged

feat: Add more inspection events#1494
ellisong merged 2 commits into
mainfrom
inspection-events

Conversation

@ellisong

@ellisong ellisong commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

Adds new inspection events to the agent. These events include the drain event, window lifecycle events such as navigate, load, DOMContentLoaded, and the session event which emits on changes to the agent's session state.

Overview

Adds new inspection events to the agent. These are new events not originally outlined in the CDD. The 'origin' event mentioned in the JIRA ticket is excluded due to too much code effort and not enough of a use case to have it.

drain event: Emits when the agent drains for a particular feature

{
    agentIdentifier,
    type: 'lifecycle',
    name: 'drain',
    feature: group
}

window lifecycle events:

{
    timeStamp: evt.timeStamp,
    loaded: evt.target.document.readyState === 'complete',
    type: 'window',
    name: 'navigate' | 'load' | 'DOMContentLoaded'
    data: evt.target.location + ''
}

session event: Emits when the agent's session state changes

{
    agentIdentifier,
    type: 'lifecycle',
    name: 'session',
    feature: undefined,
    data: <session state>
}

Related Issue(s)

JIRA: https://new-relic.atlassian.net/browse/NR-377594
Follow-up ticket: https://new-relic.atlassian.net/browse/NR-375666

Testing

The inspection-events tests were expanded. Open the inspection-events.html in the test server to test locally.

Make sure tests pass for this PR.

@github-actions

github-actions Bot commented Jun 6, 2025

Copy link
Copy Markdown

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

github-actions Bot commented Jun 6, 2025

Copy link
Copy Markdown

Asset Size Report

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

Agent Asset Previous Size New Size Diff
lite loader 24.97 kB / 9.47 kB (gzip) 25.55 kB / 9.65 kB (gzip) 2.35% / 1.88% (gzip)
lite async-chunk 52.6 kB / 17.45 kB (gzip) 52.6 kB / 17.45 kB (gzip) 0% / 0% (gzip)
pro loader 52.91 kB / 18.61 kB (gzip) 53.49 kB / 18.79 kB (gzip) 1.09% / 0.96% (gzip)
pro async-chunk 92 kB / 28.52 kB (gzip) 92 kB / 28.52 kB (gzip) 0% / 0% (gzip)
spa loader 61.66 kB / 21.31 kB (gzip) 62.25 kB / 21.49 kB (gzip) 0.94% / 0.85% (gzip)
spa async-chunk 116.63 kB / 35.49 kB (gzip) 116.63 kB / 35.49 kB (gzip) 0% / 0% (gzip)

@github-actions

github-actions Bot commented Jun 6, 2025

Copy link
Copy Markdown

Static Badge

Last ran on June 10, 2025 18:43:31 CDT
Checking merge of (b17c046) into main (375c37f)

@ellisong ellisong force-pushed the inspection-events branch from f75005f to 40f86a8 Compare June 9, 2025 22:47
@codecov

codecov Bot commented Jun 9, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.64%. Comparing base (375c37f) to head (b17c046).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/common/window/load.js 66.66% 1 Missing ⚠️
src/features/page_view_event/instrument/index.js 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1494      +/-   ##
==========================================
+ Coverage   87.61%   87.64%   +0.02%     
==========================================
  Files         197      197              
  Lines        7761     7778      +17     
  Branches     1563     1565       +2     
==========================================
+ Hits         6800     6817      +17     
- Misses        826      827       +1     
+ Partials      135      134       -1     
Flag Coverage Δ
unit-tests 78.78% <88.23%> (+0.06%) ⬆️

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.

@ellisong ellisong force-pushed the inspection-events branch from 863fb4f to b17c046 Compare June 10, 2025 19:28

@ptang-nr ptang-nr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@ellisong ellisong merged commit def89c4 into main Jun 11, 2025
52 of 68 checks passed
@ellisong ellisong deleted the inspection-events branch June 11, 2025 19:56
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