GWicke has submitted this change and it was merged.

Change subject: Update to latest master
......................................................................


Update to latest master

Change-Id: I5a9848d8f2decf1d2b90fbfbc1a1a075881c6670
---
D node_modules/bunyan/node_modules/dtrace-provider/.gitmodules
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
D 
node_modules/restbase-cassandra/node_modules/restify/node_modules/dtrace-provider/.gitmodules
D 
node_modules/restbase-cassandra/node_modules/restify/node_modules/verror/.gitmodules
D 
node_modules/restbase-cassandra/node_modules/restify/node_modules/verror/node_modules/extsprintf/.gitmodules
M restbase
11 files changed, 291 insertions(+), 12 deletions(-)

Approvals:
  GWicke: 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/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..294f918
--- /dev/null
+++ b/node_modules/node-txstatsd/index.js
@@ -0,0 +1,210 @@
+"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 || '';
+       this.txstatsd = options.txstatsd || false;
+       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) {
+               this.sendAll(stat, value, 's', 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(stat, value, type, sampleRate, callback){
+       var completed = 0,
+               calledback = false,
+               sentBytes = 0,
+               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);
+       }
+};
+
+/**
+ * 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 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;
+
+       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;
+               }
+       }
+
+       // 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);
+               }
+       }
+};
+
+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..a1544ac
--- /dev/null
+++ b/node_modules/node-txstatsd/package.json
@@ -0,0 +1,32 @@
+{
+  "name": "node-txstatsd",
+  "version": "0.1.0",
+  "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": "[email protected]"
+  },
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/wikimedia/node-txstatsd/issues";
+  },
+  "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": "5d177042377dbd5a907904644ce8d6408c593f2f",
+  "_id": "[email protected]",
+  "_shasum": "1cd371d4b0a3fab41d34c2809246a447e32b437d",
+  "_from": "node-txstatsd@^0.1.0"
+}
diff --git 
a/node_modules/restbase-cassandra/node_modules/restify/node_modules/dtrace-provider/.gitmodules
 
b/node_modules/restbase-cassandra/node_modules/restify/node_modules/dtrace-provider/.gitmodules
deleted file mode 100644
index 933bc02..0000000
--- 
a/node_modules/restbase-cassandra/node_modules/restify/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/restbase-cassandra/node_modules/restify/node_modules/verror/.gitmodules
 
b/node_modules/restbase-cassandra/node_modules/restify/node_modules/verror/.gitmodules
deleted file mode 100644
index e69de29..0000000
--- 
a/node_modules/restbase-cassandra/node_modules/restify/node_modules/verror/.gitmodules
+++ /dev/null
diff --git 
a/node_modules/restbase-cassandra/node_modules/restify/node_modules/verror/node_modules/extsprintf/.gitmodules
 
b/node_modules/restbase-cassandra/node_modules/restify/node_modules/verror/node_modules/extsprintf/.gitmodules
deleted file mode 100644
index 4e0f5e2..0000000
--- 
a/node_modules/restbase-cassandra/node_modules/restify/node_modules/verror/node_modules/extsprintf/.gitmodules
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "deps/jsstyle"]
-       path = deps/jsstyle
-       url = git://github.com/davepacheco/jsstyle
-[submodule "deps/javascriptlint"]
-       path = deps/javascriptlint
-       url = git://github.com/davepacheco/javascriptlint
diff --git a/restbase b/restbase
index b1b9659..a629cdb 160000
--- a/restbase
+++ b/restbase
-Subproject commit b1b9659de8e3532b0cde4c77a3142e796de83b7a
+Subproject commit a629cdb934615506b42003db286cdba28e3169a2

-- 
To view, visit https://gerrit.wikimedia.org/r/177302
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5a9848d8f2decf1d2b90fbfbc1a1a075881c6670
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/restbase/deploy
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to