mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Add version & monolith stats
This commit is contained in:
parent
e1eaa74f8b
commit
5ffb386a25
|
|
@ -31,6 +31,7 @@ func SyncAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
|
|||
base.PublicClientAPIMux, userAPI, rsAPI,
|
||||
base.KeyServerHTTPClient(),
|
||||
federation, &cfg.SyncAPI, cfg,
|
||||
false,
|
||||
)
|
||||
|
||||
base.SetupAndServeHTTP(
|
||||
|
|
|
|||
|
|
@ -72,5 +72,6 @@ func (m *Monolith) AddAllPublicRoutes(process *process.ProcessContext, csMux, ss
|
|||
syncapi.AddPublicRoutes(
|
||||
process, csMux, m.UserAPI, m.RoomserverAPI,
|
||||
m.KeyAPI, m.FedClient, &m.Config.SyncAPI, m.Config,
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
|
|
@ -55,6 +56,7 @@ func AddPublicRoutes(
|
|||
federation *gomatrixserverlib.FederationClient,
|
||||
cfg *config.SyncAPI,
|
||||
baseCfg *config.Dendrite,
|
||||
isMonolith bool,
|
||||
) {
|
||||
startTime := time.Now()
|
||||
js := jetstream.Prepare(&cfg.Matrix.JetStream)
|
||||
|
|
@ -119,7 +121,7 @@ func AddPublicRoutes(
|
|||
}
|
||||
|
||||
// TODO: add config
|
||||
go startPhoneHomeCollector(startTime, baseCfg, syncDB, userAPI)
|
||||
go startPhoneHomeCollector(startTime, baseCfg, syncDB, userAPI, isMonolith)
|
||||
|
||||
routing.Setup(router, requestPool, syncDB, userAPI, federation, rsAPI, cfg)
|
||||
}
|
||||
|
|
@ -132,6 +134,7 @@ type phoneHomeStats struct {
|
|||
startTime time.Time
|
||||
cfg *config.Dendrite
|
||||
db storage.Database
|
||||
isMonolith bool
|
||||
}
|
||||
|
||||
type timestampToRUUsage struct {
|
||||
|
|
@ -139,7 +142,7 @@ type timestampToRUUsage struct {
|
|||
usage syscall.Rusage
|
||||
}
|
||||
|
||||
func startPhoneHomeCollector(startTime time.Time, cfg *config.Dendrite, syncDB storage.Database, userAPI userapi.UserInternalAPI) {
|
||||
func startPhoneHomeCollector(startTime time.Time, cfg *config.Dendrite, syncDB storage.Database, userAPI userapi.UserInternalAPI, isMonolith bool) {
|
||||
|
||||
p := phoneHomeStats{
|
||||
stats: make(map[string]interface{}),
|
||||
|
|
@ -148,6 +151,7 @@ func startPhoneHomeCollector(startTime time.Time, cfg *config.Dendrite, syncDB s
|
|||
cfg: cfg,
|
||||
db: syncDB,
|
||||
userAPI: userAPI,
|
||||
isMonolith: isMonolith,
|
||||
}
|
||||
|
||||
// start initial run after 5min
|
||||
|
|
@ -169,6 +173,8 @@ func startPhoneHomeCollector(startTime time.Time, cfg *config.Dendrite, syncDB s
|
|||
func (p *phoneHomeStats) collect() {
|
||||
p.stats = make(map[string]interface{})
|
||||
p.stats["servername"] = p.serverName
|
||||
p.stats["monolith"] = p.isMonolith
|
||||
p.stats["version"] = internal.VersionString()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), time.Minute*1)
|
||||
defer cancel()
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ GROUP BY client_type
|
|||
`
|
||||
|
||||
const countUserByAccountTypeSQL = `
|
||||
SELECT COUNT(*) FROM account_accounts WHERE account_type = $1
|
||||
SELECT COUNT(*) FROM account_accounts WHERE account_type = ANY($1)
|
||||
`
|
||||
|
||||
const countRegisteredUserByTypeStmt = `
|
||||
|
|
|
|||
Loading…
Reference in a new issue