Socket
Socket
Sign inDemoInstall

dogapi

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dogapi - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

37

lib/api/snapshot.js
var extend = require('extend');
var util = require('util');
var snapshot_api = function(){};
snapshot_api.prototype.add_snapshot = function(snapshot, callback){

@@ -40,8 +37,40 @@ /*

this.request('GET', '/graph/snapshot', {query: snapshot}, callback);
};
snapshot_api.prototype.add_snapshot_from_def = function(snapshot, callback){
/*
* snapshot_api.add_snapshot_from_def(snapshot, [callback])
*
* method used to add a new snapshot to datadog based on a graph definition
* https://github.com/DataDog/dogapi/commit/583f13d7bd8de5a86daa2ff53f2d7cf6570e7ab2
* feature is not currently documented (at time of writing), but very useful.
*
* `snapshot` is an object containing any of the following:
* graph_def: *required*, JSON string dump of an existing graph definition
* start: *required*, int, Start of the query.(POSIX timestamp)
* end: *required*, int, End of the query.(POSIX timestamp)
*
* `callback` is an optional function for the result
* callback(error, result, status_code)
*/
if(typeof snapshot != 'object'){
throw new Error('`snapshot` parameter must be an object');
}
if(!snapshot['graph_def']){
throw new Error('`graph_def` property of `snapshot` parameter is required');
}
if(!snapshot['start']){
throw new Error('`start` property of `snapshot` parameter is required');
}
if(!snapshot['end']){
throw new Error('`end` property of `snapshot` parameter is required');
}
this.request('GET', '/graph/snapshot', {query: snapshot}, callback);
};
return module.exports = snapshot_api;

@@ -131,2 +131,10 @@ var extend = require('extend');

// This should only occur for errors such as a socket hang up prior to any
// data being received, or SSL-related issues.
req.on('error', function(err) {
if(typeof callback == 'function'){
callback(err, null, 0);
}
});
if(['POST', 'PUT'].indexOf(http_options['method']) >= 0){

@@ -133,0 +141,0 @@ req.write(body);

7

package.json
{
"name": "dogapi",
"version": "0.1.5",
"version": "0.1.6",
"description": "Datadog API Node.JS Client",

@@ -23,3 +23,4 @@ "main": "lib/index.js",

"contributors":[
"colinjonesx (http://www.thetestpeople.com)"
"colinjonesx (http://www.thetestpeople.com)",
"dalehamel (http://blog.srvthe.net)"
],

@@ -30,4 +31,4 @@ "license": "MIT",

"dependencies": {
"extend": "~1.1.3"
"extend": "^2.0.0"
}
}

@@ -120,2 +120,4 @@ node-dogapi

* method used to take a snapshot of a datadog graph
* `dogapi.add_snapshot_from_def(snapshot, [callback])`
* method used to take a snapshot of a datadog graph

@@ -122,0 +124,0 @@ ## Sample Usage:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc