Esempio n. 1
0
// 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
	}
}
Esempio n. 2
0
// 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
}
Esempio n. 3
0
// 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
}
Esempio n. 4
0
File: flow.go Progetto: shuoy/spigo
// 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
}