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', () => {