@bbc/http-transport-statsd

    2.0.2 • 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
    

    Install

    npm i @bbc/http-transport-statsd

    DownloadsWeekly Downloads

    300

    Version

    2.0.2

    License

    Apache-2.0

    Unpacked Size

    9.76 kB

    Total Files

    11

    Last publish

    Collaborators

    • johnnewman
    • ibl
    • niklasr
    • hjerling
    • simontanner
    • jessicabergsbbc
    • simongregory
    • andymsukbbc
    • tomfranciswinnington
    • magdalena.glanc
    • tonymcbeth
    • zdhz