Monitoring and analytics for Tornado applications.
Project description
Tornado Analytics
A lightweight API analytics solution, complete with a dashboard.
Getting Started
1. Generate a new API key
Head to https://my-api-analytics.vercel.app/generate to generate your unique API key with a single click. This key is used to monitor your specific API, so keep it secret! It's also required in order to view your APIs analytics dashboard.
2. Add middleware to your API
Add our lightweight middleware to your API. Almost all processing is handled by our servers so there should be virtually no impact on your APIs performance.
pip install api-analytics
Modify your handler to inherit from Analytics
. Create a __init__()
method on your handler, passing along the application and response along with your unique API key.
import asyncio
from tornado.web import Application
from api_analytics.tornado import Analytics
# Inherit from middleware class
class MainHandler(Analytics):
def __init__(self, app, res):
super().__init__(app, res, <api_key>) # Pass api key to super
def get(self):
self.write({'message': 'Hello World!'})
def make_app():
return Application([
(r"/", MainHandler),
])
async def main():
app = make_app()
app.listen(8080)
await asyncio.Event().wait()
if __name__ == "__main__":
asyncio.run(main())
3. View your analytics
Your API will log requests on all valid routes. Head over to https://my-api-analytics.vercel.app/dashboard and paste in your API key to view your dashboard.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tornado_analytics-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e64d860961047cfe17122bb0f96d01aab0d36b9e3efb88885eab232d8dc0ab58 |
|
MD5 | 6442e7fc06c873c0ccf07b821ad6581d |
|
BLAKE2b-256 | 385e0b1f006b33fc6565e9efabf5c1348e45b143b652dc31d56aded382281ea1 |