コード例 #1
0
ファイル: receiver_test.go プロジェクト: heroku/l2met
func bucketsEqual(actual, expected *bucket.Bucket) bool {
	if actual.Id.Name != expected.Id.Name {
		return false
	}
	if actual.Id.Source != expected.Id.Source {
		return false
	}
	if actual.Sum() != expected.Sum() {
		return false
	}
	return true
}
コード例 #2
0
ファイル: main.go プロジェクト: bgentry/l2met
func convert(b *bucket.Bucket, lms chan<- *LM) {
	err := rs.Get(b)
	if err != nil {
		fmt.Printf("error=%s\n", err)
		return
	}
	if len(b.Vals) == 0 {
		fmt.Printf("at=bucket-no-vals bucket=%s\n", b.Id.Name)
		return
	}
	fmt.Printf("at=librato_outlet.process.bucket minute=%d name=%q\n",
		b.Id.Time.Minute(), b.Id.Name)
	k := b.Id
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".last", Val: ff(b.Last())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".min", Val: ff(b.Min())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".max", Val: ff(b.Max())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".mean", Val: ff(b.Mean())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".median", Val: ff(b.Median())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".perc95", Val: ff(b.P95())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".perc99", Val: ff(b.P99())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".count", Val: fi(b.Count())}
	lms <- &LM{Token: k.Token, Time: ft(k.Time), Source: k.Source, Name: k.Name + ".sum", Val: ff(b.Sum())}
}