• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Datadog API Node.JS Client

dogapi

npm version Build Status Dependency Status

Datadog API Node.JS Client.

Official Datadog API Documentation: http://docs.datadoghq.com/api/

dogapi API Docs: http://brettlangdon.github.io/node-dogapi/

StatsD

dogapi does not provide any functionality to talk to a local dogstatsd server. This library is purely an interface to the HTTP api.

If you are looking for a good Datadog StatsD library, I recommend checking out node-dogstatsd.

Installation

From NPM:

[sudo] npm install dogapi

From source:

git clone git://github.com/brettlangdon/node-dogapi.git
cd ./node-dogapi
npm install

Configuration

You will need your Datadog api key as well as an application key to use dogapi.

Keys can be found at: https://app.datadoghq.com/account/settings#api

var dogapi = require("dogapi");

var options = {
 api_key: "YOUR_KEY_HERE",
 app_key: "YOUR_KEY_HERE",
 // if you are on the Datadog EU site, you need to overwrite the default value of api_host key:
 // api_host: "app.datadoghq.eu"
};

dogapi.initialize(options);

HTTPS Proxy

If you are behind a proxy you need to a proxy agent. You can use the https proxy agent from http://blog.vanamco.com/proxy-requests-in-node-js/ if you like. To configure dogapi with the agent just add it to the options.

var dogapi = require("dogapi");

//Code from http://blog.vanamco.com/proxy-requests-in-node-js/
var HttpsProxyAgent = require("./httpsproxyagent");

var agent = new HttpsProxyAgent({
   proxyHost: "MY_PROXY_HOST",
   proxyPort: 3128
});

var options = {
   api_key: "YOUR_KEY_HERE",
   app_key: "YOUR_KEY_HERE",
   proxy_agent: agent
};

dogapi.initialize(options);

CLI Usage

dogapi now ships with a command line interface dogapi. To use it you will need a .dogapirc file which meets the standards of https://github.com/dominictarr/rc

The config file must contain both api_key and app_key keys (you can find your datadog api and app keys here https://app.datadoghq.com/account/settings#api)

Example:

{
  "api_key": "<API_KEY>",
  "app_key": "<APP_KEY>"
}

Usage

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:

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:

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:

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:

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) Copyright (c) 2013 Brett Langdon [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

jsnice

Command line interface to http://jsnice.org.
JavaScript
270
star
2

git-vendor

Git command for managing git vendored dependencies
Shell
248
star
3

forge

Configuration file syntax and parsing for golang
Go
110
star
4

NodeLua

Lua Bindings For Node.JS
C++
86
star
5

flask-env

Easily set Flask settings from environment variables
Python
35
star
6

importhook

Python package for executing functions when packages are imported
JavaScript
25
star
7

jsfmt.el

emacs plugin to run jsfmt
Emacs Lisp
13
star
8

node-units

A extensible unit conversion library for Node.JS
JavaScript
12
star
9

node-kestrel

Kestrel client module for NodeJS
JavaScript
12
star
10

greenrpc

TCP & HTTP RPC Servers built on msgpack and gevent
Python
12
star
11

tommygun

HTTP Benchmarking Tool Written In Node.JS
JavaScript
10
star
12

tracking-server-examples

Code examples to follow along with http://brett.is/writing/about/third-party-tracking-pixels/
Python
8
star
13

go-dom

Web API package for use when compling Go to WASM
Go
8
star
14

qw

qw (QueueWorker) - python library for processing a redis list as a work queue
Python
7
star
15

node-wgdb

Bindings for WhiteDB for Node.JS
C++
7
star
16

sysaudit

Backport module for sys.audit and sys.addaudithook mechanism
Python
6
star
17

Programming-In-General

A language agnostic book on programming.
Python
6
star
18

tend

CLI Tool to run a command when files in a directory have changed
JavaScript
6
star
19

firestore-autocomplete

Example application using Firebase Firestore for autocomplete.
JavaScript
6
star
20

gython

Python 3 interpreter in Go
Go
5
star
21

sleuth

Simple JavaScript metrics beacon library
JavaScript
5
star
22

pypihub

pip compatible server to serve Python packages out of GitHub
Go
4
star
23

riakcached

A memcache like client for Riak
Python
3
star
24

jsonstream

Utility to interact with a stream of newline delimited JSON
Go
3
star
25

Continuous

Event based interface to setTimeout and setInterval.
JavaScript
3
star
26

ferrite

A very fast kyoto cabinet powered memcache interface http proxy caching server.
Go
3
star
27

flume-kestrel

Kestrel plugin for Flume.
Java
3
star
28

docast

Generate docs from javascript source via AST parsing
JavaScript
2
star
29

flask-defer

Flask extension to help register functions to run at the end of the current request.
Python
2
star
30

node-response-codes

Node module that extends http.ServerResponse to include status code functions.
JavaScript
2
star
31

ledger

Ledger is an event based NodeJS module used for logging events to stdout, files or MongoDB.
JavaScript
2
star
32

brett.is

My personal blog
CSS
2
star
33

cmdsrv

A simple text protocol server.
JavaScript
2
star
34

v8type

Expose V8 C++ type checking to JS
C++
2
star
35

caddydogstatsd

Datadog dogstatsd middleware plugin for Caddy.
Go
2
star
36

buildparser

Python package for parsing a build spec(s) from a config file
Python
1
star
37

flume-rabbitmq

RabbitMQ Sink Plugin for Cloudera's Flume v0.9.4
Java
1
star
38

franz

Franz is a Kafka Client for Node.JS that includes support for Zookeeper
C++
1
star
39

yaps

Yet Another Plugin Server
JavaScript
1
star
40

github-keys

Host GitHub user public keys
Go
1
star
41

virtualmod

Python package for creating and importing virtual modules.
Python
1
star
42

realm

A simple non-recursive DNS server written in Go.
Go
1
star
43

flume-hornetq

HornetQ Sink plugin for Flume.
1
star