metco

Crates.iometco
lib.rsmetco
version0.5.0
created_at2024-07-25 12:21:37.777299+00
updated_at2025-08-31 20:24:48.907679+00
descriptionMetrics Collector inspired by StatsD.
homepagehttps://github.com/zlikavac32/metco
repositoryhttps://github.com/zlikavac32/metco
max_upload_size
id1314922
size121,753
Marijan Ć uflaj (zlikavac32)

documentation

README

MetCo

Metrics Collector inspired by StatsD.

Additional/removed features compared to StatsD are:

  • support for additional time units like seconds, microseconds and nanoseconds,
  • setting gauge to negative value without first setting it to zero,
  • sets are not supported and
  • no sampling interval.

Disclaimer

I'm still learning Rust, and although I run this in production for two of my clients without any issue, I can not advise you to do the same until you've checked my source code. I believe it's quite stable, but me being a professional I can not guarantee that this could not cause some issue for you.

That being said, I'm looking forward to more experienced Rust developers suggesting improvements and helping me to get better in Rust.

Also, I do plan to keep this as simple as possible because I like Linux philosophy "Do one thing and do it well".

Protocol

Protocol is simple text based protocol. Metrics are in form of name|type|value and optionally some additional fields separated by | depending on metric type.

Metric name is any valid UTF-8 sequence of at least one byte. It's backends job to sanitize name if needed. Special characters in name part are |, ; and \ and if used, must be escaped using \.

Each metric can have associated tags that are used to fine tune aggregations. Tags are a part of name in format name=value separated by ; without a trailing ;. If = or \ is used as a part of tag name, it must be escaped using \. If ;, \ or | is used as a part of tag value, it must be escaped using \.

Assigning two tags to a metric would look like name;tag1=value1;tag2=value2.

Type can be any of c, t or g.

Value format and optional additional fields are defined by the metric type.

Multiple metrics can be sent separated by \n. Data parsed before a parsing error occurs is still considered valid, but remaining data is not parsed.

Counters

Value is always a positive natural number.

abc|c|1234

Timers

By default resolution is milliseconds.

Value is always a positive natural number

abc|t|1234

Supported resolutions are s, ms, us and ns.

abc|t|1234|ms

Gauges

Value is a natural number.

abc|g|123
abc|g|-123

Instead of setting value, it can be updated by incrementing/decrementing by a specified amount.

abc|g|+=123
abc|g|-=123

Gauge can be removed by sending x as a value.

abc|g|x
Commit count: 48

cargo fmt