0.2.8 • Published 4 months ago

simple-graphite-client v0.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

simple-graphite-client

npm Tests License: MIT

This is a compact TypeScript library designed for transmitting data to a Graphite metrics server (Carbon). It draws significant inspiration from graphyte, a Python library. Currently, this library is simpler in comparison, as additional complexity wasn't required at this stage.

npm install simple-graphite-client

Usage

You first have to define the Graphite client:

import  Sender  from "simple-graphite-client";

const client = new Sender({
     host: "http://graphite.example.org"
});
await client.send({
    metric: "foo.bar",
    value: 42
});

If you want to send tagged metrics, the usage is as follows:

await client.send({
    metric: "foo.bar",
    value: 42,
    tags: {"ding": "dong"}
});

If you want to send via UDP instead of TCP, just change protocol:'udp' to Sender() call.

License

Licensed under the MIT license.

Development

NVM - Node Version Manager

I recommend you to use nvm to download the current version of node.js used on the project.

To download the nvm run the follow command:

You can look for more information on the nvm repository

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

Once you have installed nvm and it's working, you can run the follow to install the correct version of node.js:

Make sure you are on the current path of the project, where the .nvmrc file is located

nvm install
nvm use

Installing packages

Once you have installed the current version of Node.js, NPM you can do it running the follow:

Make sure you are using the current context of Node.js and NPM.

npm install

Test Dependencies

To run the tests you'll need to have tcp-receiver running on port 9950 and 9528. To do that, run:

docker run -d -p 9950:9950 -p 9528:9528 cameritelabs/tcp-receiver:latest

Once you have the container running you can run:

# to run the tests
npm run test

# to run the tests and generate coverage report
npm run coverage
0.2.8

4 months ago

0.2.7

7 months ago

0.2.6

7 months ago

0.2.5

7 months ago

0.2.4

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago