Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saabeilin/sanic-statsd
A simple statsd plugin for Sanic
https://github.com/saabeilin/sanic-statsd
datadog metrics sanic statsd
Last synced: 30 days ago
JSON representation
A simple statsd plugin for Sanic
- Host: GitHub
- URL: https://github.com/saabeilin/sanic-statsd
- Owner: saabeilin
- License: mit
- Created: 2018-03-08T07:07:32.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-15T17:54:26.000Z (about 2 years ago)
- Last Synced: 2024-11-07T02:42:40.936Z (about 1 month ago)
- Topics: datadog, metrics, sanic, statsd
- Language: Python
- Size: 11.7 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sanic - Sanic-Statsd
README
Gotta get get some metrics!
===========================We've gotta go fast, but sure we want to measure _how_ fast, right?
The common way to get the metrics is collect them via StatsD protocol
to Grafana or DataDog. It's relatively easy to measure every endpoint
by decorating it with `@statsd.timed()`, but why not automate it?So once you've configured your statsd client, just pass it to this
extension and get the generic metrics automagically.## Usage example
```python
from sanic import Sanic
from sanic.response import textfrom sanic_statsd import SanicStatsD
from yourapp.stats import configured_statsd_client as statsd
app = Sanic()
SanicStatsD(app, statsd=statsd, tags=['app:{}'.format(__name__)])@app.route("/")
async def index(request):
return text("Ok")if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000, debug=True)
```And that's, basically, it!
-----
TODO:
[ ] Document init parameters and implement examples of using of
[ ] Implement support for statsd