From b7ff2ee266304dfa8c27ef21d82bb455a4a91474 Mon Sep 17 00:00:00 2001 From: ndesai-newrelic <89222514+ndesai-newrelic@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:29:55 -0500 Subject: [PATCH 1/4] merge from main (#167) * fix: disabled Interaction Flag Default false for React Native Agent (#165) * chore(deps): bump rexml in /NewRelicExampleApp/React-Native-Test-App (#163) Bumps [rexml](https://github.com/ruby/rexml) from 3.2.5 to 3.2.8. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.2.5...v3.2.8) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat: added backgroudnReporting and NewEventSystem Configuration (#168) #159 * chore: uodate Native Android Agent and Expo configs (#175) #172 * test: fix alphabetical order and add log values in jest mock (#176) --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Felipe Mengatto --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index a6581b6..8a49a11 100644 --- a/index.js +++ b/index.js @@ -675,7 +675,7 @@ class NewRelic { }else { this.logInfo("[CONSOLE][LOG]" +argsStr); } - + } } From 4472b3b1fa90e6ce24e4868618a8025bafe5afb5 Mon Sep 17 00:00:00 2001 From: ndesai Date: Thu, 8 Aug 2024 13:03:37 -0500 Subject: [PATCH 2/4] fix: fix the dependancies issue in 1.4.0 #180 --- index.js | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 8a49a11..9fd6928 100644 --- a/index.js +++ b/index.js @@ -638,6 +638,7 @@ class NewRelic { const defaultLog = console.log; const defaultWarn = console.warn; const defaultError = console.error; + const defaultDebug = console.debug; const self = this; console.log = function () { @@ -655,7 +656,7 @@ class NewRelic { console.debug = function () { self.sendConsole('debug', arguments); - defaultError.apply(console, arguments); + defaultDebug.apply(console, arguments); } diff --git a/package.json b/package.json index 99fc261..5e8e348 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ }, "sdkVersions": { "ios": { - "newrelic": "7.5.0" + "newrelic": "~>7.5.0" }, "android": { "newrelic": "7.5.+", From 4c959b944cd2fb62440fd007401ce9e19fdf3c91 Mon Sep 17 00:00:00 2001 From: ndesai Date: Mon, 19 Aug 2024 21:37:43 -0500 Subject: [PATCH 3/4] feat: add distributedTracing feature Flag --- .../src/main/java/com/NewRelic/NRMModularAgentModule.java | 6 ++++++ index.js | 3 ++- ios/bridge/NRMModularAgent.m | 4 ++++ new-relic/__tests__/new-relic.spec.js | 7 ++++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/NewRelic/NRMModularAgentModule.java b/android/src/main/java/com/NewRelic/NRMModularAgentModule.java index 1d2fad1..d10b38a 100644 --- a/android/src/main/java/com/NewRelic/NRMModularAgentModule.java +++ b/android/src/main/java/com/NewRelic/NRMModularAgentModule.java @@ -118,6 +118,12 @@ public void startAgent(String appKey, String agentVersion, String reactNativeVer NewRelic.disableFeature(FeatureFlag.BackgroundReporting); } + if ((Boolean) agentConfig.get("distributedTracingEnabled")) { + NewRelic.enableFeature(FeatureFlag.DistributedTracing); + } else { + NewRelic.disableFeature(FeatureFlag.DistributedTracing); + } + Map strToLogLevel = new HashMap<>(); strToLogLevel.put("ERROR", AgentLog.ERROR); strToLogLevel.put("WARNING", AgentLog.WARN); diff --git a/index.js b/index.js index 9fd6928..d56535c 100644 --- a/index.js +++ b/index.js @@ -47,7 +47,8 @@ class NewRelic { fedRampEnabled: false, offlineStorageEnabled: true, backgroundReportingEnabled: false, - newEventSystemEnabled: true + newEventSystemEnabled: true, + distributedTracingEnabled: true, }; } diff --git a/ios/bridge/NRMModularAgent.m b/ios/bridge/NRMModularAgent.m index 71a20f9..1308e5d 100644 --- a/ios/bridge/NRMModularAgent.m +++ b/ios/bridge/NRMModularAgent.m @@ -78,6 +78,10 @@ - (dispatch_queue_t)methodQueue{ if ([[agentConfig objectForKey:@"newEventSystemEnabled"]boolValue] == YES) { [NewRelic enableFeatures:NRFeatureFlag_NewEventSystem]; } + + if ([[agentConfig objectForKey:@"distributedTracingEnabled"]boolValue] == NO) { + [NewRelic enableFeatures:NRFeatureFlag_DistributedTracing]; + } //Default is NRLogLevelWarning NRLogLevels logLevel = NRLogLevelWarning; diff --git a/new-relic/__tests__/new-relic.spec.js b/new-relic/__tests__/new-relic.spec.js index f695965..eb7811b 100644 --- a/new-relic/__tests__/new-relic.spec.js +++ b/new-relic/__tests__/new-relic.spec.js @@ -87,7 +87,7 @@ describe('New Relic', () => { expect(NewRelic.agentConfiguration.offlineStorageEnabled).toBe(true); expect(NewRelic.agentConfiguration.newEventSystemEnabled).toBe(true); expect(NewRelic.agentConfiguration.backgroundReportingEnabled).toBe(false); - + expect(NewRelic.agentConfiguration.distributedTracingEnabled).toBe(true); }); it('should change default agent configuration when configuration is passed into the start call', () => { @@ -107,7 +107,8 @@ describe('New Relic', () => { nativeCrashReportingEnabled:false, offlineStorageEnabled:false, newEventSystemEnabled:false, - backgroundReportingEnabled:true + backgroundReportingEnabled:true, + distributedTracingEnabled: false }; NewRelic.startAgent("12345", customerConfiguration); @@ -128,7 +129,7 @@ describe('New Relic', () => { expect(NewRelic.agentConfiguration.nativeCrashReportingEnabled).toBe(false); expect(NewRelic.agentConfiguration.newEventSystemEnabled).toBe(false); expect(NewRelic.agentConfiguration.backgroundReportingEnabled).toBe(true); - + expect(NewRelic.agentConfiguration.distributedTracingEnabled).toBe(false); }); it('should set the analytics event flag', () => { From 5670d618f44c088aa6af968b7886dc64cd554e86 Mon Sep 17 00:00:00 2001 From: ndesai Date: Wed, 21 Aug 2024 14:02:10 -0500 Subject: [PATCH 4/4] docs: release 1.4.2 --- CHANGELOG.md | 12 +++++ README.md | 76 +++++++++++++++++---------- index.js | 2 +- new-relic/__tests__/new-relic.spec.js | 2 +- package.json | 4 +- 5 files changed, 64 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 987d516..bdc412a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 1.4.2 + +## New Features + +1. **Distributed Tracing Control** + - Introducing a new feature flag: `distributedTracingEnabled`, providing the ability to enable or disable distributed tracing functionality. + +## Bug Fixes + +- Addressed an issue where console debug logs were incorrectly displayed as console errors. + + ## 1.4.1 ## New Features diff --git a/README.md b/README.md index 38598b5..8e965c8 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,14 @@ import {Platform} from 'react-native'; // iOS Specific // Optional: Enable or disable Background Reporting. - backgroundReportingEnabled:true, + backgroundReportingEnabled:false, // iOS Specific // Optional: Enable or disable to use our new, more stable, event system for iOS agent. - newEventSystemEnabled:true + newEventSystemEnabled:false, + + // Optional: Enable or disable distributed tracing. + distributedTracingEnabled: true, }; @@ -126,33 +129,50 @@ AppToken is platform-specific. You need to generate the seprate token for Androi ### Android Setup 1. Install the New Relic native Android agent ([instructions here](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/install-configure/install-android-apps-gradle-android-studio)). -2. Update `build.gradle`: - ```groovy - buildscript { - ... - repositories { - ... - mavenCentral() - } - dependencies { - ... - classpath "com.newrelic.agent.android:agent-gradle-plugin:7.5.0" - } - } - ``` - -3. Update `app/build.gradle`: -```groovy -plugins { - id 'newrelic' -} -``` -For legacy plugin application: -```groovy -apply plugin: 'newrelic' -``` -4. Make sure your app requests INTERNET and ACCESS_NETWORK_STATE permissions by adding these lines to your `AndroidManifest.xml` +2. Add the following changes to Apply Gradle Plugin: + +If you are using Plugins DSL to Apply the NewRelic Gradle Plugin, make the following changes: + +In android/settings.gradle: + ```groovy + plugins { + id "com.android.application" version "7.4.2" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.newrelic.agent.android" version "7.5.1" apply false // <-- include this + } + ``` + +In android/app/build.gradle: + ```groovy + plugins { + id "com.android.application" + id "kotlin-android" + id "com.newrelic.agent.android" //<-- include this + } + ``` + +Or, if you are using the traditional way to apply the plugin: + ```groovy + buildscript { + ... + repositories { + ... + mavenCentral() + } + dependencies { + ... + classpath "com.newrelic.agent.android:agent-gradle-plugin:7.5.1" + } + } + ``` + +Apply the NewRelic plugin to the top of the android/app/build.gradle file: + ```groovy + apply plugin: "com.android.application" + apply plugin: 'newrelic' // <-- include this + ``` +3. Make sure your app requests INTERNET and ACCESS_NETWORK_STATE permissions by adding these lines to your `AndroidManifest.xml` ``` diff --git a/index.js b/index.js index d56535c..b0f8bc6 100644 --- a/index.js +++ b/index.js @@ -47,7 +47,7 @@ class NewRelic { fedRampEnabled: false, offlineStorageEnabled: true, backgroundReportingEnabled: false, - newEventSystemEnabled: true, + newEventSystemEnabled: false, distributedTracingEnabled: true, }; } diff --git a/new-relic/__tests__/new-relic.spec.js b/new-relic/__tests__/new-relic.spec.js index eb7811b..85aee81 100644 --- a/new-relic/__tests__/new-relic.spec.js +++ b/new-relic/__tests__/new-relic.spec.js @@ -85,7 +85,7 @@ describe('New Relic', () => { expect(NewRelic.agentConfiguration.fedRampEnabled).toBe(false); expect(NewRelic.agentConfiguration.nativeCrashReportingEnabled).toBe(true); expect(NewRelic.agentConfiguration.offlineStorageEnabled).toBe(true); - expect(NewRelic.agentConfiguration.newEventSystemEnabled).toBe(true); + expect(NewRelic.agentConfiguration.newEventSystemEnabled).toBe(false); expect(NewRelic.agentConfiguration.backgroundReportingEnabled).toBe(false); expect(NewRelic.agentConfiguration.distributedTracingEnabled).toBe(true); }); diff --git a/package.json b/package.json index 5e8e348..8773eb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "newrelic-react-native-agent", - "version": "1.4.1", + "version": "1.4.2", "description": "A New Relic Mobile Agent for React Native", "main": "./index.js", "types": "./dist/index.d.ts", @@ -92,7 +92,7 @@ }, "sdkVersions": { "ios": { - "newrelic": "~>7.5.0" + "newrelic": "~>7.5.1" }, "android": { "newrelic": "7.5.+",