1.0.11 • Published 5 years ago

statsd-socket.io-backend v1.0.11

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

statsd-socket.io-backend

StatsD Socket.IO backend module. Will forward metrics data to Socket.IO client. The client is able to subscribe to metrics by StatsD statistics key.

Build Status David Status Dependabot Enabled

Installation

Simple way

To install the module you have to follow two step process:

  • npm install statsd-socket.io-backend from the folder where you checked out StatsD
  • Modify StatsD config file to have statsd-socket.io-backend backend enabled in the following way:

    {
      ...,
      "socketIoBackend": {
        "port": 8000
      },
      ...,
      "backends": [
        "statsd-socket.io-backend"
      ]
    }

StatsD Docker Image with enabled statsd-socket.io-backend

StatsD config.json:

{
  "port": 8125,
  "debug": true,
  "socketIoBackend": {
    "port": 8000
  },
  "flushInterval": 0,
  "backends": [
    "statsd-socket.io-backend"
  ]
}

StatsD Dockerfile:

FROM node:10.15.3

RUN git clone git://github.com/etsy/statsd.git /usr/local/src/statsd

# Important! you have to have a `config.json` file for StatsD in current folder
COPY config.json /etc/default/statsd.js

RUN cd /usr/local/src/statsd && npm install statsd-socket.io-backend

EXPOSE 8125/udp
EXPOSE 8126/tcp

CMD node /usr/local/src/statsd/stats.js /etc/default/statsd.js

Testing locally

You have to have Docker host up and running.

Set the following environment variables to your needs:

export DOCKER_HOST_IP=192.168.99.103
export STATSD_HOST=${DOCKER_HOST_IP}
export STATSD_PORT=8125
export SOCKET_PORT=8000 

Run the following commands:

docker build -t ilguzin/statsd-socket.io-backend .

docker run -itd -p ${STATSD_PORT}:${STATSD_PORT}/udp -p ${SOCKET_PORT}:${SOCKET_PORT} ilguzin/statsd-socket.io-backend

npm run test:ci
1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.3

5 years ago

1.0.5

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago