feat: Automatically Detect MFE AJAX#1722
Conversation
Supportability Metric Usage Changes:No matching changes found Supportability Metrics .md File Changes:supportability_metrics.md was changed? 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. |
Asset Size Report
Merging this pull request will result in the following asset size changes:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1722 +/- ##
=======================================
Coverage 88.74% 88.74%
=======================================
Files 210 209 -1
Lines 7567 7598 +31
Branches 1559 1599 +40
=======================================
+ Hits 6715 6743 +28
- Misses 759 761 +2
- Partials 93 94 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ptang-nr
left a comment
There was a problem hiding this comment.
Reviewed to the best of my abilities. Might be good to get another set of eyes.
Co-authored-by: ptang-nr <ptang@newrelic.com>
Co-authored-by: Chunwai Li <cli@newrelic.com>
Co-authored-by: Chunwai Li <cli@newrelic.com>
Add support for automatic Micro Frontend (MFE) attribution of
AjaxRequestevents. Previously,AjaxRequestevents were only ever captured globally by the container browser application. With this change, the agent cross-compares the call stack signature of the AJAX call to the call stack signature of the MFE module that registered with theregisterAPI. If the file that is responsible for registering with the browser agent is found in the call stack signature of the AJAX request being triggered, that event will be attributed to the MFE instead of the container.Overview
Split from #1706
Line by line in the trace, If any file path in the call stack of the AJAX executor contains a match to the file path captured during use of the .register API, the event is captured as belonging to that MFE.
Logic is included to support reporting to both the MFE and the container application if the duplication configuration is enabled.
Testing
The vite-react-mfe test build is a great example app that implements the register API and supplies the correct set ups to replicate the behaviors across the auto-MFE PRs. See the new e2e and jest tests around this new behavior and play around with that vite build to see this in action.