Skip to content

Commit

Permalink
feat: added Native C/C++ Crash Capture Support for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
ndesai-newrelic committed Aug 9, 2023
1 parent 9d96fc2 commit 56e135e
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.3.1

### New in this release
* Upgraded native iOS agent to v7.4.6
* Added Native C/C++ Crash Capture Support for Android


## 1.3.0

### New in this release
Expand Down
4 changes: 4 additions & 0 deletions NewRelicExampleApp/React-Native-Test-App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const agentConfiguration = {
// Optional:Enable or disable collection of event data.
analyticsEventEnabled: true,

// Android Specific
// Optional:Enable or disable collection of native c/c++ crash.
nativeCrashReportingEnabled: true,

// Optional:Enable or disable crash reporting.
crashReportingEnabled: true,

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ import {Platform} from 'react-native';
//Android Specific
// Optional:Enable or disable collection of event data.
analyticsEventEnabled: true,

//Android Specific
// Optional:Enable or disable collection of native c/c++ crash.
nativeCrashReportingEnabled: true,

// Optional:Enable or disable crash reporting.
crashReportingEnabled: true,
Expand Down
6 changes: 5 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ plugins {

def packageJson = PackageJson.getForProject(project)
def newrelicVersion = packageJson['sdkVersions']['android']['newrelic']
def ndkVersion = packageJson['sdkVersions']['android']['ndk']



project.ext {
set('react-native', [
versions: [

newrelic : [
android: newrelicVersion
android: newrelicVersion,
ndk:ndkVersion
],
],
])
Expand Down Expand Up @@ -76,6 +79,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
compileOnly 'com.facebook.react:react-native:+'
implementation "com.newrelic.agent.android:android-agent:${ReactNative.ext.getVersion("newrelic", "android")}"
implementation "com.newrelic.agent.android:agent-ndk:${ReactNative.ext.getVersion("newrelic", "ndk")}"
implementation "com.squareup.okhttp3:okhttp:4.9.1"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.1"
}
Expand Down
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 @@ -91,6 +91,12 @@ public void startAgent(String appKey, String agentVersion, String reactNativeVer
NewRelic.disableFeature(FeatureFlag.FedRampEnabled);
}

if ((Boolean) agentConfig.get("nativeCrashReportingEnabled")) {
NewRelic.enableFeature(FeatureFlag.NativeReporting);
} else {
NewRelic.disableFeature(FeatureFlag.NativeReporting);
}

Map<String, Integer> strToLogLevel = new HashMap<>();
strToLogLevel.put("ERROR", AgentLog.ERROR);
strToLogLevel.put("WARNING", AgentLog.WARN);
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class NewRelic {
this.agentVersion = version;
this.agentConfiguration = {
analyticsEventEnabled: true,
nativeCrashReportingEnabled: true,
crashReportingEnabled: true,
interactionTracingEnabled: true,
networkRequestEnabled: true,
Expand Down
2 changes: 2 additions & 0 deletions new-relic/__tests__/new-relic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ describe('New Relic', () => {
expect(NewRelic.agentConfiguration.collectorAddress).toBe("");
expect(NewRelic.agentConfiguration.crashCollectorAddress).toBe("");
expect(NewRelic.agentConfiguration.fedRampEnabled).toBe(false);
expect(NewRelic.agentConfiguration.nativeCrashReportingEnabled).toBe(true);

});

it('should change default agent configuration when configuration is passed into the start call', () => {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newrelic-react-native-agent",
"version": "1.3.0",
"version": "1.3.1",
"description": "A New Relic Mobile Agent for React Native",
"main": "./index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -94,7 +94,8 @@
"newrelic": "7.4.6"
},
"android": {
"newrelic": "7.0.0"
"newrelic": "7.0.0",
"ndk":"1.0.3"
}
}
}

0 comments on commit 56e135e

Please sign in to comment.