2.0.6 • Published 7 months ago

@bbc/http-transport-statsd v2.0.6

Weekly downloads
250
License
Apache-2.0
Repository
github
Last release
7 months ago

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:

NameTypeDescription
{name}.requestsCounterIncremented every time a request is made
{name}.responses.{code}CounterIncremented every time a response is received
{name}.request_errorsCounterIncremented every time a request fails (timeout, DNS lookup fails etc.)
{name}.response_timeTimerMeasures of the response time in milliseconds across all requests
{name}.retriesCounterIncremented every time the request retries
{name}.attemptsTimerMeasures 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
2.0.3

7 months ago

2.0.5

7 months ago

2.0.4

7 months ago

2.0.6

7 months ago

2.0.2

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago

0.0.1

7 years ago