MCPcopy Index your code
hub / github.com/CodisLabs/codis / Stats

Method Stats

pkg/topom/topom.go:287–332  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285}
286
287func (s *Topom) Stats() (*Stats, error) {
288 s.mu.Lock()
289 defer s.mu.Unlock()
290 ctx, err := s.newContext()
291 if err != nil {
292 return nil, err
293 }
294
295 stats := &Stats{}
296 stats.Closed = s.closed
297
298 stats.Slots = ctx.slots
299
300 stats.Group.Models = models.SortGroup(ctx.group)
301 stats.Group.Stats = map[string]*RedisStats{}
302 for _, g := range ctx.group {
303 for _, x := range g.Servers {
304 if v := s.stats.servers[x.Addr]; v != nil {
305 stats.Group.Stats[x.Addr] = v
306 }
307 }
308 }
309
310 stats.Proxy.Models = models.SortProxy(ctx.proxy)
311 stats.Proxy.Stats = s.stats.proxies
312
313 stats.SlotAction.Interval = s.action.interval.Int64()
314 stats.SlotAction.Disabled = s.action.disabled.Bool()
315 stats.SlotAction.Progress.Status = s.action.progress.status.Load().(string)
316 stats.SlotAction.Executor = s.action.executor.Int64()
317
318 stats.HA.Model = ctx.sentinel
319 stats.HA.Stats = map[string]*RedisStats{}
320 for _, server := range ctx.sentinel.Servers {
321 if v := s.stats.servers[server]; v != nil {
322 stats.HA.Stats[server] = v
323 }
324 }
325 stats.HA.Masters = make(map[string]string)
326 if s.ha.masters != nil {
327 for gid, addr := range s.ha.masters {
328 stats.HA.Masters[strconv.Itoa(gid)] = addr
329 }
330 }
331 return stats, nil
332}
333
334type Stats struct {
335 Closed bool `json:"closed"`

Callers 2

OverviewMethod · 0.95
TestApiTopomFunction · 0.45

Calls 3

newContextMethod · 0.95
BoolMethod · 0.80
Int64Method · 0.45

Tested by 1

TestApiTopomFunction · 0.36