The `statsd-python` library (version 0.6.1) provides a simple Python client for sending metrics to a StatsD server via UDP. It supports incrementing counters, setting gauges, and recording timings. The library has a stable API and sees infrequent updates, making it a reliable choice for basic StatsD integration.
pip install statsd-pythonVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `StatsClient` and send common metric types: counters (`incr`), gauges (`gauge`), and timings (`timing`). It also shows how to use a sample rate for counters.
StatsD uses UDP, a connectionless protocol. Packets are 'fire and forget' and provide no delivery guarantees. Network issues, firewalls, or an unavailable StatsD server will cause silent failures from the client's perspective. Ensure the StatsD server is running, reachable, and listening on the configured host/port. Check firewalls. Use `tcpdump` or Wireshark to verify UDP packets are leaving the client machine and arriving at the server.
There are multiple Python libraries with similar names (`statsd`, `pystatsd`). This registry entry refers to `statsd-python` by lirsacc (`pip install statsd-python`). An older, now archived, library (often referred to as `pystatsd` or `statsd` by jsocol) had a different API. Verify you have installed `statsd-python` (`pip show statsd-python`) and are using its specific API (e.g., `import statsd` then `statsd.StatsClient`). If you encounter unexpected API errors, check for other `statsd` installations (`pip freeze | grep statsd`) and uninstall conflicting ones.
No dependency data recorded yet.