GWicke has uploaded a new change for review. https://gerrit.wikimedia.org/r/177703
Change subject: Update to latest master ...................................................................... Update to latest master Change-Id: I61fc32637b2d1997097d66295a3f4fb3fe159918 --- M node_modules/extend/package.json M node_modules/gelf-stream/package.json M node_modules/js-yaml/package.json M node_modules/mocha/node_modules/debug/node_modules/ms/package.json M node_modules/mocha/node_modules/mkdirp/package.json M node_modules/mocha/package.json M node_modules/node-txstatsd/index.js M node_modules/node-txstatsd/package.json M node_modules/preq/package.json M node_modules/request/node_modules/aws-sign2/package.json M node_modules/request/node_modules/forever-agent/package.json M node_modules/request/node_modules/stringstream/package.json M node_modules/restbase-cassandra/node_modules/async/package.json M node_modules/routeswitch/package.json M node_modules/yargs/package.json 15 files changed, 102 insertions(+), 115 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/restbase/deploy refs/changes/03/177703/1 diff --git a/node_modules/extend/package.json b/node_modules/extend/package.json index e798f3e..af0f4c9 100644 --- a/node_modules/extend/package.json +++ b/node_modules/extend/package.json @@ -40,7 +40,7 @@ "homepage": "https://github.com/justmoon/node-extend", "_id": "[email protected]", "_shasum": "d1516fb0ff5624d2ebf9123ea1dac5a1994004f8", - "_from": "extend@^1.3.0", + "_from": "extend@~1.3.0", "_npmVersion": "1.4.14", "_npmUser": { "name": "ljharb", diff --git a/node_modules/gelf-stream/package.json b/node_modules/gelf-stream/package.json index 1058c36..63b481d 100644 --- a/node_modules/gelf-stream/package.json +++ b/node_modules/gelf-stream/package.json @@ -36,7 +36,7 @@ "homepage": "https://github.com/mhart/gelf-stream", "_id": "[email protected]", "_shasum": "a418c8c2e39b85b7932a3e8523f6022d6852e013", - "_from": "gelf-stream@^0.2.4", + "_from": "gelf-stream@~0.2.4", "_npmVersion": "1.4.10", "_npmUser": { "name": "hichaelmart", diff --git a/node_modules/js-yaml/package.json b/node_modules/js-yaml/package.json index 1b938b8..43c4b9c 100644 --- a/node_modules/js-yaml/package.json +++ b/node_modules/js-yaml/package.json @@ -61,7 +61,7 @@ "_id": "[email protected]", "scripts": {}, "_shasum": "a3af632d13df5bfa95f3b8f3c4b61efe212cd750", - "_from": "js-yaml@^3.2.2", + "_from": "js-yaml@~3.2.2", "_npmVersion": "1.4.28", "_npmUser": { "name": "vitaly", diff --git a/node_modules/mocha/node_modules/debug/node_modules/ms/package.json b/node_modules/mocha/node_modules/debug/node_modules/ms/package.json index 87ad70d..48de118 100644 --- a/node_modules/mocha/node_modules/debug/node_modules/ms/package.json +++ b/node_modules/mocha/node_modules/debug/node_modules/ms/package.json @@ -40,5 +40,6 @@ "directories": {}, "_shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c", "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz", - "readme": "ERROR: No README data found!" + "readme": "ERROR: No README data found!", + "scripts": {} } diff --git a/node_modules/mocha/node_modules/mkdirp/package.json b/node_modules/mocha/node_modules/mkdirp/package.json index a915c51..a6de8f3 100644 --- a/node_modules/mocha/node_modules/mkdirp/package.json +++ b/node_modules/mocha/node_modules/mkdirp/package.json @@ -39,7 +39,7 @@ "shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12", "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz" }, - "_from": "[email protected]", + "_from": "mkdirp@~0.5.0", "_npmVersion": "1.4.3", "_npmUser": { "name": "substack", diff --git a/node_modules/mocha/package.json b/node_modules/mocha/package.json index b00149b..72475fd 100644 --- a/node_modules/mocha/package.json +++ b/node_modules/mocha/package.json @@ -94,7 +94,7 @@ "homepage": "https://github.com/visionmedia/mocha", "_id": "[email protected]", "_shasum": "7c58b09174df976e434a23b1e8d639873fc529e9", - "_from": "mocha@^1.x.x", + "_from": "mocha@~1.x.x", "_npmVersion": "1.4.9", "_npmUser": { "name": "travisjeffery", diff --git a/node_modules/node-txstatsd/index.js b/node_modules/node-txstatsd/index.js index 294f918..07673d8 100644 --- a/node_modules/node-txstatsd/index.js +++ b/node_modules/node-txstatsd/index.js @@ -31,7 +31,7 @@ */ var dgram = require('dgram'), - dns = require('dns'); + dns = require('dns'); /** * The UDP Client for StatsD @@ -47,42 +47,43 @@ * @constructor */ var Client = function (host, port, prefix, suffix, txstatsd, globalize, cacheDns, mock) { - var options = host || {}, - self = this; + var options = host || {}, + self = this; - if(arguments.length > 1 || typeof(host) === 'string'){ - options = { - host : host, - port : port, - prefix : prefix, - suffix : suffix, - txstatsd : txstatsd, - globalize : globalize, - cacheDns : cacheDns, - mock : mock === true - }; - } + if(arguments.length > 1 || typeof(host) === 'string'){ + options = { + host : host, + port : port, + prefix : prefix, + suffix : suffix, + txstatsd : txstatsd, + globalize : globalize, + cacheDns : cacheDns, + mock : mock === true + }; + } - this.host = options.host || 'localhost'; - this.port = options.port || 8125; - this.prefix = options.prefix || ''; - this.suffix = options.suffix || ''; - this.txstatsd = options.txstatsd || false; - this.socket = dgram.createSocket('udp4'); - this.mock = options.mock; + this.host = options.host || 'localhost'; + this.port = options.port || 8125; + this.prefix = options.prefix || ''; + this.suffix = options.suffix || ''; + // Default to true + this.txstatsd = options.txstatsd !== undefined ? options.txstatsd : true; + this.socket = dgram.createSocket('udp4'); + this.mock = options.mock; - if(options.cacheDns === true){ - dns.lookup(options.host, function(err, address, family){ - if(err === null){ - self.host = address; - } - }); - } + if(options.cacheDns === true){ + dns.lookup(options.host, function(err, address, family){ + if(err === null){ + self.host = address; + } + }); + } - if(options.globalize){ - global.statsd = this; - } + if(options.globalize){ + global.statsd = this; + } }; /** @@ -93,7 +94,7 @@ * @param callback {Function} Callback when message is done being delivered. Optional. */ Client.prototype.timing = function (stat, time, sampleRate, callback) { - this.sendAll(stat, time, 'ms', sampleRate, callback); + this.sendAll(stat, time, 'ms', sampleRate, callback); }; /** @@ -104,8 +105,8 @@ * @param callback {Function} Callback when message is done being delivered. Optional. */ Client.prototype.increment = function (stat, value, sampleRate, callback) { - var type = this.txstatsd ? 'm' : 'c'; - this.sendAll(stat, value || 1, type, sampleRate, callback); + var type = this.txstatsd ? 'm' : 'c'; + this.sendAll(stat, value || 1, type, sampleRate, callback); }; /** @@ -116,7 +117,7 @@ * @param callback {Function} Callback when message is done being delivered. Optional. */ Client.prototype.gauge = function (stat, value, sampleRate, callback) { - this.sendAll(stat, value, 'g', sampleRate, callback); + this.sendAll(stat, value, 'g', sampleRate, callback); }; /** @@ -127,9 +128,10 @@ * @param callback {Function} Callback when message is done being delivered. Optional. */ Client.prototype.unique = - Client.prototype.set = function (stat, value, sampleRate, callback) { - this.sendAll(stat, value, 's', sampleRate, callback); - }; + Client.prototype.set = function (stat, value, sampleRate, callback) { + var type = this.txstatsd ? 'pd' : 's'; + this.sendAll(stat, value, type, sampleRate, callback); + }; /** * Checks if stats is an array and sends all stats calling back once all have sent @@ -138,73 +140,54 @@ * @param sampleRate {Number} The Number of times to sample (0 to 1) * @param callback {Function} Callback when message is done being delivered. Optional. */ -Client.prototype.sendAll = function(stat, value, type, sampleRate, callback){ - var completed = 0, - calledback = false, - sentBytes = 0, - self = this; +Client.prototype.sendAll = function(stats, value, type, sampleRate, callback){ + var self = this; - /** - * Gets called once for each callback, when all callbacks return we will - * call back from the function - * @private - */ - function onSend(error, bytes){ - completed += 1; - if(calledback || typeof callback !== 'function'){ - return; - } - - if(error){ - calledback = true; - return callback(error); - } - - sentBytes += bytes; - if(completed === stat.length){ - callback(null, sentBytes); - } - } - - if(Array.isArray(stat)){ - stat.forEach(function(item){ - self.send(item, value, type, sampleRate, onSend); - }); - } else { - this.send(stat, value, type, sampleRate, callback); - } + if (!Array.isArray(stats)) { + stats = [stats]; + } + var message = stats.filter(function(item) { + return item !== undefined; + }).map(function(item) { + return self.makeMessage(item, value, type, sampleRate); + }).join('\n'); + if (message) { + this._send(message, callback); + } }; /** * Sends a stat across the wire - * @param stat {String|Array} The stat(s) to send - * @param value The value to send - * @param type {String} The type of message to send to statsd - * @param sampleRate {Number} The Number of times to sample (0 to 1) + * @param stat {String|Array} The stat message to send * @param callback {Function} Callback when message is done being delivered. Optional. */ -Client.prototype.send = function (stat, value, type, sampleRate, callback) { - var message = this.prefix + stat + this.suffix + ':' + value + '|' + type, - buf; +Client.prototype._send = function (message, callback) { + // Only send this stat if we're not a mock Client. + if(!this.mock) { + var buf = new Buffer(message); + this.socket.send(buf, 0, buf.length, this.port, this.host, callback); + } else { + if(typeof callback === 'function'){ + callback(null, 0); + } + } +}; - if(sampleRate && sampleRate < 1){ - if(Math.random() < sampleRate){ - message += '|@' + sampleRate; - } else { - //don't want to send if we don't meet the sample ratio - return; - } - } +/** + * Build a stat message + */ +Client.prototype.makeMessage = function (stat, value, type, sampleRate) { + var message = this.prefix + stat + this.suffix + ':' + value + '|' + type, + buf; - // Only send this stat if we're not a mock Client. - if(!this.mock) { - buf = new Buffer(message); - this.socket.send(buf, 0, buf.length, this.port, this.host, callback); - } else { - if(typeof callback === 'function'){ - callback(null, 0); - } - } + if(sampleRate && sampleRate < 1){ + if(Math.random() < sampleRate){ + message += '|@' + sampleRate; + } else { + //don't want to send if we don't meet the sample ratio + return; + } + } }; module.exports = Client; diff --git a/node_modules/node-txstatsd/package.json b/node_modules/node-txstatsd/package.json index 0171bdf..fb5a8a9 100644 --- a/node_modules/node-txstatsd/package.json +++ b/node_modules/node-txstatsd/package.json @@ -1,6 +1,6 @@ { "name": "node-txstatsd", - "version": "0.1.1", + "version": "0.1.3", "description": "Modified version of https://github.com/sivy/node-statsd/ for WMF specific", "main": "index.js", "scripts": { @@ -25,8 +25,8 @@ }, "readme": "# node-txstatsd\n\nModified version of https://github.com/sivy/node-statsd/ for WMF specific\ntxstatsd constraints. We've removed increment/decrement and nullified the sets\nfunction if operating in txstatsd mode.\n\n", "readmeFilename": "README.md", - "gitHead": "5b52a4eab9fe26d25f346d23d050b6cf1d32e5e8", - "_id": "[email protected]", - "_shasum": "ed025ddcecb43cda2acfb9609a94f261f4f8dddf", - "_from": "node-txstatsd@^0.1.1" + "gitHead": "cbd4f6f91a87a5f50d399174e78106d5ced95149", + "_id": "[email protected]", + "_shasum": "fc592bbbd50bdcde81202c1a6713457f38181653", + "_from": "node-txstatsd@~0.1.1" } diff --git a/node_modules/preq/package.json b/node_modules/preq/package.json index d93f227..ffa258e 100644 --- a/node_modules/preq/package.json +++ b/node_modules/preq/package.json @@ -30,5 +30,5 @@ "readme": "ERROR: No README data found!", "_id": "[email protected]", "_shasum": "a8ffb1a2b6e747640e90ec626fe161fd38f991f4", - "_from": "preq@>=0.2.0" + "_from": "preq@~0.2.2" } diff --git a/node_modules/request/node_modules/aws-sign2/package.json b/node_modules/request/node_modules/aws-sign2/package.json index 719d488..c72ab54 100644 --- a/node_modules/request/node_modules/aws-sign2/package.json +++ b/node_modules/request/node_modules/aws-sign2/package.json @@ -42,5 +42,6 @@ "directories": {}, "_shasum": "c57103f7a17fc037f02d7c2e64b602ea223f7d63", "_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz", - "homepage": "https://github.com/mikeal/aws-sign" + "homepage": "https://github.com/mikeal/aws-sign", + "scripts": {} } diff --git a/node_modules/request/node_modules/forever-agent/package.json b/node_modules/request/node_modules/forever-agent/package.json index 764ca1e..110a36f 100644 --- a/node_modules/request/node_modules/forever-agent/package.json +++ b/node_modules/request/node_modules/forever-agent/package.json @@ -41,5 +41,6 @@ "directories": {}, "_shasum": "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130", "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", - "readme": "ERROR: No README data found!" + "readme": "ERROR: No README data found!", + "scripts": {} } diff --git a/node_modules/request/node_modules/stringstream/package.json b/node_modules/request/node_modules/stringstream/package.json index f9caf4b..3afb144 100644 --- a/node_modules/request/node_modules/stringstream/package.json +++ b/node_modules/request/node_modules/stringstream/package.json @@ -44,5 +44,6 @@ "bugs": { "url": "https://github.com/mhart/StringStream/issues" }, - "homepage": "https://github.com/mhart/StringStream" + "homepage": "https://github.com/mhart/StringStream", + "scripts": {} } diff --git a/node_modules/restbase-cassandra/node_modules/async/package.json b/node_modules/restbase-cassandra/node_modules/async/package.json index 8a0aae5..bdbe740 100644 --- a/node_modules/restbase-cassandra/node_modules/async/package.json +++ b/node_modules/restbase-cassandra/node_modules/async/package.json @@ -41,7 +41,7 @@ "shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7", "tarball": "http://registry.npmjs.org/async/-/async-0.9.0.tgz" }, - "_from": "[email protected]", + "_from": "async@~0.9.0", "_npmVersion": "1.4.3", "_npmUser": { "name": "caolan", diff --git a/node_modules/routeswitch/package.json b/node_modules/routeswitch/package.json index 3851b0b..aa0f7f5 100644 --- a/node_modules/routeswitch/package.json +++ b/node_modules/routeswitch/package.json @@ -39,5 +39,5 @@ "gitHead": "c34d70518f5275ed60e66ccacb0b9be0ef09fe91", "_id": "[email protected]", "_shasum": "814dfd9e26b791bbd054b29cdb77acd291bb7147", - "_from": "[email protected]" + "_from": "routeswitch@~0.6.1" } diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json index e12e84c..370b2e7 100644 --- a/node_modules/yargs/package.json +++ b/node_modules/yargs/package.json @@ -57,7 +57,7 @@ "homepage": "https://github.com/chevex/yargs", "_id": "[email protected]", "_shasum": "054de8b61f22eefdb7207059eaef9d6b83fb931a", - "_from": "yargs@>=1.3.0", + "_from": "yargs@~1.3.0", "_npmVersion": "2.1.7", "_nodeVersion": "0.10.33", "_npmUser": { -- To view, visit https://gerrit.wikimedia.org/r/177703 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I61fc32637b2d1997097d66295a3f4fb3fe159918 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/restbase/deploy Gerrit-Branch: master Gerrit-Owner: GWicke <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
