File: metrics.py

package info (click to toggle)
jupyter-notebook 6.4.13-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,860 kB
  • sloc: javascript: 20,765; python: 15,658; makefile: 255; sh: 160
file content (27 lines) | stat: -rw-r--r-- 676 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Prometheus metrics exported by Jupyter Notebook Server

Read https://prometheus.io/docs/practices/naming/ for naming
conventions for metrics & labels.
"""


from prometheus_client import Histogram, Gauge


HTTP_REQUEST_DURATION_SECONDS = Histogram(
    'http_request_duration_seconds',
    'duration in seconds for all HTTP requests',
    ['method', 'handler', 'status_code'],
)

TERMINAL_CURRENTLY_RUNNING_TOTAL = Gauge(
    'terminal_currently_running_total',
    'counter for how many terminals are running',
)

KERNEL_CURRENTLY_RUNNING_TOTAL = Gauge(
    'kernel_currently_running_total',
    'counter for how many kernels are running labeled by type',
    ['type']
)