Esempio n. 1
0
func (self *gmetricc) AddStats(ref info.ContainerReference, stats *info.ContainerStats) error {
	if stats == nil {
		return nil
	}
	fmt.Println("----------------addstats--------------------")

	//ab := gmetric.ClientFromFlag("hello")
	ab := gmetric.Client{
		Addr: []net.Addr{
			&net.UDPAddr{IP: net.ParseIP("103.56.92.26"), Port: 8651},
		},
	}

	m := &gmetric.Metric{
		Name:         "uint8_metric",
		Host:         "103.56.92.26",
		ValueType:    gmetric.ValueUint8,
		Units:        "count",
		Slope:        gmetric.SlopeBoth,
		TickInterval: 20 * time.Second,
		Lifetime:     24 * time.Hour,
	}
	const val = 10

	if err1 := ab.WriteMeta(m); err1 != nil {
		fmt.Println(err1)
	}

	if err2 := ab.WriteValue(m, val); err2 != nil {
		fmt.Println(err2)
	}

	return nil
}
Esempio n. 2
0
File: meter.go Progetto: wptad/dvara
func (m *Meter) writeValue(c *gmetric.Client) {
	c.WriteValue(&m.count, m.Count())
	c.WriteValue(&m.m1rate, m.Rate1())
	c.WriteValue(&m.m5rate, m.Rate5())
	c.WriteValue(&m.m15rate, m.Rate15())
	c.WriteValue(&m.meanRate, m.RateMean())
}
Esempio n. 3
0
func (h *Histogram) writeValue(c *gmetric.Client) {
	ps := h.Percentiles(histogramTrackedPercentiles)
	c.WriteValue(&h.max, h.Max())
	c.WriteValue(&h.mean, h.Mean())
	c.WriteValue(&h.min, h.Min())
	c.WriteValue(&h.stddev, h.StdDev())
	c.WriteValue(&h.p50, ps[0])
	c.WriteValue(&h.p75, ps[1])
	c.WriteValue(&h.p95, ps[2])
	c.WriteValue(&h.p98, ps[3])
	c.WriteValue(&h.p99, ps[4])
	c.WriteValue(&h.p999, ps[5])
}
Esempio n. 4
0
File: timer.go Progetto: wptad/dvara
func (t *Timer) writeValue(c *gmetric.Client) {
	ps := t.Percentiles(timerTrackedPercentiles)
	c.WriteValue(&t.max, t.normalizeInt64(t.Max()))
	c.WriteValue(&t.mean, t.normalizeFloat64(t.Mean()))
	c.WriteValue(&t.min, t.normalizeInt64(t.Min()))
	c.WriteValue(&t.stddev, t.normalizeFloat64(t.StdDev()))
	c.WriteValue(&t.p50, t.normalizeFloat64(ps[0]))
	c.WriteValue(&t.p75, t.normalizeFloat64(ps[1]))
	c.WriteValue(&t.p95, t.normalizeFloat64(ps[2]))
	c.WriteValue(&t.p98, t.normalizeFloat64(ps[3]))
	c.WriteValue(&t.p99, t.normalizeFloat64(ps[4]))
	c.WriteValue(&t.p999, t.normalizeFloat64(ps[5]))
}
Esempio n. 5
0
File: gauge.go Progetto: wptad/dvara
func (g *Gauge) writeValue(c *gmetric.Client) {
	c.WriteValue(&g.gmetric, g.Value())
}
Esempio n. 6
0
func (c *Counter) writeValue(client *gmetric.Client) {
	client.WriteValue(&c.gmetric, c.Count())
}