feat: Add useConsentModel functionality#1533
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 #1533 +/- ##
==========================================
- Coverage 88.32% 88.27% -0.06%
==========================================
Files 206 207 +1
Lines 7776 7793 +17
Branches 1591 1597 +6
==========================================
+ Hits 6868 6879 +11
- Misses 794 798 +4
- Partials 114 116 +2
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:
|
|
Adding API changes to PR, do not merge until ready. |
d4c9352 to
6d748e7
Compare
aa4f567 to
39a2b8b
Compare
|
can you please add type-check conditions for your new API method to |
|
we also haven't been very good about updating |
ea363df to
609dda9
Compare
metal-messiah
left a comment
There was a problem hiding this comment.
very minor comment, i am fine with leaving as-is or changing. LGTM
|
Blocked until API team is out of code freeze and can implement settings changes. |
metal-messiah
left a comment
There was a problem hiding this comment.
manually blocking to prevent accidental merge
c7b091a to
1c16467
Compare
1c16467 to
0b04e4c
Compare
Adds use_consent_mode init property and functionality. Adds the consent() API call. The consent model, if enabled, disallows agent harvesting unless consent is given through the consent() API call.
Overview
Adds useConsentModel init property and functionality (defaults to false). When turning
useConsentModelon, the agent will not harvest (send over the network) until given "consent". Consent is given by theconsentvalue in the session entity's local storage being set totrue.Adds an API method called
consent(accept?: boolean)that changes theconsentvalue in the session entity's local storage. Callingtrueorundefinedfor the argument grants consent, callingfalsein consent() rejects consent.Agent features are still manually or automatically started regardless of consent being enabled or not, but they won't send data over the network unless consent is granted.
Also adds a .nvmrc file for node version 22.11
Related Issue(s)
JIRA: https://new-relic.atlassian.net/browse/NR-438120
JIRA: https://new-relic.atlassian.net/browse/NR-438139
Testing
Tests are provided that tests the agent harvest blocking if the consent model is enabled in various situations. The default case (consent model not being enabled) is not tested since that's already covered.