Skip to main content

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prometheus_tornado_instrumentator-0.1.2.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file prometheus_tornado_instrumentator-0.1.2.tar.gz.

File metadata

File hashes

Hashes for prometheus_tornado_instrumentator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 35b55ed14a0794985beae1545bd9d8be128ccb13b624d568f71dd5d0c3dffaa8
MD5 b9f4b70a44cbeff9f3f0dd1fe6399284
BLAKE2b-256 4eae8f5bb33ca68d847319efa51ed45871f8723e30c358acf1bc4b9b374e4c58

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_tornado_instrumentator-0.1.2.tar.gz:

Publisher: release.yml on JunwooZ/prometheus-tornado-instrumentator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prometheus_tornado_instrumentator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for prometheus_tornado_instrumentator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5a67eca82e5d70a5eb61b1697b1537b8dd7128b2f84aa5e6b48c09867c0f66db
MD5 ee15693220da30fda3b1ff5a9d9d6ea2
BLAKE2b-256 adce335be3869d7feebe138fda910cbd10152856475af8dacce40ea1d3b74346

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_tornado_instrumentator-0.1.2-py3-none-any.whl:

Publisher: release.yml on JunwooZ/prometheus-tornado-instrumentator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page