Skip to content

feat: Erase .api property on agent instance #1425

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

Merged
merged 2 commits into from
Mar 28, 2025
Merged

Conversation

cwli24
Copy link
Contributor

@cwli24 cwli24 commented Mar 27, 2025

The .api property of full and micro agents have been removed. The browser API methods are instead moved to the agent instance itself for ease of targeted access. This includes a minor fix of runtime loaderType for agents that are re-configured after load.

Overview

Instead of:

agent: {
 features: ...,
 info: ...,
 api: {
  setErrorHandler: () => {},
  setAPI: () => {},
  ...
 },
 ...
}

The API will now be:

agent: {
 features: ...,
 info: ...,
 setErrorHandler: () => {},
 setAPI: () => {},
 ...
}

mainOrMicroAgent.api.___ will still work as it will redirect up a level and call mainOrMicroAgent.___.

Related Issue(s)

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

Testing

Copy link

github-actions bot commented Mar 27, 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 30.6 kB / 11.08 kB (gzip) 30.68 kB / 11.05 kB (gzip) 0.26% / -0.28% (gzip)
lite async-chunk 52.82 kB / 17.23 kB (gzip) 52.8 kB / 17.23 kB (gzip) -0.04% / -0.01% (gzip)
pro loader 52.97 kB / 18.27 kB (gzip) 53.08 kB / 18.25 kB (gzip) 0.19% / -0.07% (gzip)
pro async-chunk 101.3 kB / 30.89 kB (gzip) 101.28 kB / 30.88 kB (gzip) -0.02% / -0.03% (gzip)
spa loader 60.59 kB / 20.58 kB (gzip) 60.69 kB / 20.57 kB (gzip) 0.17% / -0.06% (gzip)
spa async-chunk 116.01 kB / 35.23 kB (gzip) 115.99 kB / 35.23 kB (gzip) -0.02% / -0.01% (gzip)

Copy link

codecov bot commented Mar 27, 2025

Codecov Report

Attention: Patch coverage is 88.37209% with 10 lines in your changes missing coverage. Please review.

Project coverage is 88.76%. Comparing base (f808447) to head (b81bf51).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/loaders/api/api.js 94.23% 3 Missing ⚠️
src/loaders/agent-base.js 0.00% 1 Missing and 1 partial ⚠️
src/loaders/micro-agent-base.js 0.00% 1 Missing and 1 partial ⚠️
src/loaders/micro-agent.js 0.00% 2 Missing ⚠️
src/features/utils/nr1-debugger.js 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1425      +/-   ##
==========================================
+ Coverage   88.72%   88.76%   +0.03%     
==========================================
  Files         170      170              
  Lines        7444     7439       -5     
  Branches     1512     1509       -3     
==========================================
- Hits         6605     6603       -2     
+ Misses        731      727       -4     
- Partials      108      109       +1     
Flag Coverage Δ
integration-tests 90.92% <84.21%> (+0.05%) ⬆️
unit-tests 80.01% <83.33%> (-0.05%) ⬇️

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.

Copy link

github-actions bot commented Mar 27, 2025

Static Badge

Last ran on March 27, 2025 14:13:19 CDT
Checking merge of (b81bf51) into main (f808447)

@cwli24 cwli24 merged commit 44786ae into main Mar 28, 2025
31 of 32 checks passed
@cwli24 cwli24 deleted the remove-api-property branch March 28, 2025 18:15
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