Comparing version 2.1.1 to 2.1.2
@@ -15,3 +15,3 @@ var client = require("../client"); | ||
* * 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: | | ||
@@ -37,3 +37,3 @@ * function(err, res) | ||
* }); | ||
* 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); | ||
@@ -73,3 +73,3 @@ * }); | ||
* * 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: | | ||
@@ -202,18 +202,14 @@ * function(err, res) | ||
" --host <host> the hostname that should be associated with this metric", | ||
" --type <type> the type of metric \"gauge\" or \"counter\"" | ||
" --type <type> the type of metric \"gauge\" or \"count\"" | ||
] | ||
}, | ||
handleCli: function(subcommand, args, callback){ | ||
if(subcommand === "send"){ | ||
if(args._.length > 5 && subcommand === "send"){ | ||
var extra = {}; | ||
if(args["--tags"]){ | ||
extra.tags = args["--tags"].split(","); | ||
if(args.tags){ | ||
extra.tags = args.tags.split(","); | ||
} | ||
if(args["--host"]){ | ||
extra.host = args["--host"]; | ||
} | ||
if(args["--type"]){ | ||
extra.metric_type = args["--type"]; | ||
} | ||
send(args["<metric>"], args["<point>"], extra, callback); | ||
extra.host = args.host; | ||
extra.type = args.type; | ||
send(args._[4], args._[5], extra, callback); | ||
} else if(subcommand === "query" && args._.length > 6){ | ||
@@ -220,0 +216,0 @@ var from = parseInt(args._[4]); |
{ | ||
"name": "dogapi", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Datadog API Node.JS Client", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -137,3 +137,3 @@ var assert = require("assert"); | ||
// Make our api call | ||
metric.send("metrics.send.counter", 5, {type: "counter"}); | ||
metric.send("metrics.send.counter", 5, {type: "count"}); | ||
@@ -154,7 +154,7 @@ // Assert we called `client.request` with the correct `points` | ||
// 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"); | ||
}); | ||
@@ -164,3 +164,3 @@ | ||
// Make our api call | ||
metric.send("metrics.send.counter", 5, {metric_type: "counter"}); | ||
metric.send("metrics.send.counter", 5, {metric_type: "count"}); | ||
@@ -182,7 +182,7 @@ // Assert we called `client.request` with the correct `points` | ||
// 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"); | ||
}); | ||
@@ -287,3 +287,3 @@ }); | ||
points: 5, | ||
type: "counter" | ||
type: "count" | ||
} | ||
@@ -301,3 +301,3 @@ ]; | ||
// 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 | ||
@@ -315,7 +315,7 @@ var data = call_args[2]; | ||
// 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"); | ||
}); | ||
@@ -329,3 +329,3 @@ | ||
points: 5, | ||
metric_type: "counter" | ||
metric_type: "count" | ||
} | ||
@@ -343,3 +343,3 @@ ]; | ||
// 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 | ||
@@ -357,9 +357,9 @@ var data = call_args[2]; | ||
// 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"); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
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
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
174545
3181