Gathering detailed insights and metrics for @newrelic/newrelic-capacitor-plugin
Gathering detailed insights and metrics for @newrelic/newrelic-capacitor-plugin
Gathering detailed insights and metrics for @newrelic/newrelic-capacitor-plugin
Gathering detailed insights and metrics for @newrelic/newrelic-capacitor-plugin
Mobile instrumentation plugin for the Capacitor hybrid mobile platform by Ionic
npm install @newrelic/newrelic-capacitor-plugin
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
7 Stars
148 Commits
10 Forks
10 Watching
4 Branches
31 Contributors
Updated on 18 Oct 2024
Swift (35.35%)
Java (32.65%)
TypeScript (24.81%)
CSS (3.7%)
Objective-C (1.69%)
Ruby (1.01%)
HTML (0.47%)
JavaScript (0.23%)
Shell (0.09%)
Cumulative downloads
Total Downloads
Last day
-45.3%
418
Compared to previous day
Last week
3.2%
2,943
Compared to previous week
Last month
-7.8%
13,887
Compared to previous month
Last year
466.4%
133,826
Compared to previous year
NewRelic Plugin for ionic Capacitor. This plugin uses native New Relic Android and iOS agents to instrument the Ionic Capacitor environment. The New Relic SDKs collect crashes, network traffic, and other information for hybrid apps using native components.
1npm install @newrelic/newrelic-capacitor-plugin 2npx cap sync
You can start the New Relic agent in the initialization of your app in main.ts
(Angular or Vue) or index.tsx
(React). Add the following code to launch NewRelic (don't forget to put proper application tokens):
1import { NewRelicCapacitorPlugin, NREnums, AgentConfiguration } from '@newrelic/newrelic-capacitor-plugin'; 2import { Capacitor } from '@capacitor/core'; 3 4var appToken; 5 6if(Capacitor.getPlatform() === 'ios') { 7 appToken = '<IOS-APP-TOKEN>'; 8} else { 9 appToken = '<ANDROID-APP-TOKEN>'; 10} 11 12let agentConfig : AgentConfiguration = { 13 //Android Specific 14 // Optional:Enable or disable collection of event data. 15 analyticsEventEnabled: true, 16 17 // Optional:Enable or disable crash reporting. 18 crashReportingEnabled: true, 19 20 // Optional:Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. 21 interactionTracingEnabled: true, 22 23 // Optional:Enable or disable reporting successful HTTP requests to the MobileRequest event type. 24 networkRequestEnabled: true, 25 26 // Optional:Enable or disable reporting network and HTTP request errors to the MobileRequestError event type. 27 networkErrorRequestEnabled: true, 28 29 // Optional:Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events. 30 httpResponseBodyCaptureEnabled: true, 31 32 // Optional:Enable or disable agent logging. 33 loggingEnabled: true, 34 35 // Optional:Specifies the log level. Omit this field for the default log level. 36 // Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose). 37 logLevel: NREnums.LogLevel.INFO, 38 39 // iOS Specific 40 // Optional:Enable/Disable automatic instrumentation of WebViews 41 webViewInstrumentation: true, 42 43 // Optional:Set a specific collector address for sending data. Omit this field for default address. 44 // collectorAddress: "", 45 46 // Optional:Set a specific crash collector address for sending crashes. Omit this field for default address. 47 // crashCollectorAddress: "", 48 49 // Optional:Enable or disable sending JS console logs to New Relic. 50 sendConsoleEvents: true, 51 52 // Optional: Enable or disable reporting data using different endpoints for US government clients. 53 fedRampEnabled: false, 54 55 // Optional: Enable or disable offline data storage when no internet connection is available. 56 offlineStorageEnabled:true, 57 58 // iOS Specific 59 // Optional: Enable or disable Background Reporting. 60 backgroundReportingEnabled:true, 61 62 // iOS Specific 63 // Optional: Enable or disable to use our new, more stable, event system for iOS agent. 64 newEventSystemEnabled:true 65 66 // Optional: Enable or disable distributed tracing. 67 distributedTracingEnabled: true, 68} 69 70NewRelicCapacitorPlugin.start({appKey:appToken, agentConfiguration:agentConfig}) 71 72
AppToken is platform-specific. You need to generate separate tokens for Android and iOS apps.
If you are using Plugins DSL to Apply the NewRelic Gradle Plugin, make the following changes:
In android/settings.gradle:
1plugins { 2 id "com.android.application" version "7.4.2" apply false 3 id "org.jetbrains.kotlin.android" version "1.7.10" apply false 4 id "com.newrelic.agent.android" version "7.5.1" apply false // <-- include this 5}
In android/app/build.gradle:
1plugins { 2 id "com.android.application" 3 id "kotlin-android" 4 id "com.newrelic.agent.android" //<-- include this 5}
Or, if you are using the traditional way to apply the plugin:
1buildscript { 2 ... 3 repositories { 4 ... 5 mavenCentral() 6 } 7 dependencies { 8 ... 9 classpath "com.newrelic.agent.android:agent-gradle-plugin:7.5.1" 10 } 11}
Apply the NewRelic plugin to the top of the android/app/build.gradle file:
1apply plugin: "com.android.application" 2apply plugin: 'newrelic' // <-- include this
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
To automatically link the package, rebuild your project:
1# Android apps 2ionic capacitor run android 3 4# iOS apps 5ionic capacitor run ios
To learn more about how to add custom instrumentation for Angular's HttpClient, follow the link here.
setUserId(...)
setAttribute(...)
removeAttribute(...)
recordBreadcrumb(...)
recordCustomEvent(...)
startInteraction(...)
endInteraction(...)
crashNow(...)
currentSessionId(...)
incrementAttribute(...)
noticeHttpTransaction(...)
recordMetric(...)
removeAllAttributes(...)
setMaxEventBufferTime(...)
setMaxEventPoolSize(...)
recordError(...)
analyticsEventEnabled(...)
networkRequestEnabled(...)
networkErrorRequestEnabled(...)
httpResponseBodyCaptureEnabled(...)
getAgentConfiguration(...)
shutdown(...)
generateDistributedTracingHeaders(...)
setMaxOfflineStorageSize(...)
Set a custom user identifier value to associate user sessions with analytics events and attributes.
1setUserId(options: { userId: string; }) => void
Param | Type |
---|---|
options | { userId: string; } |
1 NewRelicCapacitorPlugin.setUserId({ userId: "CapacitorUserId" });
Creates a session-level attribute shared by multiple mobile event types. Overwrites its previous value and type each time it is called.
1setAttribute(options: { name: string; value: string; }) => void
Param | Type |
---|---|
options | { name: string; value: string; } |
1 NewRelicCapacitorPlugin.setAttribute({ name: "CapacitorAttribute", value: "123" });
This method removes the attribute specified by the name string.
1removeAttribute(options: { name: string; }) => void
Param | Type |
---|---|
options | { name: string; } |
1 NewRelicCapacitorPlugin.removeAttribute({ name: "CapacitorAttribute" });
Track app activity/screen that may be helpful for troubleshooting crashes.
1recordBreadcrumb(options: { name: string; eventAttributes: object; }) => void
Param | Type |
---|---|
options | { name: string; eventAttributes: object; } |
1 NewRelicCapacitorPlugin.recordBreadcrumb({ name: "shoe", eventAttributes: {"shoeColor": "blue","shoesize": 9,"shoeLaces": true} });
Creates and records a custom event for use in New Relic Insights.
1recordCustomEvent(options: { eventType: string; eventName: string; attributes: object; }) => void
Param | Type |
---|---|
options | { eventType: string; eventName: string; attributes: object; } |
1 NewRelicCapacitorPlugin.recordCustomEvent({ eventType: "mobileClothes", eventName: "pants", attributes:{"pantsColor": "blue","pantssize": 32,"belt": true} });
Track a method as an interaction.
1startInteraction(options: { value: string; }) => Promise<{ value: string; }>
Param | Type |
---|---|
options | { value: string; } |
Returns: Promise<{ value: string; }>
End an interaction (Required). This uses the string ID for the interaction you want to end. This string is returned when you use startInteraction().
1endInteraction(options: { interactionId: string; }) => void
Param | Type |
---|---|
options | { interactionId: string; } |
1 const badApiLoad = async () => { 2 const id = await NewRelicCapacitorPlugin.startInteraction({ value: 'StartLoadBadApiCall' }); 3 console.log(id); 4 const url = 'https://fakewebsite.com/moviessssssssss.json'; 5 fetch(url) 6 .then((response) => response.json()) 7 .then((responseJson) => { 8 console.log(responseJson); 9 NewRelicCapacitorPlugin.endInteraction({ interactionId: id.value }); 10 }) .catch((error) => { 11 NewRelicCapacitorPlugin.endInteraction({ interactionId: id.value }); 12 console.error(error); 13 }); 14 };
Throws a demo run-time exception to test New Relic crash reporting.
1crashNow(options?: { message: string; } | undefined) => void
Param | Type |
---|---|
options | { message: string; } |
1 NewRelicCapacitorPlugin.crashNow();
2 NewRelicCapacitorPlugin.crashNow({ message: "A demo crash message" });
Returns the current session ID. This method is useful for consolidating monitoring of app data (not just New Relic data) based on a single session definition and identifier.
1currentSessionId(options?: {} | undefined) => Promise<{ sessionId: string; }>
Param | Type |
---|---|
options | {} |
Returns: Promise<{ sessionId: string; }>
1 let { sessionId } = await NewRelicCapacitorPlugin.currentSessionId();
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
1incrementAttribute(options: { name: string; value?: number; }) => void
Param | Type |
---|---|
options | { name: string; value?: number; } |
1 NewRelicCapacitorPlugin.incrementAttribute({ name: 'CapacitorAttribute', value: 15 })
Manually records HTTP transactions, with an option to also send a response body.
1noticeHttpTransaction(options: { url: string; method: string; status: number; startTime: number; endTime: number; bytesSent: number; bytesReceived: number; body: string; traceAttributes?: object}) => void
Param | Type |
---|---|
options | { url: string; method: string; status: number; startTime: number; endTime: number; bytesSent: number; bytesReceived: number; body: string; traceAttributes?: object} |
1 NewRelicCapacitorPlugin.noticeHttpTransaction({
2 url: "https://fakewebsite.com",
3 method: "GET",
4 status: 200,
5 startTime: Date.now(),
6 endTime: Date.now(),
7 bytesSent: 10,
8 bytesReceived: 2500,
9 body: "fake http response body 200",
10 });
Records network failures. If a network request fails, use this method to record details about the failures. In most cases, place this call inside exception handlers, such as catch blocks. Supported failures are: Unknown, BadURL, TimedOut, CannotConnectToHost, DNSLookupFailed, BadServerResponse, SecureConnectionFailed.
1noticeNetworkFailure(options: { url: string; method: string; startTime: number; endTime: number; failure: string; 2}) => void
Param | Type |
---|---|
options | { url: string; method: string; startTime: number; endTime: number; failure: string} |
1 NewRelicCapacitorPlugin.noticeNetworkFailure({
2 url: "https://fakewebsite400.com",
3 method: "GET",
4 startTime: Date.now(),
5 endTime: Date.now() + 200,
6 failure: "BadURL"
7 });
8
Records custom metrics (arbitrary numerical data), where countUnit is the measurement unit of the metric count and valueUnit is the measurement unit for the metric value. If using countUnit or valueUnit, then all of value, countUnit, and valueUnit must all be set. Supported measurements for countUnit and valueUnit are:
PERCENT
,BYTES
,SECONDS
,BYTES_PER_SECOND
,OPERATIONS
1recordMetric(options: { name: string; category: string; value?: number; countUnit?: string; valueUnit?: string; }) => void
Param | Type |
---|---|
options | { name: string; category: string; value?: number; countUnit?: string; valueUnit?: string; } |
1 NewRelicCapacitorPlugin.recordMetric({
2 name: "CapacitorMetricName",
3 category: "CapacitorMetricCategory",
4 });
5 NewRelicCapacitorPlugin.recordMetric({
6 name: "CapacitorMetricName2",
7 category: "CapacitorMetricCategory2",
8 value: 25,
9 });
10 NewRelicCapacitorPlugin.recordMetric({
11 name: "CapacitorMetricName3",
12 category: "CapacitorMetricCategory3",
13 value: 30,
14 countUnit: NREnums.MetricUnit.SECONDS,
15 valueUnit: NREnums.MetricUnit.OPERATIONS,
16 });
Removes all attributes from the session
1removeAllAttributes(options?: {} | undefined) => void
Param | Type |
---|---|
options | {} |
1 NewRelicCapacitorPlugin.removeAllAttributes();
Sets the event harvest cycle length. Default is 600 seconds (10 minutes). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.
1setMaxEventBufferTime(options: { maxBufferTimeInSeconds: number; }) => void
Param | Type |
---|---|
options | { maxBufferTimeInSeconds: number; } |
1 NewRelicCapacitorPlugin.setMaxEventBufferTime({ maxBufferTimeInSeconds: 60 });
Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.
1setMaxEventPoolSize(options: { maxPoolSize: number; }) => void
Param | Type |
---|---|
options | { maxPoolSize: number; } |
1 NewRelicCapacitorPlugin.setMaxEventPoolSize({ maxPoolSize: 2000 })
FOR ANDROID ONLY. Enable or disable the collecton of event data. This is set to true by default.
1analyticsEventEnabled(options: { enabled: boolean; }) => void
Param | Type |
---|---|
options | { enabled: boolean; } |
1 NewRelicCapacitorPlugin.analyticsEventEnabled({ enabled: true })
Enable or disable reporting successful HTTP requests to the MobileRequest event type. This is set to true by default.
1networkRequestEnabled(options: { enabled: boolean; }) => void
Param | Type |
---|---|
options | { enabled: boolean; } |
1 NewRelicCapacitorPlugin.networkRequestEnabled({ enabled: true })
Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
1networkErrorRequestEnabled(options: { enabled: boolean; }) => void
Param | Type |
---|---|
options | { enabled: boolean; } |
1 NewRelicCapacitorPlugin.networkErrorRequestEnabled({ enabled: true })
Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.
1httpResponseBodyCaptureEnabled(options: { enabled: boolean; }) => void
Param | Type |
---|---|
options | { enabled: boolean; } |
1 NewRelicCapacitorPlugin.httpResponseBodyCaptureEnabled({ enabled: true })
Returns the current agent configuration settings. This method allows you to see the current state of the agent configuration.
1getAgentConfiguration(options?: {} | undefined) => Promise<AgentConfiguration>
Param | Type |
---|---|
options | {} |
Returns: Promise<AgentConfiguration>
1 import { NewRelicCapacitorPlugin, AgentConfiguration} from '@newrelic/newrelic-capacitor-agent'; 2 3 let agentConfig : AgentConfiguration = await NewRelicCapacitorPlugin.getAgentConfiguration(); 4 let sendConsoleEvents = agentConfig.sendConsoleEvents;
Shut down the agent within the current application lifecycle during runtime.
1shutdown(options?: {} | undefined) => void
Param | Type |
---|---|
options | {} |
Generates headers and trace attributes required for manual distributed tracing and http instrumentation.
1generateDistributedTracingHeaders(options?: {} | undefined) => Promise<object>
Param | Type |
---|---|
options | {} |
1 let distributedTraceAttributes = await NewRelicCapacitorPlugin.generateDistributedTracingHeaders();
2 // Add traceparent, tracestate, and newrelic headers to http request
3 // ....
4 NewRelicCapacitorPlugin.noticeHttpTransaction({
5 url: "https://fakewebsite.com",
6 method: "GET",
7 status: 200,
8 startTime: Date.now(),
9 endTime: Date.now(),
10 bytesSent: 10,
11 bytesReceived: 2500,
12 body: "fake http response body 200",
13 traceAttributes: distributedTraceAttributes,
14 });
This API allows you to add any header field strings to a list that gets recorded as attributes with networking request events. After header fields have been added using this function, if the headers are in a network call they will be included in networking events in NR1.
1addHTTPHeadersTrackingFor(options:{headers: string[]}): void;
Param | Type |
---|---|
options | {headers: string[]} |
1 NewRelicCapacitorPlugin.addHTTPHeadersTrackingFor({headers:["Car","Music"]}); 2
Sets the maximum size of total data that can be stored for offline storage.By default, mobile monitoring can collect a maximum of 100 megaBytes of offline storage. When a data payload fails to send because the device doesn't have an internet connection, it can be stored in the file system until an internet connection has been made. After a typical harvest payload has been successfully sent, all offline data is sent to New Relic and cleared from storage.
1setMaxOfflineStorageSize(options: { megaBytes: number; }) => void
Param | Type |
---|---|
options | { megaBytes: number; } |
1 NewRelicCapacitorPlugin.setMaxOfflineStorageSize({ megaBytes: 200 })
logInfo(...)
Logs informational messages to the New Relic agent.
1logInfo(options: { message: string}) => void
Param | Type |
---|---|
options | { message: string;} |
1NewRelicCapacitorPlugin.logInfo( 2 {message: "User profile loaded successfully"});
logVerbose(...)
Logs verbose messages for detailed debugging information.
1logVerbose(options: { message: string }) => void
Param | Type |
---|---|
options | { message: string} |
1NewRelicCapacitorPlugin.logVerbose({message:"Verbose logging example"});
logError(...)
Logs error messages.
1logError(options: { message: string}) => void
Param | Type |
---|---|
options | { message: string} |
1NewRelicCapacitorPlugin.logError({message:"Error loading user profile"});
logWarn(...)
Logs warning messages.
1logWarn(options: { message: string}) => void
Param | Type |
---|---|
options | { message: string } |
1NewRelicCapacitorPlugin.logWarn({message: "Low disk space warning"});
logDebug(...)
Logs debug messages.
1logDebug(options: { message: string }) => void
Param | Type |
---|---|
options | { message: string } |
1NewRelicCapacitorPlugin.logDebug({message:"Debugging session started"});
logAll(...)
Logs a message with an associated set of attributes. This method is designed for logging generic events or errors along with detailed attributes for further analysis. It is a versatile logging function that can be used to log any type of information, including errors, warnings, or informational messages.
1logAll(options: { error: string; attributes: object; }): void
Param | Type |
---|---|
options | { error: string; attributes: object; } |
1NewRelicCapacitorPlugin.logAll({ 2 error: "UnexpectedError", 3 attributes: { "errorCode": "500", "errorMessage": "Internal Server Error" ,level:"WARN"} 4});
logAttributes(...)
Logs multiple attributes at once by passing a map of key-value pairs. This method allows for the efficient addition of contextual information to logs, enhancing the diagnostic capability of logged event
1logAttributes(options: { attributes: object; }): void
Param | Type |
---|---|
options | { attributes: object; } |
1NewRelicCapacitorPlugin.logAttributes({attributes:{ 2 "userID": 12345, 3 "sessionID": "abcde12345", 4 "isLoggedIn": true, 5 "message":"this is test", 6 "level":"INFO" 7}});
Records JavaScript/TypeScript errors for Ionic Capacitor. You should add this method to your framework's global error handler.
1recordError(options: { name: string; message: string; stack: string; isFatal: boolean; attributes?: object; }) => void
Param | Type |
---|---|
options | { name: string; message: string; stack: string; isFatal: boolean; attributes?: object; } |
1 try {
2 throw new Error('Example error message');
3 } catch (e: any) {
4 NewRelicCapacitorPlugin.recordError({
5 name: e.name,
6 message: e.message,
7 stack: e.stack,
8 isFatal: false,
9 attributes: {
10 "status": "pending",
11 "escalate": false,
12 },
13 });
14 }
Angular 2+ exposes an ErrorHandler class to handle errors. You can implement New Relic by extending this class as follows:
1import { ErrorHandler, Injectable } from '@angular/core';
2import { NewRelicCapacitorPlugin } from "@newrelic/newrelic-capacitor-plugin";
3
4@Injectable()
5export class GlobalErrorHandler extends ErrorHandler {
6 constructor() {
7 super();
8 }
9 handleError(error: any): void {
10 NewRelicCapacitorPlugin.recordError({
11 name: error.name,
12 message: error.message,
13 stack: error.stack ? error.stack : "No stack available",
14 isFatal: false,
15 attributes: {
16 "status": "pending",
17 "escalate": false,
18 },
19 });
20 super.handleError(error);
21 }
22}
Then, you'll need to let Angular 2 know about this new error handler by listing overrides for the provider in app.module.ts
:
1@NgModule({ 2 declarations: [AppComponent], 3 imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule,HttpClientModule], 4 providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },{provide: ErrorHandler, useClass: GlobalErrorHandler}], 5 bootstrap: [AppComponent], 6})
React 16+ has added error boundary components that catch errors that bubble up from child components. These are very useful for tracking and reporting errors to New Relic.
1import React, { Component, ErrorInfo, ReactNode } from "react"; 2import { NewRelicCapacitorPlugin } from "@newrelic/newrelic-capacitor-plugin"; 3 4interface Props { 5 children?: ReactNode; 6} 7 8interface State { 9 hasError: boolean; 10} 11 12class ErrorBoundary extends Component<Props, State> { 13 public state: State = { 14 hasError: false, 15 }; 16 17 public static getDerivedStateFromError(_: Error): State { 18 // Update state so the next render will show the fallback UI. 19 return { hasError: true }; 20 } 21 22 public componentDidCatch(error: Error, errorInfo: ErrorInfo) { 23 console.error("Uncaught error:", error, errorInfo); 24 NewRelicCapacitorPlugin.recordError({ 25 name: error.name, 26 message: error.message, 27 stack: error.stack ? error.stack : "No stack available", 28 isFatal: false, 29 attributes: { 30 "status": "pending", 31 "escalate": false, 32 }, 33 }); 34 } 35 36 public render() { 37 if (this.state.hasError) { 38 // Render error messages or other components here. 39 return; 40 } 41 42 return this.props.children; 43 } 44} 45 46export default ErrorBoundary;
Vue has a global error handler that reports native JavaScript errors and passes in the Vue instance. This handler will be useful for reporting errors to New Relic.
1import { NewRelicCapacitorPlugin } from "@newrelic/newrelic-capacitor-plugin";
2
3Vue.config.errorHandler = (err, vm, info) => {
4
5 // Record properties passed to the component if there are any
6 if(vm.$options.propsData) {
7 NewRelicCapacitorPlugin.recordBreadcrumb({
8 name: "Props passed to component in error handler",
9 eventAttributes: vm.$options.propsData
10 });
11 }
12
13 // Get the lifecycle hook, if present
14 let lifecycleHookInfo = 'none';
15 if (info){
16 lifecycleHookInfo = info;
17 }
18
19 // Record a breadcrumb with more details such as component name and lifecycle hook
20 NewRelicCapacitorPlugin.recordBreadcrumb({
21 name: "Vue Error",
22 eventAttributes: {
23 componentName: vm.$options.name,
24 lifeCycleHook: lifecycleHookInfo
25 }
26 });
27
28 // Record the JS error to New Relic
29 NewRelicCapacitorPlugin.recordError({
30 name: err.name,
31 message: err.message,
32 stack: err.stack ? err.stack : "No stack available",
33 isFatal: false,
34 attributes: {
35 "status": "pending",
36 "escalate": false,
37 },
38 });
39}
JavaScript errors can be seen in the Handled Exceptions
tab or as a MobileHandledException
event. You can also see these errors in the NRQL explorer using this query:
You can also build dashboard for errors using this query:
1SELECT * FROM `MobileHandledException` SINCE 24 hours ago
Note: Errors that do not produce a stack trace will not appear in the Handled Exceptions
tab but will appear as a MobileHandledException
event.
Our iOS agent includes a Swift script intended to be run from a build script in your target's build phases in XCode. The script automatically uploads dSYM files in the background (or converts your dSYM to the New Relic map file format), and then performs a background upload of the files needed for crash symbolication to New Relic.
To invoke this script during an XCode build:
APP_TOKEN
with your iOS application token.
With the ios agent 7.4.6 release, the XCFramework no longer includes the dsym-upload-tools. You can find the dsym-upload-tools in the dsym-upload-tools folder of the https://github.com/newrelic/newrelic-ios-agent-spm Swift Package Manager repository. Please copy the dsym-upload-tools directory into your application source code directory by copying the XCFramework into your project or using Cocoapods if you're integrating the New Relic iOS Agent. Use the run script below in your Xcode build phases to perform symbol upload steps during app builds in Xcode.
ARTIFACT_DIR="${BUILD_DIR%Build/*}SourcePackages/artifacts"
SCRIPT=`/usr/bin/find "${SRCROOT}" "${ARTIFACT_DIR}" -type f -name run-symbol-tool | head -n 1`
/bin/sh "${SCRIPT}" "APP_TOKEN"
The automatic script will create an upload_dsym_results.log
file in your project's iOS directory, which contains information about any failures that occur during symbol upload.
If dSYM files are missing, you may need to check Xcode build settings to ensure the file is being generated. Frameworks which are built locally have separate build settings and may need to be updated as well.
Build settings:
Debug Information Format : Dwarf with dSYM File
Deployment Postprocessing: Yes
Strip Linked Product: Yes
Strip Debug Symbols During Copy : Yes
Crash reports may not be sent when ProGuard rules are not properly configured for New Relic in hybrid Android applications.
Solution: Ensure proper ProGuard rules are added to your ProGuard configuration file. See "Configuring ProGuard Rules" in setup documentation.
We encourage your contributions to improve newrelic-capacitor-plugin
! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
If you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at opensource@newrelic.com.
A note about vulnerabilities
As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.
If you would like to contribute to this project, review these guidelines.
New Relic hosts and moderates an online forum where customers, users, maintainers, contributors, and New Relic employees can discuss and collaborate:
This project is distributed under the Apache 2 license.
newrelic-capacitor-plugin also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.
No vulnerabilities found.
No security vulnerabilities found.