feat 接入Prometheus

This commit is contained in:
2025-12-17 21:05:12 +08:00
parent efa9f50d3e
commit da91cff056
24 changed files with 289 additions and 60 deletions

View File

@@ -32,7 +32,23 @@ func (m *userManager) Delete(uid int32) {
func (m *userManager) GetAll() map[int32]*Client {
m.RLock()
defer m.RUnlock()
return m.userMap
copyMap := make(map[int32]*Client, len(m.userMap))
for k, v := range m.userMap {
copyMap[k] = v
}
return copyMap
}
func (m *userManager) GetAllInterface() []interface{} {
m.RLock()
defer m.RUnlock()
r := make([]interface{}, 0)
for _, v := range m.userMap {
r = append(r, v)
}
return r
}
func (m *userManager) GetByUID(uid int32) *Client {