All Projects → vthiery → Cpp Statsd Client

vthiery / Cpp Statsd Client

Licence: mit
A header-only StatsD client implemented in C++

Programming Languages

cpp17
186 projects

Labels

Projects that are alternatives of or similar to Cpp Statsd Client

Pirate
Realtime metrics server written in Go
Stars: ✭ 11 (-67.65%)
Mutual labels:  metrics
Ruby Gem Downloads Badge
Clean and simple gem downloads count badge, courtesy of http://shields.io/. You can checkout the application directly at the following URL:
Stars: ✭ 29 (-14.71%)
Mutual labels:  metrics
Nginx Lua Prometheus
Prometheus metric library for Nginx written in Lua
Stars: ✭ 964 (+2735.29%)
Mutual labels:  metrics
Analytics
Simple, open-source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.
Stars: ✭ 9,469 (+27750%)
Mutual labels:  metrics
Sensu Plugins Network Checks
This plugin provides native network instrumentation for monitoring and metrics collection, including: hardware, TCP response, RBLs, whois, port status, and more.
Stars: ✭ 28 (-17.65%)
Mutual labels:  metrics
Iperf3 exporter
Simple server that probes iPerf3 endpoints and exports results via HTTP for Prometheus consumption
Stars: ✭ 30 (-11.76%)
Mutual labels:  metrics
Metrics Jvm Extras
A set of additional metrics complementing Dropwizards metrics-jvm.
Stars: ✭ 10 (-70.59%)
Mutual labels:  metrics
Core
Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.
Stars: ✭ 34 (+0%)
Mutual labels:  metrics
Prometheus Net
.NET library to instrument your code with Prometheus metrics
Stars: ✭ 944 (+2676.47%)
Mutual labels:  metrics
Go Grpc Prometheus
Prometheus monitoring for your gRPC Go servers.
Stars: ✭ 965 (+2738.24%)
Mutual labels:  metrics
Uncertainty Toolbox
A python toolbox for predictive uncertainty quantification, calibration, metrics, and visualization
Stars: ✭ 880 (+2488.24%)
Mutual labels:  metrics
Vsphere2metrics
VMware vSphere Performance Metrics Integration with Graphite & InfluxDB
Stars: ✭ 28 (-17.65%)
Mutual labels:  metrics
Ipsec exporter
Prometheus exporter for IPsec metrics.
Stars: ✭ 30 (-11.76%)
Mutual labels:  metrics
Appmetrics
Node Application Metrics provides a foundational infrastructure for collecting resource and performance monitoring data for Node.js-based applications.
Stars: ✭ 864 (+2441.18%)
Mutual labels:  metrics
Iota Prom Exporter
Iota Exporter for Prometheus Metrics
Stars: ✭ 33 (-2.94%)
Mutual labels:  metrics
Gtm
Simple, seamless, lightweight time tracking for Git
Stars: ✭ 857 (+2420.59%)
Mutual labels:  metrics
Unifiedmetrics
Fully-featured metrics collection agent for Minecraft servers. Supports Prometheus and InfluxDB. Dashboard included out-of-box.
Stars: ✭ 29 (-14.71%)
Mutual labels:  metrics
Absinthe Metrics
Pluggable metrics for Absinthe based GraphQL backends
Stars: ✭ 34 (+0%)
Mutual labels:  metrics
I Codecnes
i-Code CNES is a static code analysis tool to help developpers write code compliant with CNES coding rules.
Stars: ✭ 33 (-2.94%)
Mutual labels:  metrics
Pgwatch2
PostgreSQL metrics monitor/dashboard
Stars: ✭ 960 (+2723.53%)
Mutual labels:  metrics

C++ StatsD Client

logo

Download Build Status Github Issues Average time to resolve an issue

A header-only StatsD client implemented in C++. The client allows:

  • batching,
  • change of configuration at runtime,
  • user-defined frequency rate.

Install and Test

Makefile

In order to install the header files and/or run the tests, simply use the Makefile and execute

make install

and

make test

Conan

If you are using Conan to manage your dependencies, merely add statsdclient/[email protected]/stable to your conanfile.py's requires, where x.y.z is the release version you want to use. Please file issues here if you experience problems with the packages. You can also directly download the latest version here.

Usage

Example

A simple example of how to use the client:

#include "StatsdClient.hpp"
using namespace Statsd;

int main()
{
    // Define the client on localhost, with port 8080, using a prefix and a batching size of 20 bytes
    StatsdClient client{ "127.0.0.1", 8080, "myPrefix.", 20 };

    // Increment the metric "coco"
    client.increment("coco");

    // Decrement the metric "kiki"
    client.decrement("kiki");

    // Adjusts "toto" by +3
    client.count("toto", 2, 0.1f);

    // Record a gauge "titi" to 3
    client.gauge("titi", 3);

    // Record a timing of 2ms for "myTiming"
    client.timing("myTiming", 2, 0.1f);

    // Send a metric explicitly
    client.send("tutu", 4, "c", 2.0f);
}

Configuration

The configuration of the client must be input when one instantiates it. Nevertheless, the API allows the configuration ot change afterwards. For example, one can do the following:

#include "StatsdClient.hpp"
using namespace Statsd;

int main()
{
    // Define the client on localhost, with port 8080, using a prefix and a batching size of 20 bytes
    StatsdClient client{ "127.0.0.1", 8080, "myPrefix.", 20 };

    client.increment("coco");

    // Set a new configuration, using a different port and a different prefix
    client.setConfig("127.0.0.1", 8000, "anotherPrefix.");

    client.decrement("kiki");
}

The batchsize is the only parameter that cannot be changed for the time being.

Batching

The client supports batching of the metrics:

  • the unit of the batching parameter is bytes,
  • it is optional and not setting it will result in an immediate send of any metrics,

If set, the UDP sender will spawn a thread sending the metrics to the server every 1 second by aggregates. The aggregation logic is as follows:

  • if the last message has already reached the batching limit, add a new element in a message queue;
  • otherwise, append the message to the last one, separated by a \n.

Frequency rate

When sending a metric, a frequency rate can be set in order to limit the metrics' sampling. By default, the frequency rate is set to one and won't affect the sampling. If set to a value epsilon (0.0001 for the time being) close to one, the sampling is not affected either.

If the frequency rate is set and epsilon different from one, the sending will be rejected randomly (the higher the frequency rate, the lower the probability of rejection).

License

This library is under MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].