mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Add message stats to reporting (#2748)
Since we're now listening on the `OutputRoomEvent` stream, we are able to store messages stats.
This commit is contained in:
parent
b367cfeddf
commit
86b25a6337
9 changed files with 383 additions and 11 deletions
|
@ -24,11 +24,12 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/userapi/storage"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type phoneHomeStats struct {
|
||||
|
@ -109,12 +110,19 @@ func (p *phoneHomeStats) collect() {
|
|||
}
|
||||
|
||||
// message and room stats
|
||||
// TODO: Find a solution to actually set these values
|
||||
// TODO: Find a solution to actually set this value
|
||||
p.stats["total_room_count"] = 0
|
||||
p.stats["daily_messages"] = 0
|
||||
p.stats["daily_sent_messages"] = 0
|
||||
p.stats["daily_e2ee_messages"] = 0
|
||||
p.stats["daily_sent_e2ee_messages"] = 0
|
||||
|
||||
messageStats, activeRooms, activeE2EERooms, err := p.db.DailyRoomsMessages(ctx, p.serverName)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Warn("unable to query message stats, using default values")
|
||||
}
|
||||
p.stats["daily_messages"] = messageStats.Messages
|
||||
p.stats["daily_sent_messages"] = messageStats.SentMessages
|
||||
p.stats["daily_e2ee_messages"] = messageStats.MessagesE2EE
|
||||
p.stats["daily_sent_e2ee_messages"] = messageStats.SentMessagesE2EE
|
||||
p.stats["daily_active_rooms"] = activeRooms
|
||||
p.stats["daily_active_e2ee_rooms"] = activeE2EERooms
|
||||
|
||||
// user stats and DB engine
|
||||
userStats, db, err := p.db.UserStatistics(ctx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue