Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:jhu-bids/TermHub into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigfried committed Mar 15, 2024
2 parents 6b575ab + 7f8df20 commit 82a7634
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 81 deletions.
19 changes: 14 additions & 5 deletions backend/routes/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,13 +725,22 @@ def next_api_call_group_id() -> int:
return id


@router.get("/usage")
def usage() -> Dict:
def usage_query():
"""Query for usage data"""
with get_db_connection() as con:
data = sql_query(con, """
select distinct r.*, array_sort(g.api_calls) api_calls, g.duration_seconds, g.group_start_time
from public.apiruns_grouped g
right join public.api_runs r ON g.api_call_group_id = r.api_call_group_id""")
SELECT DISTINCT r.*, array_sort(g.api_calls) api_calls, g.duration_seconds, g.group_start_time
FROM public.apiruns_grouped g
RIGHT JOIN public.api_runs r ON g.api_call_group_id = r.api_call_group_id""")
return data


# @router.get("/usage")
def usage() -> JSON_TYPE:
"""Usage report
Get all data from our monitoring."""
data = usage_query()
return data


Expand Down
Loading

0 comments on commit 82a7634

Please sign in to comment.