New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

appmetrics

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appmetrics - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

probes/oracledb-probe.js

2

download_all_binaries.js

@@ -44,3 +44,3 @@ /*******************************************************************************

var AGENTCORE_VERSION = "3.0.6";
var APPMETRICS_VERSION = "1.0.5";
var APPMETRICS_VERSION = "1.0.6";

@@ -47,0 +47,0 @@ var LOG_FILE = path.join(INSTALL_DIR, 'install.log');

@@ -102,3 +102,3 @@ /*******************************************************************************

aspect.after(module.__proto__, 'require', data, function(obj, methodName, args, context, ret) {
if (ret.__ddProbeAttached__) {
if (ret == null || ret.__ddProbeAttached__) {
return ret;

@@ -105,0 +105,0 @@ } else {

@@ -41,10 +41,12 @@ /*******************************************************************************

if (typeof(newConfig[prop]) !== 'undefined') {
config[prop] = newConfig[prop];
this.config[prop] = newConfig[prop];
}
}
config.filters.forEach(function(filter) {
if (typeof(filter.regex) === 'undefined') {
filter.regex = new RegExp(filter.pattern);
}
});
if (this.config.filters) {
this.config.filters.forEach(function(filter) {
if (typeof(filter.regex) === 'undefined') {
filter.regex = new RegExp(filter.pattern);
}
});
}
};

@@ -51,0 +53,0 @@

{
"name": "appmetrics",
"version": "1.0.5",
"version": "1.0.6",
"description": "Node Application Metrics",

@@ -5,0 +5,0 @@ "bin": { "node-hc": "bin/appmetrics-cli.js" },

@@ -22,7 +22,7 @@ /*******************************************************************************

function TraceProbe() {
Probe.call(this, 'trace');
this.config = {
includeModules: [],
excludeModules: []
};
Probe.call(this, 'trace');
this.config = {
includeModules: [],
excludeModules: []
};
}

@@ -33,10 +33,9 @@ util.inherits(TraceProbe, Probe);

if( moduleName.slice(0,1) != "." || stopList[moduleName] || !isAppInnerRequire() ||
this.config.excludeModules.indexOf(moduleName) != -1 ) {
return target;
this.config.excludeModules.indexOf(moduleName) != -1 ) {
return target;
}
if(target.__ddProbeAttached__) {
return target;
return target;
}
var ret = target;

@@ -48,9 +47,9 @@ if (typeof(target) != "function") {

ret = target;
if(Object.keys(target.prototype).length==0 && Object.keys(target).length == 0){
ret = function () {
var rc = target.apply(this, arguments);
instrumentMethods(moduleName, rc);
return rc;
}
}
if(Object.keys(target.prototype).length==0 && Object.keys(target).length == 0){
ret = function () {
var rc = target.apply(this, arguments);
instrumentMethods(moduleName, rc);
return rc;
}
}
}

@@ -65,10 +64,49 @@

function instrument( target, name, method, fullName ) {
var methodString = ''+method;
var methodargs = methodString.toString().split(')')[0].split('(')[1].split(',');
var lastMethodArg = methodargs[methodargs.length-1].replace(/ /g,'');
if(lastMethodArg == '') lastMethodArg = 'undefined';
var methodString = ''+method;
var methodargs = methodString.toString().split(')')[0].split('(')[1].split(',');
var lastMethodArg = methodargs[methodargs.length-1].replace(/ /g,'');
if(lastMethodArg == '') lastMethodArg = 'undefined';
function generateF(expectedArgCount, fn) {
switch (expectedArgCount) {
case 0: return function() {return fn.apply(this,arguments);};
case 1: return function(a) {return fn.apply(this,arguments);};
case 2: return function(a,b) {return fn.apply(this,arguments);};
case 3: return function(a,b,c) {return fn.apply(this, arguments);};
case 4: return function(a,b,c,d) {return fn.apply(this, arguments);};
case 5: return function(a,b,c,d,e) {return fn.apply(this, arguments);};
case 6: return function(a,b,c,d,e,f) {return fn.apply(this, arguments);};
case 7: return function(a,b,c,d,e,f,g) {return fn.apply(this, arguments);};
case 8: return function(a,b,c,d,e,f,g,h) {return fn.apply(this, arguments);};
case 9: return function(a,b,c,d,e,f,g,h,i) {return fn.apply(this, arguments);};
//Slow case for functions with > 10 args
default:
var ident = 'a';
var argumentList = [];
for (var i=0; i<expectedArgCount; i++) {
argumentList[i] = ident;
ident = incrementIdentifier(ident);
}
result = eval('x = function(' + (argumentList.join(',')) + ') {return fn.apply(this,arguments);};');
return result;
}
function incrementIdentifier(identifier) {
var charArr = identifier.split("");
var lastChar = charArr[charArr.length - 1];
if (lastChar == "z") {
return identifier + "a";
} else {
var chopped = identifier.substring(0, identifier.length - 1);
return chopped + String.fromCharCode(lastChar.charCodeAt(0) + 1);
}
}
}
var f = function() {
var instrumentedMethodKNJ = true;
var req = request.startMethod( fullName );
var req = request.startMethod(fullName);
var args = arguments;
var cxtFunc = function() {

@@ -96,12 +134,12 @@ var cxt = {};

/*
* if( arguments.length > 0 && typeof(arguments[arguments.length-1]) ==
* "function" && Object.keys(arguments[arguments.length-1]).length == 0) {
* console.log('Type is ' +
* typeof(arguments[arguments.length-1].prototype)); if
* (typeof(arguments[arguments.length-1].prototype) === 'object') {
* console.log('Checking object');
* console.log(Object.keys(arguments[arguments.length-1].prototype)); }
* else { console.log('Not object'); }
* }
*/
* if( arguments.length > 0 && typeof(arguments[arguments.length-1]) ==
* "function" && Object.keys(arguments[arguments.length-1]).length == 0) {
* console.log('Type is ' +
* typeof(arguments[arguments.length-1].prototype)); if
* (typeof(arguments[arguments.length-1].prototype) === 'object') {
* console.log('Checking object');
* console.log(Object.keys(arguments[arguments.length-1].prototype)); }
* else { console.log('Not object'); }
* }
*/
if (arguments.length > 0

@@ -120,3 +158,2 @@ && typeof (arguments[arguments.length - 1]) == "function"

var resArg = arguments[arguments.length - 2];
var sendCb = resArg.send;

@@ -129,14 +166,16 @@ resArg.send = function() {

var renderCb = resArg.render;
resArg.render = function() {
req.stop(cxtFunc());
return renderCb.apply(resArg, arguments);
};
} else {
var cb = arguments[arguments.length - 1];
arguments[arguments.length - 1] = function() {
req.stop(cxtFunc());
return cb.apply(this, arguments);
};
}
resArg.render = function() {
req.stop(cxtFunc());
return renderCb.apply(resArg, arguments);
};
} else {
var cb = arguments[arguments.length - 1];
arguments[arguments.length - 1] = function() {
req.stop(cxtFunc());
return cb.apply(this, arguments);
};
}
}
//Call this method using the apply function
var res = method.apply(this, arguments);

@@ -148,3 +187,5 @@ if( !isCallback ) {

};
target[name] = f;
//use a function replace to call our 'f' function.
//we ned to use 'generateF' to call f with the correct number of arguments
target[name] = generateF(method.length, f);
target[name].prototype = method.prototype;

@@ -167,3 +208,3 @@ }

var fullName = moduleName + "." + name;
// logger.debug( "instrumenting method", fullName );
// logger.debug( "instrumenting method", fullName );
instrument( target, name, method, fullName );

@@ -173,7 +214,7 @@

for (var item in p) {
if (typeof(p[item]) == "function" &&
Object.keys(p[item]).length==0 &&
Object.keys(p[item].prototype).length==0) {
var itemName = fullName + "." + item;
instrument(p, item, p[item], itemName);
if ((typeof(p[item]) == "function") &&
(Object.keys(p[item]).length == 0) &&
(Object.keys(p[item].prototype).length == 0)) {
var itemName = fullName + "." + item;
instrument(p, item, p[item], itemName);
}

@@ -192,8 +233,10 @@ }

function instrumentMethods(moduleName, target) {
for( var name in target ) {
if( !target.__lookupGetter__(name) && typeof(target[name]) == "function" ) {
if(!target[name].__super__ &&
( !target[name].prototype ||
( target[name].prototype && Object.keys(target[name].prototype).length==0 ) ) && Object.keys(target[name]).length==0){
traceMethod(moduleName, target,name);
for (var name in target ) {
if (!target.__lookupGetter__(name) && typeof(target[name]) == "function" ) {
if (!target[name].__super__ &&
(target[name].prototype ||
(target[name].prototype && Object.keys(target[name].prototype).length == 0))
&& Object.keys(target[name]).length == 0) {
traceMethod(moduleName, target,name);
}

@@ -200,0 +243,0 @@ }

@@ -28,2 +28,3 @@ # Node Application Metrics

Memcached | Data that stored or manupulated in Memcached
OracleDB | OracleDB queries made by the application
Redis | Redis commands issued by the application

@@ -167,3 +168,3 @@ Request tracking | A tree of application requests, events and optionally trace (disabled by default)

Enable data generation of the specified data type.
* `type` (String) the type of event to start generating data for. Values of `eventloop`, `profiling`, `http`, `mongo`, `socketio`, `mqlight`, `postgresql`, `mqtt`, `mysql`, `redis`, `memcached`, `requests` and `trace` are currently supported. As `trace` is added to request data, both `requests` and `trace` must be enabled in order to receive trace data.
* `type` (String) the type of event to start generating data for. Values of `eventloop`, `profiling`, `http`, `mongo`, `socketio`, `mqlight`, `postgresql`, `mqtt`, `mysql`, `redis`, `memcached`, `oracledb`, `requests` and `trace` are currently supported. As `trace` is added to request data, both `requests` and `trace` must be enabled in order to receive trace data.
* `config` (Object) (optional) configuration map to be added for the data type being enabled. (see *[setConfig](#set-config)*) for more information.

@@ -175,3 +176,3 @@

Disable data generation of the specified data type.
* `type` (String) the type of event to stop generating data for. Values of `eventloop`, `profiling`, `http`, `mongo`, `socketio`, `mqlight`, `postgresql`, `mqtt`, `mysql`, `redis`, `memcached`, `requests` and `trace` are currently supported.
* `type` (String) the type of event to stop generating data for. Values of `eventloop`, `profiling`, `http`, `mongo`, `socketio`, `mqlight`, `postgresql`, `mqtt`, `mysql`, `redis`, `memcached`, `oracledb`, `requests` and `trace` are currently supported.

@@ -325,2 +326,9 @@ <a name="set-config"></a>

### Event: 'oracledb'
Emitted when a query is executed using the `oracledb` module.
* `data` (Object) the data from the OracleDB query:
* `time` (Number) the milliseconds when the OracleDB query was made. This can be converted to a Date using `new Date(data.time)`.
* `query` (String) the query made of the OracleDB database.
* `duration` (Number) the time taken for the OracleDB query to be responded to in ms.
### Event: 'request'

@@ -400,5 +408,6 @@ Emitted when a request is made of the application that involves one or more monitored application level events. Request events are disabled by default.

## Version
1.0.5
1.0.6
## Release History
`1.0.6` - OracleDB support and bug fixes.
`1.0.5` - Expose HTTP events to connectors (including MQTT).

@@ -405,0 +414,0 @@ `1.0.4` - Redis, Leveldown, Postgresql, Memcached, MQLight and MQTT support, higher precision timings, and improved performance.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc