MCPcopy Create free account
hub / github.com/distributedio/titan / feedMonitors

Function feedMonitors

command/command.go:262–283  ·  view source on GitHub ↗
(ctx *Context)

Source from the content-addressed store, hash-verified

260}
261
262func feedMonitors(ctx *Context) {
263 ctx.Server.Monitors.Range(func(k, v interface{}) bool {
264 mCtx := v.(*Context)
265 if mCtx.Client.Namespace != sysAdminNamespace && mCtx.Client.Namespace != ctx.Client.Namespace {
266 return true
267 }
268
269 now := time.Now().UnixNano() / 1000
270 ts := strconv.FormatFloat(float64(now)/1000000, 'f', -1, 64)
271 id := strconv.FormatInt(int64(ctx.Client.DB.ID), 10)
272
273 line := ts + " [" + id + " " + ctx.Client.RemoteAddr + "]" + " " + ctx.Name + " " + strings.Join(ctx.Args, " ")
274 start := time.Now()
275 err := resp.ReplySimpleString(mCtx.Out, line)
276 zap.L().Debug("feedMonitors reply", zap.String("name", ctx.Name), zap.Int64("cost(us)", time.Since(start).Nanoseconds()/1000))
277 if err != nil {
278 ctx.Server.Monitors.Delete(k)
279 }
280
281 return true
282 })
283}
284
285// Executor executes a command
286type Executor struct {

Callers 3

TestMonitorFunction · 0.85
CallFunction · 0.85
TxnCallFunction · 0.85

Calls 4

ReplySimpleStringFunction · 0.92
DeleteMethod · 0.80
RangeMethod · 0.65
StringMethod · 0.45

Tested by 1

TestMonitorFunction · 0.68