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
File: meter.go Progetto: wptad/dvara
func (m *Meter) writeMeta(c *gmetric.Client) {
	c.WriteMeta(&m.count)
	c.WriteMeta(&m.m1rate)
	c.WriteMeta(&m.m5rate)
	c.WriteMeta(&m.m15rate)
	c.WriteMeta(&m.meanRate)
}
Esempio n. 4
0
func (h *Histogram) writeMeta(c *gmetric.Client) {
	c.WriteMeta(&h.max)
	c.WriteMeta(&h.mean)
	c.WriteMeta(&h.min)
	c.WriteMeta(&h.stddev)
	c.WriteMeta(&h.p50)
	c.WriteMeta(&h.p75)
	c.WriteMeta(&h.p95)
	c.WriteMeta(&h.p98)
	c.WriteMeta(&h.p99)
	c.WriteMeta(&h.p999)
}
Esempio n. 5
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. 6
0
File: timer.go Progetto: wptad/dvara
func (t *Timer) writeMeta(c *gmetric.Client) {
	c.WriteMeta(&t.max)
	c.WriteMeta(&t.mean)
	c.WriteMeta(&t.min)
	c.WriteMeta(&t.stddev)
	c.WriteMeta(&t.p50)
	c.WriteMeta(&t.p75)
	c.WriteMeta(&t.p95)
	c.WriteMeta(&t.p98)
	c.WriteMeta(&t.p99)
	c.WriteMeta(&t.p999)
}
Esempio n. 7
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. 8
0
File: gauge.go Progetto: wptad/dvara
func (g *Gauge) writeValue(c *gmetric.Client) {
	c.WriteValue(&g.gmetric, g.Value())
}
Esempio n. 9
0
File: gauge.go Progetto: wptad/dvara
func (g *Gauge) writeMeta(c *gmetric.Client) {
	c.WriteMeta(&g.gmetric)
}
Esempio n. 10
0
func (c *Counter) writeValue(client *gmetric.Client) {
	client.WriteValue(&c.gmetric, c.Count())
}
Esempio n. 11
0
func (c *Counter) writeMeta(client *gmetric.Client) {
	client.WriteMeta(&c.gmetric)
}