mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 04:23:01 +00:00
Follow signature contract
This commit is contained in:
@@ -22,14 +22,8 @@ class Generator:
|
|||||||
for name in dir(jupyterhub.metrics):
|
for name in dir(jupyterhub.metrics):
|
||||||
obj = getattr(jupyterhub.metrics, name)
|
obj = getattr(jupyterhub.metrics, name)
|
||||||
if obj.__class__.__module__.startswith('prometheus_client.'):
|
if obj.__class__.__module__.startswith('prometheus_client.'):
|
||||||
description = obj.describe()[0]
|
for metric in obj.describe():
|
||||||
table_rows.append(
|
table_rows.append([metric.type, metric.name, metric.documentation])
|
||||||
[
|
|
||||||
description.type,
|
|
||||||
description.name,
|
|
||||||
description.documentation,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
return table_rows
|
return table_rows
|
||||||
|
|
||||||
def prometheus_metrics(self):
|
def prometheus_metrics(self):
|
||||||
|
@@ -11,15 +11,15 @@ from .utils import add_user, api_request, get_page
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"metric, expected_name",
|
"metric_object, expected_names",
|
||||||
[
|
[
|
||||||
(metrics.TOTAL_USERS, 'jupyterhub_total_users'),
|
(metrics.TOTAL_USERS, ['jupyterhub_total_users']),
|
||||||
(metrics.REQUEST_DURATION_SECONDS, 'jupyterhub_request_duration_seconds'),
|
(metrics.REQUEST_DURATION_SECONDS, ['jupyterhub_request_duration_seconds']),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_metrics_prefix(metric, expected_name):
|
def test_metrics_prefix(metric_object, expected_names):
|
||||||
description = metric.describe()[0]
|
for metric, expected_name in zip(metric_obj.describe(), expected_names):
|
||||||
assert description.name == expected_name
|
assert metric.name == expected_name
|
||||||
|
|
||||||
|
|
||||||
async def test_total_users(app):
|
async def test_total_users(app):
|
||||||
|
Reference in New Issue
Block a user