Comparing version 3.0.5 to 3.1.0
@@ -406,2 +406,7 @@ 'use strict'; | ||
API.prototype.addSegment = function addSegment(name) { | ||
var tracer = this.agent.tracer; | ||
return tracer.addSegment(name, genericRecorder); | ||
} | ||
module.exports = API; |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var path = require('path'); | ||
global._oneapm_lib_path_ = path.join(__dirname, 'lib'); | ||
global._oneapm_logger_path_ = path.join(__dirname, 'lib', 'logger'); | ||
@@ -58,2 +59,3 @@ var logger = require(_oneapm_logger_path_); | ||
var config = require(path.join(__dirname, 'lib', 'config', 'config')).initialize(); | ||
global._oneapm_protocol_path_ = path.join(__dirname, 'lib', 'protocol', config.protocol_version.toString()); | ||
@@ -60,0 +62,0 @@ if (!config.agent_enabled) { |
@@ -19,2 +19,3 @@ 'use strict'; | ||
var urltils = require(path.join(__dirname, 'util', 'urltils')); | ||
var s_harvest = require(path.join(_oneapm_protocol_path_, 'agent_harvest')); | ||
@@ -318,35 +319,3 @@ /* | ||
if (!callback) throw new TypeError("callback required!"); | ||
var agent = this; | ||
// not necessary to make sure of it again and again | ||
if (this.collector.isConnected()) { | ||
agent._sendMetrics(function cb__sendMetrics(error) { | ||
if (error) return callback(error); | ||
agent._sendTopo(function cb__sendTopo(error) { | ||
if (error) return callback(error); | ||
agent._sendErrors(function cb__sendErrors(error) { | ||
if (error) return callback(error); | ||
agent._sendTrace(function cb__sendTrace(error) { | ||
if (error) return callback(error); | ||
agent._sendEvents(function cb_sendEvents(error) { | ||
if (error) return callback(error); | ||
agent._sendQueries(callback); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} | ||
else { | ||
process.nextTick(function cb_nextTick() { | ||
callback(new Error("Not connected to OneAPM!")); | ||
}); | ||
} | ||
s_harvest(this, callback); | ||
}; | ||
@@ -353,0 +322,0 @@ |
@@ -223,3 +223,3 @@ 'use strict'; | ||
// always inject API-VERSION header | ||
requestOptions.headers['API-VERSION'] = '1.1' | ||
requestOptions.headers['API-VERSION'] = this._config.api_version; | ||
@@ -226,0 +226,0 @@ var request; |
@@ -7,2 +7,6 @@ /** | ||
exports.config = { | ||
// api version for oneapm server needed. | ||
api_version: '1.0', | ||
// server version | ||
protocol_version: 410, | ||
/** | ||
@@ -33,3 +37,3 @@ * Application name. | ||
*/ | ||
host: 'apmdc.oneapm.com', | ||
host: 'appcollector.oneapm.com', | ||
/** | ||
@@ -36,0 +40,0 @@ * The port on which the collector proxy will be listening. |
@@ -318,35 +318,10 @@ 'use strict'; | ||
break; | ||
case 'transaction_tracer.enabled': | ||
this._updateNestedIfChanged( | ||
params, | ||
this.transaction_tracer, | ||
'transaction_tracer.enabled', | ||
'enabled' | ||
); | ||
case 'transaction_tracer': | ||
this._updateNested(params, key, ['enabled', 'transaction_threshold', 'record_sql']); | ||
break; | ||
case 'transaction_tracer.transaction_threshold': | ||
this._updateNestedIfChanged( | ||
params, | ||
this.transaction_tracer, | ||
'transaction_tracer.transaction_threshold', | ||
'transaction_threshold' | ||
); | ||
case 'error_collector': | ||
this._updateNested(params, key, ['enabled', 'ignore_status_codes']); | ||
break; | ||
case 'error_collector.enabled': | ||
this._updateNestedIfChanged( | ||
params, | ||
this.error_collector, | ||
'error_collector.enabled', | ||
'enabled' | ||
); | ||
break; | ||
case 'error_collector.ignore_status_codes': | ||
this._updateNestedIfChanged( | ||
params, | ||
this.error_collector, | ||
'error_collector.ignore_status_codes', | ||
'ignore_status_codes' | ||
); | ||
this._canonicalize(); | ||
break; | ||
@@ -360,29 +335,6 @@ case 'collect_analytics_events': | ||
case 'transaction_events.max_samples_stored': | ||
this._updateNestedIfChanged( | ||
params, | ||
this.transaction_events, | ||
key, | ||
'max_samples_stored' | ||
); | ||
case 'transaction_events': | ||
this._updateNested(params, key, ['enabled', 'max_samples_stored', 'max_samples_per_minute']); | ||
break; | ||
case 'transaction_events.max_samples_per_minute': | ||
this._updateNestedIfChanged( | ||
params, | ||
this.transaction_events, | ||
key, | ||
'max_samples_per_minute' | ||
); | ||
break; | ||
case 'transaction_events.enabled': | ||
this._updateNestedIfChanged( | ||
params, | ||
this.transaction_events, | ||
key, | ||
'enabled' | ||
); | ||
break; | ||
// these are used by browser_monitoring | ||
@@ -404,12 +356,6 @@ // and the api.getRUMHeader() method | ||
case 'browser_monitoring.loader': | ||
this._updateNestedIfChangedRaw( | ||
params, | ||
this.browser_monitoring, | ||
key, | ||
'loader' | ||
); | ||
case 'browser_monitoring': | ||
this._updateNested(params, key, ['loader']); | ||
break; | ||
case 'transaction_tracer.record_sql': | ||
case 'record_sql': | ||
@@ -441,2 +387,16 @@ this._updateNestedIfChanged( | ||
Config.prototype._updateNested = function _updateNested(params, key, subKeys) { | ||
var self = this; | ||
var item = params[key]; | ||
Object.keys(item).forEach(function cb_forEach(sk) { | ||
if(subKeys.some(function cb_some(x) { return x == sk; })) { | ||
self._updateNestedIfChanged(item, self[key], sk, sk); | ||
} else { | ||
logger.debug( | ||
"OneAPM sent unknown configuration parameter %s.%s with value %j.", | ||
key, sk, item[sk]); | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -443,0 +403,0 @@ * Change a value sent by the collector if and only if it's different from the |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var DB = require(path.join(__dirname, '..', 'metrics', 'names')).DB; | ||
var generateGuid = require('../util/generate-guid.js'); | ||
var sqlRecord = require(path.join(_oneapm_protocol_path_, 'sql_record')); | ||
@@ -38,29 +38,5 @@ /** | ||
ParsedStatement.prototype.recordMetrics = function recordMetrics(segment, scope) { | ||
var duration = segment.getDurationInMillis(); | ||
var exclusive = segment.getExclusiveDurationInMillis(); | ||
var transaction = segment.trace.transaction; | ||
var agent = transaction.agent; | ||
var dbName = this.type + ':' + this.host + ':' + this.port; | ||
var name = DB.STATEMENT + '/' + dbName; | ||
var all = name + '/all'; | ||
if(scope) { | ||
transaction.measure(name, scope, duration, exclusive); | ||
agent.addEventFromTransaction( | ||
transaction, | ||
generateGuid(), | ||
transaction.guid, | ||
[-1, 'Database/statement/' + dbName, scope], | ||
duration / 1000, | ||
duration / 1000 | ||
); | ||
} | ||
transaction.measure(all, null, duration, exclusive); | ||
transaction.topo.measureMilliseconds('TopoDatabase/' + dbName, null, duration, exclusive); | ||
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 ); | ||
} | ||
sqlRecord(this, segment, scope); | ||
}; | ||
module.exports = ParsedStatement; |
@@ -14,2 +14,3 @@ 'use strict'; | ||
var urltils = require('../../util/urltils.js') | ||
var httpTopo = require(path.join(_oneapm_protocol_path_, 'http_topo')); | ||
@@ -121,9 +122,3 @@ /* | ||
function instrumentedFinish() { | ||
var duration = transaction.timer.getDurationInMillis(); | ||
if (ae_id && ae_transaction) { | ||
transaction.topo.measureMilliseconds(internalName, null, duration, duration); | ||
} | ||
if (transaction.hasEndUser) { | ||
transaction.topo.measureMilliseconds(userName, null, duration, duration); | ||
} | ||
httpTopo.measureTopoInternal(transaction, internalName, userName, ae_id, ae_transaction); | ||
/* Stats how many bytes sended and received | ||
@@ -196,14 +191,4 @@ */ | ||
var exName = 'TopoExternal/' + agent.config.application_id + '/HTTP:' + host + ':' + port; | ||
transaction.topo.measureMilliseconds(exName, null, dura, dura); | ||
if(args && args.headers && args.headers[AE_RES_HEADER_APP_DATA]) { | ||
//INFO: whatever | ||
} else { | ||
var n; | ||
if(transaction.partialName) { | ||
n = 'WebTransaction/' + transaction.partialName; | ||
} | ||
var scope = transaction.name || n; | ||
if(scope) transaction.measure(name, scope, dura, dura); | ||
transaction.measure(name + "/all", null, dura, dura); | ||
} | ||
var headerHasAppData = args && args.headers && args.headers[AE_RES_HEADER_APP_DATA]; | ||
httpTopo.measureTopoCallback(transaction, name, exName, dura, headerHasAppData); | ||
if (callback && typeof callback === 'function') { | ||
@@ -210,0 +195,0 @@ callback.apply(this, arguments); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
'use strict'; | ||
var generateGuid = require('../../util/generate-guid.js') | ||
var nosqlRecord = require(path.join(_oneapm_protocol_path_, 'nosql_record')); | ||
function init(type, host, port) { | ||
return function recordMemcache(segment, scope) { | ||
var duration = segment.getDurationInMillis(); | ||
var exclusive = segment.getExclusiveDurationInMillis(); | ||
var transaction = segment.trace.transaction; | ||
var agent = transaction.agent; | ||
var topo = transaction.topo; | ||
var dbName = type + ':' + host + ':' + port; | ||
var all = segment.name + '/all'; | ||
transaction.measure(all, null, duration, exclusive); | ||
transaction.measure('Datastore/' + type + '/allWeb', null, duration, exclusive); | ||
transaction.topo.measureMilliseconds('TopoDatastore/' + dbName, null, duration, exclusive); | ||
if(scope) { | ||
transaction.measure(segment.name, scope, duration, exclusive); | ||
agent.addEventFromTransaction( | ||
transaction, | ||
generateGuid(), | ||
transaction.guid, | ||
[-1, 'Datastore/operation/' + dbName, scope], | ||
duration / 1000, | ||
duration / 1000 | ||
); | ||
} | ||
}; | ||
} | ||
module.exports = init; | ||
module.exports = nosqlRecord; |
{ | ||
"name": "oneapm", | ||
"version": "3.0.5", | ||
"version": "3.1.0", | ||
"author": "OneAPM Node.js agent team <nodejs@oneapm.com>", | ||
@@ -5,0 +5,0 @@ "description": "OneAPM agent", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
424116
35
88
10362
114