mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: Implement statistics class & additional metrics
The new module/class helps us constructing queries and count records to expose various statistics on the homepage. We also utilize for some new prometheus metrics (package and user gauges). Record counts are being cached with Redis. Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
347c2ce721
commit
44c158b8c2
7 changed files with 143 additions and 89 deletions
|
@ -26,11 +26,10 @@ def user() -> User:
|
|||
yield user
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_search_cache_metrics(user: User):
|
||||
def test_search_cache_metrics(user: User):
|
||||
# Fire off 3 identical queries for caching
|
||||
for _ in range(3):
|
||||
await db_query_cache("key", db.query(User))
|
||||
db_query_cache("key", db.query(User))
|
||||
|
||||
# Get metrics
|
||||
metrics = str(generate_latest(REGISTRY))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue