@bbc/http-transport-statsd

2.0.6 • Public • Published

NPM downloads npm license github-issues stars forks

http-transport-statsd

Metrics can be sent to StatsD by providing an instance of the node-statsd client:

The following metrics are sent from each client:

Name Type Description
{name}.requests Counter Incremented every time a request is made
{name}.responses.{code} Counter Incremented every time a response is received
{name}.request_errors Counter Incremented every time a request fails (timeout, DNS lookup fails etc.)
{name}.response_time Timer Measures of the response time in milliseconds across all requests
{name}.retries Counter Incremented every time the request retries
{name}.attempts Timer Measures the number of attempts

Installation

npm install --save @bbc/http-transport-statsd

Usage

const url = 'http://example.com/';
const HttpTransport = require('@bbc/http-transport');
const sendStats = require('@bbc/http-transport-statsd');
const StatsD = require('node-statsd');
const statsD = new StatsD();

const body = await HttpTransport.createClient()
      .use(sendStats(statsd)) // send stats for this request
      .get(url)
      .asBody();
console.log(body);

Test

npm test

To generate a test coverage report:

npm run coverage

Package Sidebar

Install

npm i @bbc/http-transport-statsd

Weekly Downloads

988

Version

2.0.6

License

Apache-2.0

Unpacked Size

9 kB

Total Files

9

Last publish

Collaborators

  • alexshelley
  • oliviadrury
  • brotherkaif
  • kieranjoyce
  • monsai
  • rosemcnally
  • felixmercermoss
  • katyasa
  • dwalker487
  • amitsavant
  • remotecharms
  • npmbs
  • vaughr03
  • iuketaylor
  • jamiebower185
  • benjwheeler
  • onlyonehas
  • drrobharper
  • johnnewman
  • ibl
  • simontanner
  • simongregory
  • tonymcbeth