All Projects → markstory → rust-statsd

markstory / rust-statsd

Licence: MIT license
Statsd client implemented in Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rust-statsd

aiodogstatsd
An asyncio-based client for sending metrics to StatsD with support of DogStatsD extension
Stars: ✭ 26 (-48%)
Mutual labels:  statsd-client, statsd
dog-statsd
🐶 DataDog StatsD Client
Stars: ✭ 38 (-24%)
Mutual labels:  statsd-client, statsd
Go Statsd Client
statsd client for Go
Stars: ✭ 163 (+226%)
Mutual labels:  statsd
Statsite
C implementation of statsd
Stars: ✭ 1,791 (+3482%)
Mutual labels:  statsd
Promitor
Bringing Azure Monitor metrics where you need them.
Stars: ✭ 140 (+180%)
Mutual labels:  statsd
Trashed
Tell StatsD about request time, GC, objects and more. Latest Rails 4 and Ruby 2.1 support, and ancient Rails 2 and Ruby 1.8 support.
Stars: ✭ 188 (+276%)
Mutual labels:  statsd
docker grafana statsd elk
Docker repo for a general purpose graphing and logging container - includes graphite+carbon, grafana, statsd, elasticsearch, kibana, nginx, logstash indexer (currently using redis as an intermediary)
Stars: ✭ 19 (-62%)
Mutual labels:  statsd
perfmetrics
A library for sending software performance metrics from Python libraries and apps to statsd.
Stars: ✭ 26 (-48%)
Mutual labels:  statsd
ecs-container-exporter
AWS ECS side car that exports ECS container level docker stats metrics to Prometheus as well as publish it via Statsd.
Stars: ✭ 22 (-56%)
Mutual labels:  statsd
StatsN
A modern c# statsd client for .net core and .net 4.0+
Stars: ✭ 19 (-62%)
Mutual labels:  statsd-client
Netdata
Real-time performance monitoring, done right! https://www.netdata.cloud
Stars: ✭ 57,056 (+114012%)
Mutual labels:  statsd
Redis Timeseries
Future development of redis-timeseries is at github.com/RedisLabsModules/redis-timeseries.
Stars: ✭ 197 (+294%)
Mutual labels:  statsd
statsd.cr
A statsd client library for Crystal.
Stars: ✭ 32 (-36%)
Mutual labels:  statsd
Node Statsd Client
Node.js client for statsd
Stars: ✭ 170 (+240%)
Mutual labels:  statsd
fastify-metrics
📊 Fastify plugin that integrates metrics collection and dispatch to statsd
Stars: ✭ 62 (+24%)
Mutual labels:  statsd
glouton
Monitoring agent for servers, containers, and applications 🔬
Stars: ✭ 19 (-62%)
Mutual labels:  statsd
Datadog Go
go dogstatsd client library for datadog
Stars: ✭ 238 (+376%)
Mutual labels:  statsd
grafana-stack
Tiny docker images for graphite, grafana and statsdly
Stars: ✭ 28 (-44%)
Mutual labels:  statsd
monitored
A utility for monitoring services 🔍
Stars: ✭ 37 (-26%)
Mutual labels:  statsd
hapi-statsd
A hapi plugin for sending request round trip metrics to statsd
Stars: ✭ 29 (-42%)
Mutual labels:  statsd-client

Rust Statsd

Build Status

A StatsD client implementation of statsd in rust.

Using the client library

Add the statsd package as a dependency in your Cargo.toml file:

[dependencies]
statsd = "^0.13.1"

You need rustc >= 1.31.0 for statsd to work.

You can then get a client instance and start tracking metrics:

// Load the crate
extern crate statsd;

// Import the client object.
use statsd::Client;

// Get a client with the prefix of `myapp`. The host should be the
// IP:port of your statsd daemon.
let client = Client::new("127.0.0.1:8125", "myapp").unwrap();

Tracking Metrics

Once you've created a client, you can track timers and metrics:

// Increment a counter by 1
client.incr("some.counter");

// Decrement a counter by 1
client.decr("some.counter");

// Update a gauge
client.gauge("some.value", 12.0);

// Modify a counter by an arbitrary float.
client.count("some.counter", 511.0);

// Send a histogram value as a float.
client.histogram("some.histogram", 511.0);

Tracking Timers

Timers can be updated using timer() and time():

// Update a timer based on a calculation you've done.
client.timer("operation.duration", 13.4);

// Time a closure
client.time("operation.duration", || {
	// Do something expensive.
});

Pipeline

Multiple metrics can be sent to StatsD once using pipeline:

let mut pipe = client.pipeline():

// Increment a counter by 1
pipe.incr("some.counter");

// Decrement a counter by 1
pipe.decr("some.counter");

// Update a gauge
pipe.gauge("some.value", 12.0);

// Modify a counter by an arbitrary float.
pipe.count("some.counter", 511.0);

// Send a histogram value as a float.
pipe.histogram("some.histogram", 511.0);

// Set max UDP packet size if you wish, default is 512
pipe.set_max_udp_size(128);

// Send to StatsD
pipe.send(&client);

Pipelines are also helpful to make functions simpler to test, as you can pass a pipeline and be confident that no UDP packets will be sent.

License

Licenesed under the 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].