Skip to main content

HTTP metrics for a tornado application

Project description

https://travis-ci.org/globocom/tornado-prometheus.svg?branch=master

HTTP metrics for a tornado application

Installing

pip install tornado-prometheus

Usage

from tornado.web import Application, RequestHandler
from tornado.ioloop import IOLoop

from tornado_prometheus import PrometheusMixIn, MetricsHandler

class SampleApp(PrometheusMixIn, Application):
    pass

if __name__ == '__main__':
  app =  SampleApp([
      (r"/metrics", MetricsHandler),
  ])

  app.listen(8888)
  IOLoop.current().start()

Example output for metric route

# HELP tornado_http_request_duration_seconds HTTP request duration in seconds
# TYPE tornado_http_request_duration_seconds histogram
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="0.01",method="GET"} 0.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="0.05",method="GET"} 0.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="0.1",method="GET"} 1.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="0.5",method="GET"} 1.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="0.75",method="GET"} 1.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="1.0",method="GET"} 1.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="2.5",method="GET"} 2.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="5.0",method="GET"} 2.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="7.5",method="GET"} 2.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="10.0",method="GET"} 2.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="15.0",method="GET"} 2.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="20.0",method="GET"} 2.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="30.0",method="GET"} 2.0
tornado_http_request_duration_seconds_bucket{handler="StatusHandler",le="+Inf",method="GET"} 2.0

# HELP tornado_http_requests_total Total of HTTP requests processed
# TYPE tornado_http_requests_total counter
tornado_http_requests_total{handler="StatusHandler",method="GET",status="2xx"} 2.0

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

tornado-prometheus-0.1.2.tar.gz (2.7 kB view details)

Uploaded Source

File details

Details for the file tornado-prometheus-0.1.2.tar.gz.

File metadata

  • Download URL: tornado-prometheus-0.1.2.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for tornado-prometheus-0.1.2.tar.gz
Algorithm Hash digest
SHA256 873d8189acffb991405f1ff8f8a2fcef4ab04aa6caffcc4890c634b78a186385
MD5 8fb1aa23bb4bb49f6deefdd0c914625b
BLAKE2b-256 1cecada47c09fc4013ecab86df7254b7572ff4dcb91c518ae5b4704a3ccde21f

See more details on using hashes here.

Supported by

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