Skip to content

Commit

Permalink
feat: add distributedTracing feature Flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ndesai-newrelic committed Aug 20, 2024
1 parent 4472b3b commit 4c959b9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions android/src/main/java/com/NewRelic/NRMModularAgentModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Integer> strToLogLevel = new HashMap<>();
strToLogLevel.put("ERROR", AgentLog.ERROR);
strToLogLevel.put("WARNING", AgentLog.WARN);
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class NewRelic {
fedRampEnabled: false,
offlineStorageEnabled: true,
backgroundReportingEnabled: false,
newEventSystemEnabled: true
newEventSystemEnabled: true,
distributedTracingEnabled: true,
};
}

Expand Down
4 changes: 4 additions & 0 deletions ios/bridge/NRMModularAgent.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions new-relic/__tests__/new-relic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -107,7 +107,8 @@ describe('New Relic', () => {
nativeCrashReportingEnabled:false,
offlineStorageEnabled:false,
newEventSystemEnabled:false,
backgroundReportingEnabled:true
backgroundReportingEnabled:true,
distributedTracingEnabled: false
};

NewRelic.startAgent("12345", customerConfiguration);
Expand All @@ -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', () => {
Expand Down

0 comments on commit 4c959b9

Please sign in to comment.