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

encrypted messages stats #20

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
13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ type StatsReport struct {
TotalNonBridgedUsers *int64 `json:"total_nonbridged_users"` // Total native and guest users in users table
TotalRoomCount *int64 `json:"total_room_count"` // Total number of rooms on the server
DailyActiveUsers *int64 `json:"daily_active_users"` // Total number of users in the users ips table seen in the last 24 hours
DailyMessages *int64 `json:"daily_messages"` // Total number of m.room.message in events table in the past 24 hours sent from host server
DailySentMessages *int64 `json:"daily_sent_messages"` // Total number of m.room.message in events table in the past 24 hours
DailyMessages *int64 `json:"daily_messages"` // Total number of m.room.message in events table in the past 24 hours
DailySentMessages *int64 `json:"daily_sent_messages"` // Total number of m.room.message in events table in the past 24 hours sent from host server
DailyActiveRooms *int64 `json:"daily_active_rooms"` // Total number of rooms with a m.room.message in the event table in the past 24 hours
DailyE2eeMessages *int64 `json:"daily_e2ee_messages"` // Total number of m.room.encrypted in events table in the past 24 hours
DailySentE2eeMessages *int64 `json:"daily_sent_e2ee_messages"` // Total number of m.room.encrypted in events table in the past 24 hours sent from host server
DailyActiveE2eeRooms *int64 `json:"daily_active_e2ee_rooms"` // Total number of rooms with a m.room.encrypted in the event table in the past 24 hours
MonthlyActiveUsers *int64 `json:"monthly_active_users"` // Total number of users in the users ips table seen in the last 30 days
R30UsersAll *int64 `json:"r30_users_all"` // r30 stat for all users regardless of client
R30UsersAndroid *int64 `json:"r30_users_android"` // r30 stat considering only Riot Android
Expand Down Expand Up @@ -131,6 +134,9 @@ func (r *Recorder) Save(sr StatsReport) error {
cols, vals = appendIfNonNil(cols, vals, "daily_active_rooms", sr.DailyActiveRooms)
cols, vals = appendIfNonNil(cols, vals, "daily_messages", sr.DailyMessages)
cols, vals = appendIfNonNil(cols, vals, "daily_sent_messages", sr.DailySentMessages)
cols, vals = appendIfNonNil(cols, vals, "daily_active_e2ee_rooms", sr.DailyActiveE2eeRooms)
cols, vals = appendIfNonNil(cols, vals, "daily_e2ee_messages", sr.DailyE2eeMessages)
cols, vals = appendIfNonNil(cols, vals, "daily_sent_e2ee_messages", sr.DailySentE2eeMessages)
cols, vals = appendIfNonNil(cols, vals, "monthly_active_users", sr.MonthlyActiveUsers)

cols, vals = appendIfNonNil(cols, vals, "r30_users_all", sr.R30UsersAll)
Expand Down Expand Up @@ -229,6 +235,9 @@ func createTable(db *sql.DB) error {
daily_active_rooms BIGINT,
daily_messages BIGINT,
daily_sent_messages BIGINT,
daily_active_e2ee_rooms BIGINT,
daily_e2ee_messages BIGINT,
daily_sent_e2ee_messages BIGINT,
monthly_active_users BIGINT,
r30_users_all BIGINT,
r30_users_android BIGINT,
Expand Down
9 changes: 9 additions & 0 deletions scripts/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def main():
`daily_active_rooms` bigint(20) DEFAULT NULL,
`daily_messages` bigint(20) DEFAULT NULL,
`daily_sent_messages` bigint(20) DEFAULT NULL,
`daily_active_e2ee_rooms` bigint(20) DEFAULT NULL,
`daily_e2ee_messages` bigint(20) DEFAULT NULL,
`daily_sent_e2ee_messages` bigint(20) DEFAULT NULL,
`monthly_active_users` bigint(20) DEFAULT NULL,
`r30_users_all` bigint(20) DEFAULT NULL,
`r30_users_android` bigint(20) DEFAULT NULL,
Expand Down Expand Up @@ -98,6 +101,9 @@ def main():
SUM(daily_active_rooms) as 'daily_active_rooms',
SUM(daily_messages) as 'daily_messages',
SUM(daily_sent_messages) as 'daily_sent_messages',
SUM(daily_active_e2ee_rooms) as 'daily_active_e2ee_rooms',
SUM(daily_e2ee_messages) as 'daily_e2ee_messages',
SUM(daily_sent_e2ee_messages) as 'daily_sent_e2ee_messages',
SUM(monthly_active_users) as 'monthly_active_users',
SUM(r30_users_all) as 'r30_users_all',
SUM(r30_users_android) as 'r30_users_android',
Expand Down Expand Up @@ -132,6 +138,9 @@ def main():
daily_active_rooms,
daily_messages,
daily_sent_messages,
daily_active_e2ee_rooms,
daily_e2ee_messages,
daily_sent_e2ee_messages,
monthly_active_users,
r30_users_all,
r30_users_android,
Expand Down