Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds more docs #7

Merged
merged 6 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
strategy:
matrix:
python-version:
- "3.12"
- "3.11"
- "3.10"
fail-fast: false

steps:
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# asyncstatsd

[![CI](https://github.com/b1r3k/asyncstatsd/actions/workflows/ci.yaml/badge.svg)](https://github.com/b1r3k/asyncstatsd/actions/workflows/ci.yaml)

Asyncio compatible [StatsD](https://github.com/b/statsd_spec) client for sending metrics to statsd server. Unlike [jsocol/pystatsd](https://github.com/jsocol/pystatsd/tree/main?tab=readme-ov-file) it supports DataDog tagged metrics out of the box. I wanted to keep it simple - no more wondering if dependency is safe to include because of threads, queues, mutexes. It should be easy to extend just as adding tags support was easy to implement.

## Installation

$ pip install asyncstatsd
Expand All @@ -24,7 +28,6 @@ async def bar(statsd):
with statsd.timer('some.timer'):
await asyncio.sleep(1)


async def main():
client = StatsdClient('localhost', 8125)
await client.connect()
Expand Down Expand Up @@ -93,3 +96,17 @@ async def main():
foo()
await bar()
```

## Additional notes

By default, `UDPClient` uses max UDP packet size of 512 bytes in order to make sure that it's not going to be fragmented. You can adjust this value by following advice from [statsd spec](https://github.com/statsd/statsd/blob/master/docs/metric_types.md)

> Fast Ethernet (1432) - This is most likely for Intranets.
> Gigabit Ethernet (8932) - Jumbo frames can make use of this feature much more efficient.
> Commodity Internet (512) - If you are routing over the internet a value in this range will be reasonable. You might be able to go higher, but you are at the mercy of all the hops in your route.
> (These payload numbers take into account the maximum IP + UDP header sizes)

## References

1. [statsd/docs/metric_types.md](https://github.com/statsd/statsd/blob/master/docs/metric_types.md)
2. [jsocol/pystatsd: A Python client for statsd](https://github.com/jsocol/pystatsd/tree/main?tab=readme-ov-file) does not support DataDog tags, see https://statsd.readthedocs.io/en/stable/tags.html?highlight=datadog#unsupported-tagging-metrics and [recommended alternative](https://pypi.org/project/statsd-tags/) got deleted from github while it's still available on pypi.
Loading
Loading