func (c *Client) Write(samples model.Samples) error {
	points := make([]*influx.Point, 0, len(samples))
	for _, s := range samples {
		v := float64(s.Value)
		if math.IsNaN(v) || math.IsInf(v, 0) {
			level.Debug(c.logger).Log("msg", "cannot send  to InfluxDB, skipping sample", "value", v, "sample", s)
			c.ignoredSamples.Inc()
			continue
		}
		p, err := influx.NewPoint(
			string(s.Metric[model.MetricNameLabel]),
			tagsFromMetric(s.Metric),
			map[string]interface{}{"value": v},
			s.Timestamp.Time(),
		)
		if err != nil {
			return err
		}
		points = append(points, p)
	}

	bps, err := influx.NewBatchPoints(influx.BatchPointsConfig{
		Precision:       "ms",
		Database:        c.database,
		RetentionPolicy: c.retentionPolicy,
	})
	if err != nil {
		return err
	}
	bps.AddPoints(points)
	return c.client.Write(bps)
}
func (c *Client) Write(samples model.Samples) error {
	points := make([]*influx.Point, 0, len(samples))
	for _, s := range samples {
		v := float64(s.Value)
		if math.IsNaN(v) || math.IsInf(v, 0) {
			level.Debug(c.logger).Log("msg", "cannot send  to InfluxDB, skipping sample", "value", v, "sample", s)
			c.ignoredSamples.Inc()
			continue
		}
		p, err := influx.NewPoint(
			string(s.Metric[model.MetricNameLabel]),
			tagsFromMetric(s.Metric),
			map[string]interface{}{"value": v},
			s.Timestamp.Time(),
		)
		if err != nil {
			return err
		}
		points = append(points, p)
	}

	bps, err := influx.NewBatchPoints(influx.BatchPointsConfig{
		Precision:       "ms",
		Database:        c.database,
		RetentionPolicy: c.retentionPolicy,
	})
	if err != nil {
		return err
	}
	bps.AddPoints(points)
	return c.client.Write(bps)
}
func ( c * Client ) Write ( samples model . Samples ) error { points := make ( [ ] * influx . Point , 0 , len ( samples ) ) for _ , s := range samples { v := float64 ( s . Value ) if math . IsNaN ( v ) || math . IsInf ( v , 0 ) { level . Debug ( c . logger ) . Log ( " " , " " , " " , v , " " , s ) c . ignoredSamples . Inc ( ) continue } p , err := influx . NewPoint ( string ( s . Metric [ model . MetricNameLabel ] ) , tagsFromMetric ( s . Metric ) , map [ string ] interface { } { " " : v } , s . Timestamp . Time ( ) , ) if err != nil { return err } points = append ( points , p ) } bps , err := influx . NewBatchPoints ( influx . BatchPointsConfig { Precision : " " , Database : c . database , RetentionPolicy : c . retentionPolicy , } ) if err != nil { return err } bps . AddPoints ( points ) return c . client . Write ( bps ) }
// Write sends a batch of samples to InfluxDB via its HTTP API.
Write sends a batch of samples to InfluxDB via its HTTP API .