Instrument Tornado applications with Prometheus metrics.
Project description
Prometheus Tornado Instrumentator
A Tornado-focused Prometheus instrumentation library inspired by
trallnag/prometheus-fastapi-instrumentator.
The goal is to provide a Tornado-native user experience:
from prometheus_tornado_instrumentator import Instrumentator
Instrumentator().instrument(app).expose(app)
Installation
From PyPI:
pip install prometheus-tornado-instrumentator
From a local checkout:
uv pip install -e .
Quick Start
from tornado.web import Application, RequestHandler
from prometheus_tornado_instrumentator import Instrumentator
class HelloHandler(RequestHandler):
def get(self):
self.write({"message": "hello"})
app = Application([(r"/hello", HelloHandler)])
Instrumentator().instrument(app).expose(app)
This instruments registered Tornado handlers and exposes Prometheus scrape output
at /metrics by default.
Features
- Default Prometheus metrics for request count, request size, response size, and latency.
- Custom sync or async instrumentation functions.
- Custom metric namespace and subsystem.
- Custom Prometheus
CollectorRegistry. - Gzip support for metrics output.
- Regex-based handler exclusions.
- Dynamic route instrumentation for handlers added with
Application.add_handlers(). - Prometheus client multiprocess support through
PROMETHEUS_MULTIPROC_DIR.
Scope
This package instruments Tornado HTTP RequestHandler routes.
It does not provide FastAPI, Starlette, ASGI mounted-app, included-router, or websocket route semantics. See docs/parity.md for the upstream semantic-parity notes.
Documentation
Development
Use uv for local development:
uv sync --extra dev
uv run --extra dev python -m pytest -q
The current verified baseline is 105 passing tests.
License
This project is licensed under the ISC License. See LICENSE.
This project is inspired by
trallnag/prometheus-fastapi-instrumentator,
which is also licensed under the ISC License. See NOTICE for the
initial upstream baseline.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prometheus_tornado_instrumentator-0.1.0.tar.gz.
File metadata
- Download URL: prometheus_tornado_instrumentator-0.1.0.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fb9a1b333bbd93b9e2ede739d29bbf332cf3107f923a94c41081997dea8d72d
|
|
| MD5 |
e7f8f69ba5e3a04a072a75aa1fdcd743
|
|
| BLAKE2b-256 |
4ca0f8b9605c0553ad096ceaa337532551cf42a5ad97f7462a1b79d77966f1fd
|
File details
Details for the file prometheus_tornado_instrumentator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prometheus_tornado_instrumentator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89a541494a0465bc637d5b1a9253145ef11a1f1125d7449714ef73500a70cf4f
|
|
| MD5 |
50ea64875c2f39e95205d8668b8609c4
|
|
| BLAKE2b-256 |
2e869b71ea038cc9bd19d1cca67391307cf13482a4446cd9d2c46a1bfe78bd01
|