Esempio n. 1
0
// Add adds a new log record to the series. It assumes that records are added
// in increasing chronological order
func (x *SeriesSweeper) Add(r *dccp.LogRecord) {
	if !r.IsHighlighted() {
		return
	}
	// Check that the argument is a sample
	m_, ok := r.Args[dccp.SampleType]
	if !ok {
		return
	}
	// Read sample data
	m := m_.(map[string]interface{})
	value := m["Value"].(float64)
	series := r.LabelString() + m["Series"].(string)
	for _, u := range x.series {
		if u == series {
			goto __SeriesSaved
		}
	}
	x.series = append(x.series, series)
__SeriesSaved:
	// Remember the sample
	u := &sample{
		Series: series,
		Time:   float64(r.Time) / 1e6, // Time, X-coordinate, always in milliseconds
		Value:  value,
	}
	x.chrono.PushBack(u)
}
Esempio n. 2
0
func (t *GuzzlePlex) Write(r *dccp.LogRecord) {
	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. 3
0
func (x *roundtripCheckpoint) Write(r *dccp.LogRecord) {
	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
		}
	}
}