diff --git a/README.md b/README.md index 41e706d..cf103d1 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,66 @@ Please run `dogapi --help` to see current usage documentation for the tool. Every api method available in `dogapi` is exposed via the cli tool. +## Major changes from 1.x.x to 2.x.x +We have updated major versions for this library due to a backwards incompatible change to the argument format for `dogapi.metric.send` and `dogapi.metric.send_all`. + +### dogapi.metric.send +Previously in `1.x.x`: + +```javascript +var now = parseInt(new Date().getTime() / 1000); +dogapi.metric.send("metric.name", 50); +dogapi.metric.send("metric.name", [now, 50]); +``` + +Now in `2.x.x`: + +```javascript +var now = parseInt(new Date().getTime() / 1000); +dogapi.metric.send("metric.name", 50); +dogapi.metric.send("metric.name", [50, 100]); +dogapi.metric.send("metric.name", [[now, 50]]); +``` + +### dogapi.metric.send_all +Previously in `1.x.x`: + +```javascript +var now = parseInt(new Date().getTime() / 1000); +var metrics = [ + { + metric: "metric.name", + points: [now, 50] + }, + { + metric: "metric.name", + points: 50 + } +]; +dogapi.metric.send_all(metrics); +``` + +Now in `2.x.x`: + +```javascript +var now = parseInt(new Date().getTime() / 1000); +var metrics = [ + { + metric: "metric.name", + points: [[now, 50]] + }, + { + metric: "metric.name", + points: [50, 100] + }, + { + metric: "metric.name", + points: 50 + } +]; +dogapi.metric.send_all(metrics); +``` + ## License The MIT License (MIT) diff --git a/index.html b/index.html index c40f1ae..2ded8c3 100644 --- a/index.html +++ b/index.html @@ -618,8 +618,8 @@ dogapi.infrastructure.search("hosts:database", function(err, res){

the metric name

points
-

single datapoint or array of [timestamp, datapoint], if a single point -is given "now" is used as the timestamp

+

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]])

extra

optional, object which can contain the following keys

@@ -644,8 +644,11 @@ dogapi.initialize(options); dogapi.metric.send("my.metric", 1000, function(err, results){ console.dir(results); }); +dogapi.metric.send("my.metric", [500, 1000], function(err, results){ + console.dir(results); +}); var now = parseInt(new Date().getTime() / 1000); -dogapi.metric.send("my.metric", [now, 1000], function(err, results){ +dogapi.metric.send("my.metric", [[now, 1000]], function(err, results){ console.dir(results); }); @@ -661,7 +664,7 @@ dogapi.metric.send("my.metric", [now, 1000], function(err, results){

an array of metrics where each element is an object with the following keys