Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

G3 271 health check response update #80

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "geneweaver-api"
version = "0.7.0a8"
version = "0.7.0a9"
description = "The Geneweaver API"
authors = [
"Alexander Berger <[email protected]>",
Expand All @@ -20,7 +20,7 @@ python = "^3.9"
geneweaver-core = "^0.10.0a3"
fastapi = {extras = ["all"], version = "^0.111.0"}
uvicorn = {extras = ["standard"], version = "^0.30.0"}
geneweaver-db = "0.5.0a12"
geneweaver-db = "0.5.0a13"
psycopg-pool = "^3.1.7"
requests = "^2.32.3"
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
Expand Down
7 changes: 6 additions & 1 deletion src/geneweaver/api/controller/monitors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Endpoints related to system health."""

from datetime import datetime
from typing import Optional

from fastapi import APIRouter, Depends, Query
Expand All @@ -20,7 +21,11 @@ def get_health_check(
] = False,
) -> dict:
"""Return 200 API response if reachable and optionally check db health."""
response = {"status": "UP"}
response = {
"status": "UP",
"details": "All systems normal.",
"datetime": datetime.utcnow(),
}

if db_health_check:
db_health_response = monitors_service.check_db_health(cursor)
Expand Down
2 changes: 1 addition & 1 deletion tests/controllers/test_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def test_valid_url_req(mock_db_heath_service_call, client):
url="/api/monitors/servers/health", params={"db_health_check": True}
)
assert response.status_code == 200
assert response.json() == db_health_status
assert response.json().get("DB_status") == db_health_status.get("DB_status")
2 changes: 2 additions & 0 deletions tests/data/monitors.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"db_health_status": {
"status": "UP",
"details": "All systems normal.",
"datetime": "2024-07-15T18:50:37.318238",
"DB_status": {
"gene_identifier_last_update": {
"gi_date": "2024-06-24T01:54:48.023015+00:00"
Expand Down
Loading