Skip to content

Commit

Permalink
Merge pull request #19154 from brnhensley/patch-6
Browse files Browse the repository at this point in the history
fix: code typos & formatting
  • Loading branch information
cbehera-newrelic authored Nov 4, 2024
2 parents 26feea1 + cbb8e49 commit 9f778d6
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ You can view detailed information about native crashes in New Relic Mobile's [**

## Configuration [#configuration]

Configuration requires adding an additional dependency in the build.gradle file of the app project(s) that start the new Relic agent:
Configuration requires adding an additional dependency in the `build.gradle` file of the app project(s) that start the new Relic agent:

```
```groovy
dependencies {
implementation 'com.newrelic.agent.android:agent-ndk:1.+'
}
Expand All @@ -47,21 +47,21 @@ Android agent artifacts can be found on [MavenCentral](https://search.maven.org/

In your app's code where the New Relic agent is added (usually in `MainActivity`), enable the `NativeReporting` feature flag prior to starting the agent:

```
```java
NewRelic.enableFeature(FeatureFlag.NativeReporting);
NewRelic
.withApplicationToken("<appToken>")
.withApplicationToken("APP_TOKEN")
.start(this.getApplication());
```

## Disable native crash reporting [#disable-crash-reporting]

If you want to use another native crash reporting tool, disable native crash reporting by calling `NewRelic.disableFeature(FeatureFlag/NativeReporting)` prior to agent initialization. For example:

```
```java
NewRelic.disableFeature(FeatureFlag.NativeReporting);
NewRelic
.withApplicationToken("<appToken>")
.withApplicationToken("APP_TOKEN")
.start(this.getApplication());
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ If you need to install the agent manually, follow these steps:

First, you'll need to add the Flutter agent into your dart project. In your `pubspec.yaml`, add the following to `dependencies`:

```dart
```yaml
dependencies:
newrelic_mobile: 0.0.1
newrelic_mobile: 0.0.1
```
</Step>
Expand All @@ -92,56 +92,59 @@ If you need to install the agent manually, follow these steps:

```dart
import 'package:newrelic_mobile/newrelic_mobile.dart';
var appToken = "";
if (Platform.isAndroid) {
appToken = "<android app token>"; // Replace with your application token copied from the New Relic UI.
} else if (Platform.isIOS) {
appToken = "<ios app token>"; // Replace with your application token copied from the New Relic UI.
}
Config config =
Config(accessToken: appToken,
//Android Specific
// Optional: Enable or disable collection of event data.
analyticsEventEnabled: true,
// Optional: Enable or disable reporting successful HTTP requests to the MobileRequest event type.
networkErrorRequestEnabled: true,
// Optional: Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
networkRequestEnabled: true,
// Optional: Enable or disable crash reporting.
crashReportingEnabled: true,
// Optional: Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.
interactionTracingEnabled: true,
// Optional: Enable or disable capture of HTTP response bodies for HTTP error traces and MobileRequestError events.
httpResponseBodyCaptureEnabled: true,
// Optional: Enable or disable agent logging.
loggingEnabled: true,
// iOS specific
// Optional: Enable or disable automatic instrumentation of WebViews
webViewInstrumentation: true,
//Optional: Enable or disable Print Statements as Analytics Events
printStatementAsEventsEnabled : true,
// Optional: Enable or disable automatic instrumentation of HTTP Request
httpInstrumentationEnabled:true,
// Optional: Enable or disable reporting data using different endpoints for US government clients
fedRampEnabled: false,
// Optional: Enable or disable offline data storage when no internet connection is available.
offlineStorageEnabled: true,
// iOS Specific
// Optional: Enable or disable background reporting functionality.
backgroundReportingEnabled: false,
// iOS Specific
// Optional: Enable or disable to use our new, more stable, event system for iOS agent.
newEventSystemEnabled: false,
// Optional: Enable or disable distributed tracing.
distributedTracingEnabled: true,
);
NewrelicMobile.instance.start(config, () {
runApp(MyApp());
});
class MyApp extends StatelessWidget {
....
var appToken = "";
if (Platform.isAndroid) {
appToken = "ANDROID_APP_TOKEN"; // Replace with your application token copied from the New Relic UI.
} else if (Platform.isIOS) {
appToken ="IOS_APP_TOKEN"; // Replace with your application token copied from the New Relic UI.
}
Config config = Config(
accessToken: appToken,
//Android Specific
// Optional: Enable or disable collection of event data.
analyticsEventEnabled: true,
// Optional: Enable or disable reporting successful HTTP requests to the MobileRequest event type.
networkErrorRequestEnabled: true,
// Optional: Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
networkRequestEnabled: true,
// Optional: Enable or disable crash reporting.
crashReportingEnabled: true,
// Optional: Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.
interactionTracingEnabled: true,
// Optional: Enable or disable capture of HTTP response bodies for HTTP error traces and MobileRequestError events.
httpResponseBodyCaptureEnabled: true,
// Optional: Enable or disable agent logging.
loggingEnabled: true,
// iOS specific
// Optional: Enable or disable automatic instrumentation of WebViews
webViewInstrumentation: true,
//Optional: Enable or disable Print Statements as Analytics Events
printStatementAsEventsEnabled : true,
// Optional: Enable or disable automatic instrumentation of HTTP Request
httpInstrumentationEnabled:true,
// Optional: Enable or disable reporting data using different endpoints for US government clients
fedRampEnabled: false,
// Optional: Enable or disable offline data storage when no internet connection is available.
offlineStorageEnabled: true,
// iOS Specific
// Optional: Enable or disable background reporting functionality.
backgroundReportingEnabled: false,
// iOS Specific
// Optional: Enable or disable to use our new, more stable, event system for iOS agent.
newEventSystemEnabled: false,
// Optional: Enable or disable distributed tracing.
distributedTracingEnabled: true,
);
NewrelicMobile.instance.start(config, () {
runApp(MyApp());
});
class MyApp extends StatelessWidget {
...
}
```

Make sure you paste your application token(s) into `appToken = ""` in the code above. If you deployed your hybrid app to both iOS and Android platforms, you'll need to add two separate tokens: one for iOS and one for Android.
Expand Down Expand Up @@ -182,15 +185,15 @@ If you need to install the agent manually, follow these steps:

```groovy
buildscript {
...
repositories {
...
repositories {
...
mavenCentral()
}
dependencies {
}
dependencies {
...
classpath "com.newrelic.agent.android:agent-gradle-plugin:7.5.1"
}
}
}
```

Expand All @@ -203,7 +206,7 @@ If you need to install the agent manually, follow these steps:

2. In your `AndroidManifest.xml` file, add the following permissions:

```dart
```xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```
Expand Down Expand Up @@ -338,8 +341,8 @@ After installing the Flutter agent, wait at least 5 minutes. If no HTTP data app

New Relic stores your Flutter logs as custom events. You can query these logs and build dashboards for them using this NRQL query:

```
SELECT * FROM `Mobile Dart Console Events` SINCE 30 MINUTES AGO
```sql
SELECT * FROM `Mobile Dart Console Events` SINCE 30 MINUTES AGO
```

For more information on NRQL queries, see [Introduction to NRQL](/docs/query-your-data/nrql-new-relic-query-language/get-started/introduction-nrql-new-relics-query-language/#where).
Original file line number Diff line number Diff line change
Expand Up @@ -60,62 +60,72 @@ If you need to install the agent manually, follow these steps:

2. Add the following code:

```tsx
import { NewRelicCapacitorPlugin, NREnums, AgentConfiguration } from '@newrelic/newrelic-capacitor-plugin';
import { Capacitor } from '@capacitor/core';
var appToken;
if(Capacitor.getPlatform() === 'ios') {
appToken = '<IOS-APP-TOKEN>';
} else {
appToken = '<ANDROID-APP-TOKEN>';
}
if(Capacitor.getPlatform() === 'ios') {
appToken = '<IOS-APP-TOKEN>';
} else {
appToken = '<ANDROID-APP-TOKEN>';
}
let agentConfig : AgentConfiguration = {
//Android Specific
// Optional:Enable or disable collection of event data.
analyticsEventEnabled: true,
// Optional:Enable or disable crash reporting.
crashReportingEnabled: true,
// Optional:Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.
interactionTracingEnabled: true,
// Optional:Enable or disable reporting successful HTTP requests to the MobileRequest event type.
networkRequestEnabled: true,
// Optional:Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
networkErrorRequestEnabled: true,
// Optional:Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.
httpResponseBodyCaptureEnabled: true,
// Optional:Enable or disable agent logging.
loggingEnabled: true,
// Optional:Specifies the log level. Omit this field for the default log level.
// Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).
logLevel: NREnums.LogLevel.INFO,
// iOS Specific
// Optional:Enable/Disable automatic instrumentation of WebViews
webViewInstrumentation: true,
// Optional:Set a specific collector address for sending data. Omit this field for default address.
// collectorAddress: "",
// Optional:Set a specific crash collector address for sending crashes. Omit this field for default address.
// crashCollectorAddress: "",
// Optional:Enable or disable sending JS console logs to New Relic.
sendConsoleEvents: true,
// Optional:Enable or disable reporting data using different endpoints for US government clients
//fedRampEnabled: false,
// Optional: Enable or disable offline data storage when no internet connection is available.
offlineStorageEnabled: true,
// iOS Specific
// Optional: Enable or disable Background Reporting.
backgroundReportingEnabled: true,
// iOS Specific
// Optional: Enable or disable to use our new, more stable event system for iOS agent.
newEventSystemEnabled: true
}
NewRelicCapacitorPlugin.start({appKey:appToken, agentConfiguration:agentConfig})
```
```tsx
import {
NewRelicCapacitorPlugin,
NREnums,
AgentConfiguration,
} from "@newrelic/newrelic-capacitor-plugin";
import { Capacitor } from "@capacitor/core";
let appToken;
if (Capacitor.getPlatform() === "ios") {
appToken = "IOS_APP_TOKEN";
} else {
appToken = "ANDROID_APP_TOKEN";
}
if (Capacitor.getPlatform() === "ios") {
appToken = "IOS_APP_TOKEN";
} else {
appToken = "ANDROID_APP_TOKEN";
}
let agentConfig: AgentConfiguration = {
// Android Specific
// Optional:Enable or disable collection of event data.
analyticsEventEnabled: true,
// Optional:Enable or disable crash reporting.
crashReportingEnabled: true,
// Optional:Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested.
// This will disable default and custom interactions.
interactionTracingEnabled: true,
// Optional:Enable or disable reporting successful HTTP requests to the MobileRequest event type.
networkRequestEnabled: true,
// Optional:Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
networkErrorRequestEnabled: true,
// Optional:Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.
httpResponseBodyCaptureEnabled: true,
// Optional:Enable or disable agent logging.
loggingEnabled: true,
// Optional:Specifies the log level. Omit this field for the default log level.
// Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).
logLevel: NREnums.LogLevel.INFO,
// iOS Specific
// Optional:Enable/Disable automatic instrumentation of WebViews
webViewInstrumentation: true,
// Optional:Set a specific collector address for sending data. Omit this field for default address.
// collectorAddress: "",
// Optional:Set a specific crash collector address for sending crashes. Omit this field for default address.
// crashCollectorAddress: "",
// Optional:Enable or disable sending JS console logs to New Relic.
sendConsoleEvents: true,
// Optional:Enable or disable reporting data using different endpoints for US government clients
// fedRampEnabled: false,
// Optional: Enable or disable offline data storage when no internet connection is available.
offlineStorageEnabled: true,
// iOS Specific
// Optional: Enable or disable Background Reporting.
backgroundReportingEnabled: true,
// iOS Specific
// Optional: Enable or disable to use our new, more stable event system for iOS agent.
newEventSystemEnabled: true,
};
NewRelicCapacitorPlugin.start({
appKey: appToken,
agentConfiguration: agentConfig,
});
```
Make sure you paste your application token(s) into `appToken = ""` in the code above. If you deployed your hybrid app to both iOS and Android platforms, you'll need to add two separate tokens: one for iOS and one for Android.
</Step>
Expand Down Expand Up @@ -162,9 +172,9 @@ If you need to install the agent manually, follow these steps:
3. In your `AndroidManifest.xml` file, add the following permissions:
```
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```
4. To automatically link the package, rebuild your project:
Expand Down
Loading

0 comments on commit 9f778d6

Please sign in to comment.