
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@liftango/react-native-newrelic
Advanced tools
New Relic event reporting for react native.
also check out https://github.com/wix/sentry-monitor
overrideConsole
will send all console.log, warn and errors to New Relic.reportUncaughtExceptions
will send uncaught Javascript exceptions to New Relic.More to come!
npm install react-native-newrelic --save
In the Podfile for your project, add the following line:
pod 'NewRelicAgent'
Make sure Xcode is closed and run: pod install
In the project navigator:
Add the following:
-(void)setupNewRelic{
NSString* token;
if(isDebug) {
token = @"<your new relic dev token (optional)>";
} else {
token = @"<your new relic production token";
}
[NewRelicAgent startWithApplicationToken:token];
}
And add the following line to the top of your didFinishLaunchingWithOptions function:
[self setupNewRelic];
Add a PrefixHeader.pch
file as explained here
Your file should look like this:
#ifdef __OBJC__
#import <NewRelicAgent/NewRelic.h>
#endif
This link describes how to add the original NewRelic agent to your project. This guide only requires a part of the original steps (some of the steps are already integrated in react-native-newrelic
:
In MainApplication.java
import Newrelic and override the following method:
import com.newrelic.agent.android.NewRelic;
public class MainApplication extends Application implements ReactApplication {
...
public void onCreate() {
super.onCreate();
NewRelic.withApplicationToken("yourApplicationToken").start(this);
}
...
}
Create newrelic.properties
in your root android dir:
com.newrelic.application_token= yourApplicationToken
Get your application token from newrelic.com
react-native-newrelic
module to your Android projectIn settings.gradle
:
include ':react-native-newrelic'
project(':react-native-newrelic').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-newrelic/android')
In your project level build.gradle
:
dependencies {
...
classpath "com.newrelic.agent.android:agent-gradle-plugin:5.11.+"
...
}
In your app level build.gradle
:
apply plugin: 'newrelic'
dependencies {
...
compile project(":react-native-newrelic")
compile fileTree(dir: "node_modules/react-native-newrelic/android/libs", include: ["*.jar"])
...
}
Add new RNNewRelicPackage()
to your list of packages in getPackages()
in MainApplication.java
:
@Override
public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(... new RNNewRelicPackage());
}
Add the following to your app root (e.g. app.ios.js
):
import {default as newRelic} from 'react-native-newrelic';
newRelic.init({
overrideConsole: true,
reportUncaughtExceptions: true,
globalAttributes: {
'this-string': 'will be sent with every event that is being reported'
}
});
Credits to @DanielZlotin for the initial version
FAQs
New Relic wrapper for React Native
We found that @liftango/react-native-newrelic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.