// Update a flow, creating it if we need to Begin a new flow func Update(ctx gotocol.Context, s string) { if flowmap[ctx.Trace] == nil { Begin(ctx, s) } else { flowmap[ctx.Trace].(flowmaptype)[ctx.Span] = ctx.String() + ":" + s } }
// Begin a new request flow func Begin(ctx gotocol.Context, s string) { if file == nil { // do this here since Arch is not set in time for init() file, _ = os.Create("json_metrics/" + archaius.Conf.Arch + "_flow.json") } if flowmap[ctx.Trace] == nil { flowmap[ctx.Trace] = make(flowmaptype, archaius.Conf.Population) } flowmap[ctx.Trace].(flowmaptype)[ctx.Span] = ctx.String() + ":" + s }
// Annotate service sends on a flow, using existing annotation map and the new span func AnnotateSend(annotation *annotationtype, span gotocol.Context) time.Time { now := time.Now() if annotation != nil { flowlock.Lock() (*annotation).Calls = append((*annotation).Calls, fmt.Sprintf("%v:%d", span.String(), now.UnixNano())) // send time flowlock.Unlock() //log.Println(*annotation) } return now }
// Update a flow, creating it if we need to Begin a new flow func Update(ctx gotocol.Context, s string) { if !archaius.Conf.Collect { return } if flowmap[ctx.Trace] == nil { Begin(ctx) } if flowmap[ctx.Trace].(flowmaptype)[ctx.Parent] == nil { flowmap[ctx.Trace].(flowmaptype)[ctx.Parent] = make(flowmaptype) } flowmap[ctx.Trace].(flowmaptype)[ctx.Parent].(flowmaptype)[ctx.Span] = ctx.String() + "-" + s }