Skip to content

Commit fb3acb5

Browse files
committed
Create dummy metric to debug
1 parent 107a802 commit fb3acb5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

gen3workflow/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def get_app(httpx_client=None) -> FastAPI:
6161
logger.info(
6262
f"Setting up Metrics with ENABLE_PROMETHEUS_METRICS flag set to {config['ENABLE_PROMETHEUS_METRICS']}"
6363
)
64+
6465
app.metrics = Metrics(
6566
enabled=config["ENABLE_PROMETHEUS_METRICS"],
6667
prometheus_dir=config["PROMETHEUS_MULTIPROC_DIR"],
@@ -108,7 +109,9 @@ async def middleware_log_response_and_api_metric(
108109
response_time_seconds=response_time_seconds,
109110
status_code=response.status_code,
110111
)
111-
112+
logger.debug(
113+
f"Vieweing metrics associated with the registry {list(app.metrics._registry.collect())=}"
114+
)
112115
return response
113116

114117
return app

gen3workflow/metrics.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33
from cdispyutils.metrics import BaseMetrics
44

55
from gen3workflow.config import config
6+
from gen3workflow import logger
67

78

89
class Metrics(BaseMetrics):
910
def __init__(self, prometheus_dir: str, enabled: bool = True) -> None:
11+
1012
super().__init__(
1113
prometheus_dir=config["PROMETHEUS_MULTIPROC_DIR"], enabled=enabled
1214
)
15+
logger.debug(f"Create a dummy metric for testing purposes: ")
16+
self.add_create_task_api_interaction(
17+
method="GET",
18+
path="/ga4gh/tes/v1/tasks",
19+
response_time_seconds=2.30,
20+
status_code="404",
21+
)
1322

1423
def add_create_task_api_interaction(
1524
self,

0 commit comments

Comments
 (0)