Asynchronous client for carbon
Project Links
Meta
Author: Dmitry Orlov
Requires Python: >=3.11
Classifiers
Development Status
- 5 - Production/Stable
Framework
- AsyncIO
Intended Audience
- Developers
- System Administrators
Natural Language
- English
Operating System
- MacOS
- POSIX
- POSIX :: Linux
Programming Language
- Python
- Python :: 3
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
- Python :: 3.15
- Python :: Free Threading :: 3 - Stable
- Python :: Implementation :: CPython
Topic
- Software Development :: Libraries :: Python Modules
- System :: Monitoring
Typing
- Typed
Client for feeding data to graphite. The package requires Python 3.11 or newer, and has no runtime dependencies.
Installation
pip install aiocarbon
Example
Counter example:
import asyncio
import aiocarbon
async def main():
client = aiocarbon.setup(
host="127.0.0.1", port=2003, client_class=aiocarbon.TCPClient
)
# Send the collected metrics every second.
sender = asyncio.create_task(client.run())
for _ in range(1000):
with aiocarbon.Counter("foo"):
await asyncio.sleep(0.1)
# Send the rest of the metrics before the exit.
await client.send()
sender.cancel()
if __name__ == "__main__":
asyncio.run(main())
Clients
aiocarbon.TCPClient sends metrics in the plaintext protocol over TCP.
aiocarbon.UDPClient sends metrics in the plaintext protocol over UDP.
aiocarbon.PickleClient sends metrics in the pickle protocol, port 2004.
Each client aggregates the metrics in a storage. TotalStorage is the default one, and it adds up the values of one metric in one second. RawStorage keeps every sample.
Development
The project uses uv for the environment, and ruff, mypy and pytest for the checks:
uv sync
uv run ruff check .
uv run mypy
uv run pytest
0.17.0
Oct 24, 2026
0.16.0
Oct 24, 2026
0.15.3
Sep 21, 2023
0.15.2
May 27, 2020
0.15.1
Apr 02, 2019
0.15.0
Mar 28, 2019
0.14.2
Mar 22, 2019
0.14.1
Mar 18, 2019
0.14.0
Feb 19, 2019
0.12.1
Feb 15, 2019
0.12.0
Feb 13, 2019
0.11.0
Nov 26, 2018
0.10.1
Nov 14, 2018
0.9.1
Jun 30, 2018
0.9.0
Jun 29, 2018
0.3.0
Jun 13, 2018
0.2.0
Feb 28, 2018
0.1.2
Jan 29, 2018
0.1.0
Jan 28, 2018
Wheel compatibility matrix
Files in release
No dependencies