func (d *MongodbData) add(acc plugins.Accumulator, key string, val interface{}) { acc.AddValuesWithTime( key, map[string]interface{}{ "value": val, }, d.Tags, d.StatLine.Time, ) }
func emitMetrics(k *Kafka, acc plugins.Accumulator, metricConsumer <-chan []byte) error { timeout := time.After(1 * time.Second) for { select { case batch := <-metricConsumer: var points []tsdb.Point var err error if points, err = tsdb.ParsePoints(batch); err != nil { return err } for _, point := range points { acc.AddValuesWithTime(point.Name(), point.Fields(), point.Tags(), point.Time()) } case <-timeout: return nil } } }