Mobrovac has submitted this change and it was merged. Change subject: Update repo to fd026c6 and update node dependencies ......................................................................
Update repo to fd026c6 and update node dependencies Change-Id: I80b6ec8e9450bd1b66012a5e8abd52f37e648e9b --- D node_modules/bunyan/node_modules/dtrace-provider/.gitmodules D node_modules/cheerio/node_modules/htmlparser2/.gitattributes D node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/htmlparser2/.gitattributes D node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.orig D node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.rej D node_modules/grunt/node_modules/async/.gitmodules D node_modules/html-metadata/node_modules/microdata-node/node_modules/array-unique/.gitattributes D node_modules/html-metadata/node_modules/microdata-node/node_modules/htmlparser2/.gitattributes A node_modules/node-txstatsd/.jshintignore A node_modules/node-txstatsd/.jshintrc A node_modules/node-txstatsd/.travis.yml A node_modules/node-txstatsd/README.md A node_modules/node-txstatsd/index.js A node_modules/node-txstatsd/package.json M src 15 files changed, 299 insertions(+), 39 deletions(-) Approvals: Mobrovac: Verified; Looks good to me, approved diff --git a/node_modules/bunyan/node_modules/dtrace-provider/.gitmodules b/node_modules/bunyan/node_modules/dtrace-provider/.gitmodules deleted file mode 100644 index 933bc02..0000000 --- a/node_modules/bunyan/node_modules/dtrace-provider/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "libusdt"] - path = libusdt - url = https://github.com/chrisa/libusdt diff --git a/node_modules/cheerio/node_modules/htmlparser2/.gitattributes b/node_modules/cheerio/node_modules/htmlparser2/.gitattributes deleted file mode 100644 index 4bb50dc..0000000 --- a/node_modules/cheerio/node_modules/htmlparser2/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text eol=lf \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/htmlparser2/.gitattributes b/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/htmlparser2/.gitattributes deleted file mode 100644 index 4bb50dc..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/htmlparser2/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text eol=lf \ No newline at end of file diff --git a/node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.orig b/node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.orig deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.orig +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.rej b/node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.rej deleted file mode 100644 index 69244ff..0000000 --- a/node_modules/grunt-simple-mocha/node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.rej +++ /dev/null @@ -1,5 +0,0 @@ ---- /dev/null -+++ .gitignore -@@ -0,0 +1,2 @@ -+node_modules/ -+npm-debug.log \ No newline at end of file diff --git a/node_modules/grunt/node_modules/async/.gitmodules b/node_modules/grunt/node_modules/async/.gitmodules deleted file mode 100644 index a9aae98..0000000 --- a/node_modules/grunt/node_modules/async/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "deps/nodeunit"] - path = deps/nodeunit - url = git://github.com/caolan/nodeunit.git -[submodule "deps/UglifyJS"] - path = deps/UglifyJS - url = https://github.com/mishoo/UglifyJS.git -[submodule "deps/nodelint"] - path = deps/nodelint - url = https://github.com/tav/nodelint.git diff --git a/node_modules/html-metadata/node_modules/microdata-node/node_modules/array-unique/.gitattributes b/node_modules/html-metadata/node_modules/microdata-node/node_modules/array-unique/.gitattributes deleted file mode 100644 index 759c2c5..0000000 --- a/node_modules/html-metadata/node_modules/microdata-node/node_modules/array-unique/.gitattributes +++ /dev/null @@ -1,14 +0,0 @@ -# Enforce Unix newlines -*.* text eol=lf -*.css text eol=lf -*.html text eol=lf -*.js text eol=lf -*.json text eol=lf -*.less text eol=lf -*.md text eol=lf -*.yml text eol=lf - -*.jpg binary -*.gif binary -*.png binary -*.jpeg binary \ No newline at end of file diff --git a/node_modules/html-metadata/node_modules/microdata-node/node_modules/htmlparser2/.gitattributes b/node_modules/html-metadata/node_modules/microdata-node/node_modules/htmlparser2/.gitattributes deleted file mode 100644 index 4bb50dc..0000000 --- a/node_modules/html-metadata/node_modules/microdata-node/node_modules/htmlparser2/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text eol=lf \ No newline at end of file diff --git a/node_modules/node-txstatsd/.jshintignore b/node_modules/node-txstatsd/.jshintignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/node-txstatsd/.jshintignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/node-txstatsd/.jshintrc b/node_modules/node-txstatsd/.jshintrc new file mode 100644 index 0000000..97c5ebb --- /dev/null +++ b/node_modules/node-txstatsd/.jshintrc @@ -0,0 +1,37 @@ +{ + "predef": [ + "ve", + + "setImmediate", + + "QUnit", + + "Map", + "Set" + ], + + "bitwise": true, + "laxbreak": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "noempty": true, + "nonew": true, + "regexp": false, + "undef": true, + "strict": true, + "trailing": true, + + "smarttabs": true, + "multistr": true, + + "node": true, + + "nomen": false, + "loopfunc": true, + "esnext": true + //"onevar": true +} diff --git a/node_modules/node-txstatsd/.travis.yml b/node_modules/node-txstatsd/.travis.yml new file mode 100644 index 0000000..34a9423 --- /dev/null +++ b/node_modules/node-txstatsd/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "0.10" + - "0.11" + diff --git a/node_modules/node-txstatsd/README.md b/node_modules/node-txstatsd/README.md new file mode 100644 index 0000000..2f88acd --- /dev/null +++ b/node_modules/node-txstatsd/README.md @@ -0,0 +1,6 @@ +# node-txstatsd + +Modified version of https://github.com/sivy/node-statsd/ for WMF specific +txstatsd constraints. We've removed increment/decrement and nullified the sets +function if operating in txstatsd mode. + diff --git a/node_modules/node-txstatsd/index.js b/node_modules/node-txstatsd/index.js new file mode 100644 index 0000000..3a5e69a --- /dev/null +++ b/node_modules/node-txstatsd/index.js @@ -0,0 +1,203 @@ +"use strict"; +/** + * Modified version of https://github.com/sivy/node-statsd/ for WMF specific + * txstatsd constraints. + * + * We've removed increment/decrement and nullified the sets function if operating + * in txstatsd mode. + * + * Original license to node-statsd: + * + * Copyright 2011 Steve Ivy. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * @type {exports} + */ + +var dgram = require('dgram'), + dns = require('dns'); + +/** + * The UDP Client for StatsD + * @param options + * @option host {String} The host to connect to default: localhost + * @option port {String|Integer} The port to connect to default: 8125 + * @option prefix {String} An optional prefix to assign to each stat name sent + * @option suffix {String} An optional suffix to assign to each stat name sent + * @option txstatsd {boolean} An optional boolean that if true swaps counters for meters + * @option globalize {boolean} An optional boolean to add "statsd" as an object in the global namespace + * @option cacheDns {boolean} An optional option to only lookup the hostname -> ip address once + * @option mock {boolean} An optional boolean indicating this Client is a mock object, no stats are sent. + * @constructor + */ +var Client = function (host, port, prefix, suffix, txstatsd, globalize, cacheDns, mock) { + 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 + }; + } + + 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.globalize){ + global.statsd = this; + } +}; + +/** + * Represents the timing stat + * @param stat {String|Array} The stat(s) to send + * @param time {Number} The time in milliseconds to send + * @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.timing = function (stat, time, sampleRate, callback) { + this.sendAll(stat, time, 'ms', sampleRate, callback); +}; + +/** + * Increments a stat by a specified amount + * @param stat {String|Array} The stat(s) to send + * @param value The value to send + * @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.increment = function (stat, value, sampleRate, callback) { + var type = this.txstatsd ? 'm' : 'c'; + this.sendAll(stat, value || 1, type, sampleRate, callback); +}; + +/** + * Gauges a stat by a specified amount + * @param stat {String|Array} The stat(s) to send + * @param value The value to send + * @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.gauge = function (stat, value, sampleRate, callback) { + this.sendAll(stat, value, 'g', sampleRate, callback); +}; + +/** + * Counts unique values by a specified amount + * @param stat {String|Array} The stat(s) to send + * @param value The value to send + * @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.unique = + 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 + * @param stat {String|Array} The stat(s) to send + * @param value The value to send + * @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(stats, value, type, sampleRate, callback){ + var self = this; + + if (!Array.isArray(stats)) { + stats = [stats]; + } + + // txstatsd doesn't actually support multiple metrics in one packet + //var message = stats.filter(function(item) { + // return item !== undefined; + // }).map(function(item) { + // return self.makeMessage(item, value, type, sampleRate); + // }).join('\n'); + //console.log(message); + //if (message) { + // this._send(message, callback); + //} + + // So send them all individually + stats.forEach(function(item) { + self._send(self.makeMessage(item, value, type, sampleRate), callback); + }); +}; + +/** + * Sends a stat across the wire + * @param stat {String|Array} The stat message to send + * @param callback {Function} Callback when message is done being delivered. Optional. + */ +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); + } + } +}; + +/** + * Build a stat message + */ +Client.prototype.makeMessage = function (stat, value, type, sampleRate) { + var message = this.prefix + stat + this.suffix + ':' + value + '|' + type, + buf; + + if(sampleRate && sampleRate < 1){ + if(Math.random() < sampleRate){ + return message + '|@' + sampleRate; + } else { + //don't want to send if we don't meet the sample ratio + return; + } + } else { + return message; + } +}; + +module.exports = Client; diff --git a/node_modules/node-txstatsd/package.json b/node_modules/node-txstatsd/package.json new file mode 100644 index 0000000..6648d11 --- /dev/null +++ b/node_modules/node-txstatsd/package.json @@ -0,0 +1,47 @@ +{ + "name": "node-txstatsd", + "version": "0.1.5", + "description": "Modified version of https://github.com/sivy/node-statsd/ for WMF specific", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/wikimedia/node-txstatsd.git" + }, + "keywords": [ + "statsd", + "txstatsd", + "client" + ], + "author": { + "name": "Gabriel Wicke", + "email": "gwi...@wikimedia.org" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/wikimedia/node-txstatsd/issues" + }, + "gitHead": "779d8ca71694d22a4bf11b547b25e0c2d5521f14", + "_id": "node-txstatsd@0.1.5", + "_shasum": "9a7a9bcc149319fb553b228909dd2b9996f903bc", + "_from": "node-txstatsd@0.1.5", + "_npmVersion": "1.4.21", + "_npmUser": { + "name": "gwicke", + "email": "gabr...@gwicke.net" + }, + "maintainers": [ + { + "name": "gwicke", + "email": "gabr...@gwicke.net" + } + ], + "dist": { + "shasum": "9a7a9bcc149319fb553b228909dd2b9996f903bc", + "tarball": "http://registry.npmjs.org/node-txstatsd/-/node-txstatsd-0.1.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/node-txstatsd/-/node-txstatsd-0.1.5.tgz" +} diff --git a/src b/src index 2cd246b..fd026c6 160000 --- a/src +++ b/src -Subproject commit 2cd246b99fd2f407b92c33a079a1120f0abe7117 +Subproject commit fd026c69c99f8f78878fb771920c582666e692d0 -- To view, visit https://gerrit.wikimedia.org/r/197972 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I80b6ec8e9450bd1b66012a5e8abd52f37e648e9b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/citoid/deploy Gerrit-Branch: master Gerrit-Owner: Mobrovac <mobro...@wikimedia.org> Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits