diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e13a94..ee61307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +# 7.0.1 + +## New Features and Improvements + +Added a console log disable flag to optionally turn off console log instrumentation. This addresses loading issues some customers were experiencing with certain JavaScript files. + +## Improvements + +- Native Android agent updated to version 7.5.1 +- Native iOS agent updated to version 7.5.1 + # 7.0.0 ## New Features diff --git a/package.json b/package.json index ab04e63..94c9e12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "newrelic-cordova-plugin", - "version": "7.0.0", + "version": "7.0.1", "description": "New Relic Cordova Plugin for iOS and Android", "repo": "https://github.com/newrelic/newrelic-cordova-plugin/", "scripts": { diff --git a/plugin.xml b/plugin.xml index 3eedb41..d4a6399 100644 --- a/plugin.xml +++ b/plugin.xml @@ -6,7 +6,7 @@ + id="newrelic-cordova-plugin" version="7.0.1"> NewRelic New Relic Cordova Plugin for iOS and Android New Relic @@ -79,7 +79,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/src/android/NewRelicCordovaPlugin.java b/src/android/NewRelicCordovaPlugin.java index b3cba0e..8650d91 100644 --- a/src/android/NewRelicCordovaPlugin.java +++ b/src/android/NewRelicCordovaPlugin.java @@ -495,6 +495,12 @@ public void run() { callbackContext.success(headers); break; } + case "getConsoleLogFeatureFlag": { + JSONObject consoleLogEnabled = new JSONObject(); + consoleLogEnabled.put("consoleLogEnabled",preferences.getString("console_logs_enabled", "true")); + callbackContext.success(consoleLogEnabled); + break; + } case "logInfo": { final String message = args.getString(0); NewRelic.logInfo(message); diff --git a/src/ios/NewRelicCordovaPlugin.h b/src/ios/NewRelicCordovaPlugin.h index 0165a21..d29df93 100644 --- a/src/ios/NewRelicCordovaPlugin.h +++ b/src/ios/NewRelicCordovaPlugin.h @@ -65,6 +65,8 @@ - (void)getHTTPHeadersTrackingFor:(CDVInvokedUrlCommand *) command; +- (void)getConsoleLogFeatureFlag:(CDVInvokedUrlCommand *) command; + - (void)generateDistributedTracingHeaders:(CDVInvokedUrlCommand *)command; - (void)logInfo:(CDVInvokedUrlCommand *)command; diff --git a/src/ios/NewRelicCordovaPlugin.m b/src/ios/NewRelicCordovaPlugin.m index bd6ffb0..7e683b1 100644 --- a/src/ios/NewRelicCordovaPlugin.m +++ b/src/ios/NewRelicCordovaPlugin.m @@ -438,6 +438,14 @@ - (void)getHTTPHeadersTrackingFor:(CDVInvokedUrlCommand *) command{ } +- (void)getConsoleLogFeatureFlag:(CDVInvokedUrlCommand *) command{ + NSDictionary* config = self.commandDelegate.settings; + CDVPluginResult* pluginResult = nil; + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary: @{@"consoleLogEnabled": config[@"console_logs_enabled"]}]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + +} + - (void)generateDistributedTracingHeaders:(CDVInvokedUrlCommand *)command { CDVPluginResult* pluginResult = nil; diff --git a/www/js/newrelic.js b/www/js/newrelic.js index 09ea825..c5b6029 100644 --- a/www/js/newrelic.js +++ b/www/js/newrelic.js @@ -131,6 +131,10 @@ * @param args An array of arguments that are passed to the console log. */ sendConsole(type, args) { + + NewRelic.getConsoleLogFeatureFlag().then((flag) => { + + if(flag.consoleLogEnabled === 'true') { const argsStr = JSON.stringify(args, getCircularReplacer()); switch (type) { @@ -149,7 +153,8 @@ case 'assert': this.logVerbose(`[CONSOLE][ASSERT]${argsStr}`); break; - } + }} + }); }, send(name, args) { @@ -362,6 +367,13 @@ }); }, + getConsoleLogFeatureFlag: function (cb, fail) { + + return new Promise(function (cb, fail) { + cordova.exec(cb, fail, "NewRelicCordovaPlugin", "getConsoleLogFeatureFlag"); + }); + }, + generateDistributedTracingHeaders: function (cb, fail) { return new Promise(function (cb, fail) { @@ -504,8 +516,6 @@ if (this.readyState === this.HEADERS_RECEIVED) { const contentTypeString = this.getResponseHeader('Content-Type'); - - if (this.getAllResponseHeaders()) { const responseHeaders = this.getAllResponseHeaders().split('\r\n'); const responseHeadersDictionary = {}; @@ -582,7 +592,6 @@ var options = arguments[1]; return NewRelic.getHTTPHeadersTrackingFor().then((trackingHeadersList)=>{ - console.log(trackingHeadersList); return NewRelic.generateDistributedTracingHeaders().then((headers) => { console.log(headers); networkRequest.startTime = Date.now();