Browse Source

Update docs for new version

pull/30/head
Brett Langdon 10 years ago
parent
commit
3ddbbc0bf5
2 changed files with 72 additions and 5 deletions
  1. +60
    -0
      README.md
  2. +12
    -5
      index.html

+ 60
- 0
README.md View File

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


+ 12
- 5
index.html View File

@ -618,8 +618,8 @@ dogapi.infrastructure.search("hosts:database", function(err, res){
<dd><p>the metric name</p>
</dd>
<dt>points</dt>
<dd><p>single datapoint or array of [timestamp, datapoint], if a single point
is given &quot;now&quot; is used as the timestamp</p>
<dd><p>a single data point (e.g. <code>50</code>), an array of data points (e.g. <code>[50, 100]</code>)
or an array of <code>[timestamp, value]</code> elements (e.g. <code>[[now, 50], [now, 100]]</code>)</p>
</dd>
<dt>extra</dt>
<dd><p><em>optional</em>, object which can contain the following keys</p>
@ -644,8 +644,11 @@ dogapi.initialize(options);
dogapi.metric.send(&quot;my.metric&quot;, 1000, function(err, results){
console.dir(results);
});
dogapi.metric.send(&quot;my.metric&quot;, [500, 1000], function(err, results){
console.dir(results);
});
var now = parseInt(new Date().getTime() / 1000);
dogapi.metric.send(&quot;my.metric&quot;, [now, 1000], function(err, results){
dogapi.metric.send(&quot;my.metric&quot;, [[now, 1000]], function(err, results){
console.dir(results);
});
</code></pre>
@ -661,7 +664,7 @@ dogapi.metric.send(&quot;my.metric&quot;, [now, 1000], function(err, results){
<dd><p>an array of metrics where each element is an object with the following keys</p>
<ul>
<li>metric: the name of the metric</li>
<li>points: a single datapoint or an array of [timestamp, datapoint] (same as <code>dogapi.metric.send</code>)</li>
<li>points: a single data point (e.g. <code>50</code>), an array of data points (e.g. <code>[50, 100]</code>) or an array of <code>[timestamp, value]</code> elements (e.g. <code>[[now, 50], [now, 100]]</code>)</li>
<li>tags: an array of &quot;tag:value&quot;&#39;s</li>
<li>host: the source hostname to use for the metrics</li>
<li>metric_type: the type of metric to use (&quot;gauge&quot; or &quot;counter&quot;) [default: gauge]</li>
@ -683,9 +686,13 @@ var now = parseInt(new Date().getTime() / 1000);
var metrics = [
{
metric: &quot;my.metric&quot;,
points: [now, 1000],
points: [[now, 1000]],
tags: [&quot;tag:value&quot;]
},
{
metric: &quot;another.metric&quot;,
points: [50, 1000]
},
{
metric: &quot;another.metric&quot;,
points: 1000


Loading…
Cancel
Save