npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

datadog-client

v3.0.0-alpha.2

Published

Datadog API Node.JS Client

Downloads

71

Readme

datadog-client

Datadog API Node.JS Client :dog2:

:warning: This is a fork from node-dogapi

npm version Build Status Dependency Status codecov

Documentation :books:

  • Official Datadog API Documentation: http://docs.datadoghq.com/api/
  • This fork datadog-client API Docs: https://omni-tools.github.io/node-datadog-client/
  • Original dogapi API Docs: https://brettlangdon.github.io/node-dogapi/

Clarification about this library

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, you can check out node-dogstatsd. Or the more adopted hot-shots supporting both StatsD and DogStatsD

Installation

npm install datadog-client

Configuration

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

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

const dogapi = require('dogapi');

const options = {api_key: "YOUR_KEY_HERE", app_key: "YOUR_KEY_HERE"};

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.

const dogapi = require('dogapi');

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

const options = {
  api_key: 'YOUR_KEY_HERE',
  app_key: 'YOUR_KEY_HERE',
  proxy_agent: new HttpsProxyAgent({
    proxyHost: "MY_PROXY_HOST",
    proxyPort: 3128
  })
};

dogapi.initialize(options);

CLI Usage

dogapi now ships with a command line interface dogapi (or datadog-cli).

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 in 3.x.x

Al major improvements and eventuals breaking changes are TO BE DESCRIBED HERE

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:

dogapi.metric.send('metric.name', 50);
dogapi.metric.send('metric.name', [datatog.now(), 50]);

Now in 2.x.x:

dogapi.metric.send('metric.name', 50);
dogapi.metric.send('metric.name', [50, 100]);
dogapi.metric.send('metric.name', [[datadog.now(), 50]]);

dogapi.metric.send_all

Previously in 1.x.x:

const metrics = [
  {metric: 'metric.name', points: [datadog.now(), 50]},
  {metric: 'metric.name', points: 50}
];
dogapi.metric.send_all(metrics);

Now in 2.x.x:

const metrics = [
  {metric: 'metric.name', points: [[datadog.now(), 50]]},
  {metric: 'metric.name', points: [50, 100]},
  {metric: 'metric.name', points: 50}
];
dogapi.metric.send_all(metrics);