mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-19 16:03:00 +00:00

- `@gen.coroutine def` -> `async def` - `yield future` -> `await future` needs some fine tuning, but this is the big one
17 lines
415 B
Python
17 lines
415 B
Python
from prometheus_client import REGISTRY, CONTENT_TYPE_LATEST, generate_latest
|
|
from tornado import gen
|
|
|
|
from .base import BaseHandler
|
|
|
|
class MetricsHandler(BaseHandler):
|
|
"""
|
|
Handler to serve Prometheus metrics
|
|
"""
|
|
async def get(self):
|
|
self.set_header('Content-Type', CONTENT_TYPE_LATEST)
|
|
self.write(generate_latest(REGISTRY))
|
|
|
|
default_handlers = [
|
|
(r'/metrics$', MetricsHandler)
|
|
]
|