influx/writer.go
func NewBatchingWriter(log ttnlog.Interface, w BatchPointsWriter, opts ...BatchingWriterOption) *BatchingWriter {
	bw := &BatchingWriter{
		log:             log,
		writer:          w,
		scalingInterval: DefaultScalingInterval,
		limit:           DefaultInstanceLimit,
		pointChans:      make(map[influxdb.BatchPointsConfig]chan *batchPoint),
	}
	for _, opt := range opts {
		opt(bw)
	}
	bw.log = bw.log.WithFields(ttnlog.Fields{
		"limit":           bw.limit,
		"scalingInterval": bw.scalingInterval,
	})
	return bw
}
func NewBatchingWriter(log ttnlog.Interface, w BatchPointsWriter, opts ...BatchingWriterOption) *BatchingWriter {
	bw := &BatchingWriter{
		log:             log,
		writer:          w,
		scalingInterval: DefaultScalingInterval,
		limit:           DefaultInstanceLimit,
		pointChans:      make(map[influxdb.BatchPointsConfig]chan *batchPoint),
	}
	for _, opt := range opts {
		opt(bw)
	}
	bw.log = bw.log.WithFields(ttnlog.Fields{
		"limit":           bw.limit,
		"scalingInterval": bw.scalingInterval,
	})
	return bw
}
// NewBatchingWriter creates new BatchingWriter. If WithScalingInterval is not specified, DefaultScalingInterval value is used. If WithInstanceLimit is not specified, DefaultInstanceLimit is used.