20 releases
Uses old Rust 2015
0.5.3 | Apr 24, 2020 |
---|---|
0.5.1 | Feb 10, 2017 |
0.4.0 | Nov 19, 2016 |
0.3.5 | Jul 3, 2016 |
0.2.3 | Mar 2, 2016 |
#11 in #log-line
76 downloads per month
44KB
961 lines
Metrics Distributor
Metrics distributor is a Rust library for streamlining the creation and operation of metrics aggregation services. You can use it to build a simple, multi-protocol collection and forwarding service for your metrics.
Distributors can collect over a number of protocols and formats:
- HTTP POST requests:
LogDrainHandler
- Log drain (body is raw log lines)
- Heroku dyno performance metrics:
HerokuLogLineReader
- Standard metrics format:
StandardLogLineReader
- Heroku dyno performance metrics:
- Batch submission of arrays of metrics (currently WIP)
- urlencoded form
- JSON
- Standard metrics format
- Log drain (body is raw log lines)
- StatsD protocol:
- TCP connection:
StatsdTcpListener
- UDP datagrams:
StatsdUdpListener
- TCP connection:
They can then forward aggregated metrics over a number of protocols:
- HTTP POST in simple metrics format
- Datadog API:
DatadogForwarder
- Graphite plaintext
- StatsD
Building on macOS
The system OpenSSL on macOS is too outdated. To use the one installed by Homebrew, run the following commands before building:
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
export LDFLAGS=-L`brew --prefix openssl`/lib
Configuration
Distributor uses code as configuration. Rather than parsing a configuration format, you configure your service by composing collectors and forwarders. This means you get the added advantage of the powerful Rust compiler checking your "configuration" for correctness and that it's very easy to customize or create entirely new collections/forwarders.
See the examples/
folder for some common configurations:
http_server.rs
: Simple log drainstatsd_server.rs
: StatsD (UDP) server
It turns out that the number of lines needed to set up a few collectors and forwarders in code is almost exactly the same as you would need with YAML/TOML/etc.
License
Licensed under the 3-clause BSD license. See LICENSE for details.
Dependencies
~21MB
~413K SLoC