Cystatsd
python encoder for statsd in c++/cython
Install / Use
/learn @scivey/CystatsdREADME
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
node-connect
352.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
