🚧 WIP 🚧
This is an implementation of a Statsd client for Python.
For usage see documentation.
I was looking for a generic Statsd client with tags support to interact with various statsd servers for an application that I distribute but don't operate, so there could be high variability in the statsd implementations used (I know one uses Telegraf and InfluxDB and one Datadog and they both have different tag formats).
pystatsdexists and works, but it intentionally does not support tags.- The docs point to an alternative supporting tags, but at the time of writing the repository leads to a 404 for me.
- There a are a few more available on PyPi that likely work, but most of the ones I've checked haven't been updated in a while, are not documented and don't support tags.
datadogpycould be a solid solution, but I'd rather avoind pulling the full Datadog client library in projects where I don't use datadog. It also exposes some non standard metric types, and while I can always not use them I'd prefer a generic solution (ignoring tags which, while not standardized, are supported by most statsd servers).
You only need nox installed to run most development
tasks. All tasks are defined in noxfile.py and will run in
individual environments.
Some tasks are defined against multiple python version which are expected to be
available in $PATH.
nox -lto see all tasksnox -e <TASK>to run an individual tasknox --python <VERSION> ...to run against a specific python version
Code is expected to be formatted with ruff and isort. You can run the
formatters with nox -e fmt.
All dependencies are locked using uv. You
can recompile all of them or update specific packages by using:
nox -e deps -- <UV_ARGS> ...
To run all the tooling directly in a manually managed virtualenv or in your IDE, you can install all development dependencies through requirements-dev.txt:
$ pip install -r requirements-dev.txt
After which all tools (ruff, isort, pytest, etc.) will be available.
If this suits your workflow, you can install the pre-commit configuration using pre-commit install which will automatically check some things before allowing you to commit (pre-commit is included in the dev dependencies).