Exemple #1
0
func (w *writeBuffer) write(bp client.BatchPoints) error {
	var err error
	if w.conn == nil {
		w.conn, err = w.i.et.tm.InfluxDBService.NewClient()
		if err != nil {
			return err
		}
	}
	w.i.statMap.Add(statsInfluxDBPointsWritten, int64(len(bp.Points())))
	return w.conn.Write(bp)
}
func sendMetrics(config StartupConfig, runningConfig RunningConfig, bps influx.BatchPoints, retry bool) {
	//influx connection
	influxClient, err := influxConnect(config, runningConfig)
	if err != nil {
		if retry {
			config.BpsChan <- bps
		}
		errHndlr(err, ERROR)
		return
	}
	influxClient.Write(bps)

	log.Info(fmt.Sprintf("Sent %v stats for %v", len(bps.Points()), bps.Database()))
}