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.1.tar.gz (37.7 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.1.tar.gz.

File metadata

File hashes

Hashes for prometheus_tornado_instrumentator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ef9197766fd4a0e6931a2beb494140ae3d665631a1be0fd493596b54f132d1a7
MD5 c6ac0bb2c64b027589b9ba06770b6d1d
BLAKE2b-256 0b1d0edaa612d8c6aee59ede489a9521219e9d9b7b106663e1e8db2e165fcf9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_tornado_instrumentator-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for prometheus_tornado_instrumentator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 accb2511e93f3c44d317b1e20fb715457bea92bddcd4770331d57b77463fc005
MD5 4cc07aa9927ccccc42d973aa97048d9e
BLAKE2b-256 15bbf79642c73b634c734b936bcbc41cdcb2262332a9f5beba7458fcc53d7eed

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_tornado_instrumentator-0.1.1-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