From 92d787967ad052376b03c26c94831da510b7920b Mon Sep 17 00:00:00 2001 From: Igor Bondarenko Date: Fri, 18 Mar 2016 19:42:54 +0200 Subject: [PATCH] s/counter/count for metric type --- lib/api/metric.js | 8 ++++---- test/api/metric.js | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/api/metric.js b/lib/api/metric.js index 496be2c..355009c 100644 --- a/lib/api/metric.js +++ b/lib/api/metric.js @@ -12,7 +12,7 @@ var client = require("../client"); * optional, object which can contain the following keys * * host: the host source of the metric * * tags: array of "tag:value"'s to use for the metric - * * metric_type|type: which metric type to use ("gauge" or "counter") [default: gauge] + * * metric_type|type: which metric type to use ("gauge" or "count") [default: gauge] * callback: | * function(err, res) *example: | @@ -33,7 +33,7 @@ var client = require("../client"); * dogapi.metric.send("my.metric", [[now, 1000]], function(err, results){ * console.dir(results); * }); - * dogapi.metric.send("my.counter", 5, {type: "counter"}, function(err, results){ + * dogapi.metric.send("my.counter", 5, {type: "count"}, function(err, results){ * console.dir(results); * }); * ``` @@ -68,7 +68,7 @@ function send(metric, points, extra, callback){ * * points: a single data point (e.g. `50`), an array of data points (e.g. `[50, 100]`) or an array of `[timestamp, value]` elements (e.g. `[[now, 50], [now, 100]]`) * * tags: an array of "tag:value"'s * * host: the source hostname to use for the metrics - * * metric_type|type: the type of metric to use ("gauge" or "counter") [default: gauge] + * * metric_type|type: the type of metric to use ("gauge" or "count") [default: gauge] * callback: | * function(err, res) *example: | @@ -196,7 +196,7 @@ module.exports = { " Options:", " --tags a comma separated list of \"tag:value\"'s", " --host the hostname that should be associated with this metric", - " --type the type of metric \"gauge\" or \"counter\"" + " --type the type of metric \"gauge\" or \"count\"" ] }, handleCli: function(subcommand, args, callback){ diff --git a/test/api/metric.js b/test/api/metric.js index 9934e4e..dd00ed8 100644 --- a/test/api/metric.js +++ b/test/api/metric.js @@ -134,7 +134,7 @@ describe("api/metrics", function(){ it("should properly set metric type", function(){ // Make our api call - metric.send("metrics.send.counter", 5, {type: "counter"}); + metric.send("metrics.send.counter", 5, {type: "count"}); // Assert we called `client.request` with the correct `points` assert(stub_request.calledOnce); @@ -150,16 +150,16 @@ describe("api/metrics", function(){ assert.equal(series.length, 1); // Assert the first series is properly formatted - // first_series = {metric: "", type: "counter", points: [], ...} + // first_series = {metric: "", type: "count", points: [], ...} var first_series = series[0] assert.equal(first_series.metric, "metrics.send.counter"); assert(first_series.hasOwnProperty("type")); - assert.equal(first_series.type, "counter"); + assert.equal(first_series.type, "count"); }); it("should properly set convert metric_type to type", function(){ // Make our api call - metric.send("metrics.send.counter", 5, {metric_type: "counter"}); + metric.send("metrics.send.counter", 5, {metric_type: "count"}); // Assert we called `client.request` with the correct `points` assert(stub_request.calledOnce); @@ -176,11 +176,11 @@ describe("api/metrics", function(){ assert.equal(series.length, 1); // Assert the first series is properly formatted - // first_series = {metric: "", type: "counter", points: [], ...} + // first_series = {metric: "", type: "count", points: [], ...} var first_series = series[0] assert.equal(first_series.metric, "metrics.send.counter"); assert(first_series.hasOwnProperty("type")); - assert.equal(first_series.type, "counter"); + assert.equal(first_series.type, "count"); }); }); @@ -280,7 +280,7 @@ describe("api/metrics", function(){ { metric: "metric.send.counter", points: 5, - type: "counter" + type: "count" } ]; metric.send_all(metrics); @@ -293,7 +293,7 @@ describe("api/metrics", function(){ assert.equal(call_args[1], "/series"); // Properly formatted body - // { body: series: [ {metric: "metric.send.counter", host: undefined, tags: undefined, type: "counter"} ] } + // { body: series: [ {metric: "metric.send.counter", host: undefined, tags: undefined, type: "count"} ] } // DEV: host/tags are optional and should be undefined for this case var data = call_args[2]; assert(data.hasOwnProperty("body")); @@ -306,11 +306,11 @@ describe("api/metrics", function(){ assert.equal(series.length, 1); // Assert the first series is properly formatted - // first_series = {metric: "", type: "counter", points: [], ...} + // first_series = {metric: "", type: "count", points: [], ...} var first_series = series[0] assert.equal(first_series.metric, "metric.send.counter"); assert(Array.isArray(first_series.points)); - assert.deepEqual(first_series.type, "counter"); + assert.deepEqual(first_series.type, "count"); }); it("should properly send metric_type as type", function(){ @@ -319,7 +319,7 @@ describe("api/metrics", function(){ { metric: "metric.send.counter", points: 5, - metric_type: "counter" + metric_type: "count" } ]; metric.send_all(metrics); @@ -332,7 +332,7 @@ describe("api/metrics", function(){ assert.equal(call_args[1], "/series"); // Properly formatted body - // { body: series: [ {metric: "metric.send.counter", host: undefined, tags: undefined, type: "counter"} ] } + // { body: series: [ {metric: "metric.send.counter", host: undefined, tags: undefined, type: "count"} ] } // DEV: host/tags are optional and should be undefined for this case var data = call_args[2]; assert(data.hasOwnProperty("body")); @@ -345,11 +345,11 @@ describe("api/metrics", function(){ assert.equal(series.length, 1); // Assert the first series is properly formatted - // first_series = {metric: "", type: "counter", points: [], ...} + // first_series = {metric: "", type: "count", points: [], ...} var first_series = series[0] assert.equal(first_series.metric, "metric.send.counter"); assert(Array.isArray(first_series.points)); - assert.deepEqual(first_series.type, "counter"); + assert.deepEqual(first_series.type, "count"); }); }); });