SkillAgentSearch skills...

Cystatsd

python encoder for statsd in c++/cython

Install / Use

/learn @scivey/Cystatsd
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

cystatsd

A c++/cython encoder for batches of statsd metrics.

The main class is cystatsd.MetricCollector, which accepts metrics and converts them into packets for batch submission to a StatsD server. Target packet size is configurable.

This doesn't make any network calls; it just does encoding.

This also doesn't currently do anything clever with stats, like collapsing submissions for the same counter. There's a potential for more optimization there.

Install

It requires Cython to build:

pip install cython

Then:

pip install cystatsd

Example

from cystatsd import MetricCollector
collector = MetricCollector()
collector.push_timer("some_timer", 200)
collector.push_counter("dogs", 2)
collector.push_counter("fish", 5, rate=0.1)
result = collector.flush()
print(result)

Outputs:

[b"some_timer:200|ms\ndogs:2|c\nfish:5|c|@0.10"]

Contributors

  • @leftys added support for set types, gauge deltas and counter decrements. (1.1.0)
  • @scivey initial implementation

License

MIT

Related Skills

View on GitHub
GitHub Stars6
CategoryDevelopment
Updated1y ago
Forks7

Languages

Python

Security Score

55/100

Audited on Nov 26, 2024

No findings