Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oneapm

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oneapm - npm Package Compare versions

Comparing version 1.2.11 to 1.2.12-0

lib/db/tracer.js

44

lib/agent.js

@@ -12,2 +12,3 @@ 'use strict';

, ErrorTracer = require(path.join(__dirname, 'error.js'))
, QueryTracer = require(path.join(__dirname, 'db', 'tracer.js'))
, Metrics = require(path.join(__dirname, 'metrics.js'))

@@ -83,2 +84,5 @@ , MetricNormalizer = require(path.join(__dirname, 'metrics', 'normalizer.js'))

// query tracing
this.queries = new QueryTracer(this.config);
// metrics

@@ -309,3 +313,8 @@ this.mapper = new MetricMapper();

agent._sendEvents(callback);
agent._sendEvents( function cb_sendEvents(error) {
if (error) return callback(error);
agent._sendQueries(callback);
});
});

@@ -606,2 +615,35 @@ });

Agent.prototype._sendQueries = function _sendQueries(callback) {
var agent = this
var queries = this.queries
this.queries = new QueryTracer(agent.config)
if (! (this.config.slow_sql && this.config.slow_sql.enabled) ) {
logger.debug('Slow Query is not enabled.')
return process.nextTick(callback)
}
if (Object.keys(queries.samples).length < 1) {
logger.debug('No queries to send.')
return process.nextTick(callback)
}
queries.prepareJSON(function gotJSON(err, data) {
if (err) {
this.queries.merge(queries)
logger.debug('Error while serializing query data: %s', err.message)
return callback(err)
}
agent.collector.queryData([data], function handleResponse(error) {
if (error) agent.queries.merge(queries)
callback(error)
})
})
}
Agent.prototype._sendEvents = function _sendEvents (callback) {

@@ -608,0 +650,0 @@ if (this.config.transaction_events.enabled) {

@@ -69,2 +69,3 @@ 'use strict';

sqls : new RemoteMethod('sql_trace_data', agent.config),
queryData : new RemoteMethod('sql_trace_data', agent.config),
shutdown : new RemoteMethod('shutdown', agent.config),

@@ -289,2 +290,10 @@ events : new RemoteMethod('analytic_event_data', agent.config),

CollectorAPI.prototype.queryData = function customEvents(queries, callback) {
if (!queries) throw new TypeError("must pass queries to send")
if (!callback) throw new TypeError("callback is required")
this._runLifecycle(this._methods.queryData, queries, callback)
}
/**

@@ -291,0 +300,0 @@ * get commands to run

10

lib/config.default.js

@@ -231,3 +231,5 @@ /**

*/
top_n : 20
top_n : 20,
record_sql: 'off',
explain_threshold : 500
},

@@ -382,3 +384,7 @@ /**

*/
high_security : false
high_security : false,
slow_sql : {
enabled : false,
max_samples : 10
}
};

@@ -7,6 +7,21 @@ 'use strict';

function ParsedStatement(type, operation, model) {
/**
*
* @param type
* @param operation
* @param model
* @param raw : The raw sql string, like 'SELECT * FROM ....'
*/
function ParsedStatement(type, operation, model, raw) {
this.type = type;
this.operation = operation;
this.model = model;
this.trace = null;
this.raw = '';
if( typeof raw === 'string' ) {
this.trace = new Error();
this.raw = raw;
}
}

@@ -44,4 +59,8 @@

}
if( this.raw ) { // If the ParsedStatment contains a raw SQL statement, add it to the agent's QueryTracer
transaction.agent.queries.addQuery( segment, this.type.toLowerCase(), this.raw, this.trace );
}
};
module.exports = ParsedStatement;

@@ -20,3 +20,3 @@ 'use strict';

return new ParsedStatement(type, this.operation, model);
return new ParsedStatement(type, this.operation, model, sql);
}

@@ -23,0 +23,0 @@ };

@@ -71,2 +71,3 @@ 'use strict';

tracer.getTransaction().addRecorder( ps.recordMetrics.bind( ps, segment ) );
// capture connection info for datastore instance metric

@@ -145,2 +146,3 @@ if (this.config) {

tracer.getTransaction().addRecorder( ps.recordMetrics.bind( ps, segment ) );
// capture connection info for datastore instance metric

@@ -147,0 +149,0 @@ segment.port = this.port;

@@ -38,2 +38,4 @@ 'use strict';

this._recorders = [];
// hidden class optimization

@@ -176,2 +178,35 @@ this.url = null;

/**
* The instrumentation associates metrics with the different kinds of trace
* segments. The metrics recorders are dependent on the transaction name to
* collect their scoped metrics, and so must wait for the transaction's
* name to be finalized before the recording process. Segments are only
* responsible for their own life cycle, so responsibility for understanding
* when the transaction name has been finalized is handed off to the trace,
* which for now defers running these recorders until the trace is ended.
*
* @param {Function} recorder The callback which records metrics. Takes a
* single parameter, which is the transaction's
* name.
*/
Transaction.prototype.addRecorder = function addRecorder(recorder) {
this._recorders.push(recorder)
}
/**
* Run the metrics recorders for this trace. If the transaction's name /
* scope hasn't been set yet, the recorder will be passed an undefined name,
* and should be written to handle this.
*/
Transaction.prototype.record = function record() {
var name = this.name
for (var i = 0, l = this._recorders.length; i < l; ++i) {
this._recorders[i](name)
}
}
module.exports = Transaction;
{
"name": "oneapm",
"version": "1.2.11",
"version": "1.2.12-0",
"author": "OneAPM Node.js agent team <nodejs@oneapm.com>",

@@ -5,0 +5,0 @@ "description": "OneAPM agent",

# OneAPM Agent for Node.js
[![Build Status](https://travis-ci.org/oneapm/agent-demo-nodejs.svg?branch=master)](https://travis-ci.org/oneapm/agent-demo-nodejs)
![](https://img.shields.io/npm/v/oneapm.svg?style=flat-square)
[![](https://npm.taobao.org/badge/v/oneapm.svg)](http://npm.taobao.org/package/oneapm)
[![](https://img.shields.io/travis/oneapm/agent-demo-nodejs.svg?style=flat-square)](https://travis-ci.org/oneapm/agent-demo-nodejs)

@@ -44,2 +46,11 @@ ## 安装

### v1.2.12 (2015-11-03)
* 添加数据库追踪中的慢 SQL 追踪
* 慢事务详情页面展示抓取到 SQL 语句
### v1.2.11 (2015-10-26)
* 缩小了安装包的大小
### v1.2.10 (2015-10-26)

@@ -46,0 +57,0 @@

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