コード例 #1
0
ファイル: flusher.go プロジェクト: lcaballero/flux-reporter
func (a *Flusher) flush(pt *flux.Point, k int) {
	//	fmt.Println("flushing data points to influx", k)
	return
	name := pt.Name()
	tags := pt.Tags()
	fields := pt.Fields()
	nanos := pt.Time()

	buf := bytes.NewBuffer([]byte{})
	buf.WriteString(name)

	n := len(tags)
	if n > 0 {
		buf.WriteString(" ")
		for k, v := range tags {
			buf.WriteString(k)
			buf.WriteString("=")
			buf.WriteString(v)
			n--
			if n > 0 {
				buf.WriteString(",")
			} else {
				break
			}
		}
	}

	d := len(fields)
	if d > 0 {
		buf.WriteString(" ")
		s := "v"
		for k, _ := range fields {
			buf.WriteString(k)
			buf.WriteString("=")
			buf.WriteString(s)
			d--
			if d > 0 {
				buf.WriteString(",")
			} else {
				break
			}
		}
	}

	buf.WriteString(" ")
	buf.WriteString(fmt.Sprintf("%di", nanos.UnixNano()))

	//	fmt.Println(buf.String())
}
コード例 #2
0
ファイル: influxdb_test.go プロジェクト: crezam/kit
func comparePoint(t *testing.T, i int, expected mockPoint, given stdinflux.Point) {

	if want, have := expected.Name, given.Name(); want != have {
		t.Errorf("point %d: want %q, have %q", i, want, have)
	}

	if want, have := expected.Tags, given.Tags(); !reflect.DeepEqual(want, have) {
		t.Errorf("point %d: want %v, have %v", i, want, have)
	}

	if want, have := expected.Fields, given.Fields(); !reflect.DeepEqual(want, have) {
		t.Errorf("point %d: want %v, have %v", i, want, have)
	}
}