mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 01:30:13 +00:00
Add occasional basic stat reporting to InfluxDB
This commit is contained in:
parent
ec5a023348
commit
f50a08b50b
3 changed files with 37 additions and 0 deletions
|
|
@ -26,4 +26,22 @@ async def report_webhook(time, success):
|
|||
await client.write({
|
||||
"measurement": "webhook",
|
||||
"fields": {"response_time": time, "success": int(success)}
|
||||
})
|
||||
|
||||
async def report_periodical_stats(conn):
|
||||
from pluralkit import db
|
||||
|
||||
systems = await db.system_count(conn)
|
||||
members = await db.member_count(conn)
|
||||
messages = await db.message_count(conn)
|
||||
accounts = await db.account_count(conn)
|
||||
|
||||
await client.write({
|
||||
"measurement": "stats",
|
||||
"fields": {
|
||||
"systems": systems,
|
||||
"members": members,
|
||||
"messages": messages,
|
||||
"accounts": accounts
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue