Have ideas to improve npm?Join in the discussion! »

    @shopify/statsd
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.4 • Public • Published

    @shopify/statsd

    Build Status Build Status License: MIT npm version

    An opinionated StatsD client for Shopify Node.js servers and other StatsD utilities.

    Installation

    $ yarn add @shopify/statsd

    Usage

    Client

    Create a StatsD client with the following:

    import {StatsDClient} from '@shopify/statsd';
    
    const statsdClient = new StatsDClient({
      host: 'some-statsd-host.com',
      port: '8125',
      prefix: 'AppName',
    });

    distribution

    Tracks the statistical distribution of a set of values across your infrastructure.

    statsdClient.distribution(
      'navigationComplete',
      100, // in milliseconds
      ['navigation', 'complete', 'performance'], // user-defined tags to go with the data
    );

    increment

    Increments a stat by 1.

    statsdClient.increment(
      'myCounter',
      ['navigation', 'complete', 'performance'], // user-defined tags to go with the data
    );

    close

    Close statsd client. This will ensure all stats are sent and stop statsd from doing anything more.

    statsdClient.close();

    Keywords

    none

    Install

    npm i @shopify/statsd

    DownloadsWeekly Downloads

    35,739

    Version

    2.1.4

    License

    MIT

    Unpacked Size

    29.1 kB

    Total Files

    21

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar