Esempio n. 1
0
func (t *TraceWriterPlex) Write(r *dccp.Trace) {
	sample, ok := r.Sample()
	if ok {
		for _, hi := range t.highlight {
			if sample.Series == hi {
				r.SetHighlight()
				break
			}
		}
	}
	for _, g := range t.guzzles {
		g.Write(r)
	}
}
Esempio n. 2
0
func (x *roundtripCheckpoint) Write(r *dccp.Trace) {
	reading, ok := r.Sample()
	if !ok {
		return
	}

	var slot []float64
	switch {
	case r.ArgOfType(ccid3.RoundtripElapsedCheckpoint) != nil:
		endpoint := r.Labels[0]
		switch endpoint {
		case "client":
			slot = x.clientElapsed
		case "server":
			slot = x.serverElapsed
		}
	case r.ArgOfType(ccid3.RoundtripReportCheckpoint) != nil:
		endpoint := r.Labels[0]
		switch endpoint {
		case "client":
			slot = x.clientReport
		case "server":
			slot = x.serverReport
		}
	}
	if slot == nil {
		return
	}
	for i, checkTime := range x.checkTimes {
		if r.Time < checkTime {
			slot[i] = reading.Value
		}
	}
}