Uploaded Test files
This commit is contained in:
parent
f584ad9d97
commit
2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions
4
venv/Lib/site-packages/notebook/prometheus/__init__.py
Normal file
4
venv/Lib/site-packages/notebook/prometheus/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
"""
|
||||
A package containing all the functionality and
|
||||
configuration connected to the prometheus metrics
|
||||
"""
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
24
venv/Lib/site-packages/notebook/prometheus/log_functions.py
Normal file
24
venv/Lib/site-packages/notebook/prometheus/log_functions.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from ..prometheus.metrics import HTTP_REQUEST_DURATION_SECONDS
|
||||
|
||||
|
||||
def prometheus_log_method(handler):
|
||||
"""
|
||||
Tornado log handler for recording RED metrics.
|
||||
|
||||
We record the following metrics:
|
||||
Rate - the number of requests, per second, your services are serving.
|
||||
Errors - the number of failed requests per second.
|
||||
Duration - The amount of time each request takes expressed as a time interval.
|
||||
|
||||
We use a fully qualified name of the handler as a label,
|
||||
rather than every url path to reduce cardinality.
|
||||
|
||||
This function should be either the value of or called from a function
|
||||
that is the 'log_function' tornado setting. This makes it get called
|
||||
at the end of every request, allowing us to record the metrics we need.
|
||||
"""
|
||||
HTTP_REQUEST_DURATION_SECONDS.labels(
|
||||
method=handler.request.method,
|
||||
handler='{}.{}'.format(handler.__class__.__module__, type(handler).__name__),
|
||||
status_code=handler.get_status()
|
||||
).observe(handler.request.request_time())
|
27
venv/Lib/site-packages/notebook/prometheus/metrics.py
Normal file
27
venv/Lib/site-packages/notebook/prometheus/metrics.py
Normal file
|
@ -0,0 +1,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']
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue