datadog-light

4.0.0 • Public • Published

datadog-light

Build Status Test Coverage Dependabot Status Dependencies NPM Downloads Semantic-Release Gardener

Lightweight SDK to access Datadog API

Install

Install with npm:

$ npm install --save datadog-light

Usage

import Datadog from 'datadog-light';

const dd = Datadog('DATADOG_API_KEY');

dd.DistributionMetric.enqueue('metric.name', [new Date() / 1]);
dd.DistributionMetric.flush();

All input is validated using Joi.

Functions

Constructor (API_KEY, { tags: Array = [] })

Initialize this sdk with a Datadog api key. Provided tags are sent with all metrics without having to specify them again.

DistributionMetric

enqueue(metric: String, Array[Unix] | Object(Unix: Count), { tags: Array = [] })

Enqueue distribution metric counts

flush(): Promise

Flush all metric events currently enqueued.

Why does this package exist?

This package was built to be used in serverless environments where state is hard to come by. Convenient when e.g. tracking certain actions within an AWS Lambda function.

Package Sidebar

Install

npm i datadog-light

Weekly Downloads

2

Version

4.0.0

License

MIT

Unpacked Size

7.66 kB

Total Files

4

Last publish

Collaborators

  • simlu