Merge "Add configuration option influxdb.batch_size"

This commit is contained in:
Zuul 2020-02-06 10:15:33 +00:00 committed by Gerrit Code Review
commit 14b98a40fd
3 changed files with 12 additions and 1 deletions

View File

@ -27,6 +27,9 @@ influxdb_opts = [
help='Default retention period in hours for new '
'databases automatically created by the persister',
default=0),
cfg.IntOpt('batch_size',
help='Maximum size of the batch to write to the database.',
default=10000),
cfg.HostAddressOpt('ip_address',
help='Valid IP address or hostname '
'to InfluxDB instance'),

View File

@ -52,9 +52,11 @@ class AbstractInfluxdbRepository(abstract_repository.AbstractRepository):
# NOTE (brtknr): Loop twice to ensure database is created if missing.
for retry in range(2):
try:
batch_size = self.conf.influxdb.batch_size
self._influxdb_client.write_points(data_points, 'ms',
protocol='line',
database=database)
database=database,
batch_size=batch_size)
break
except influxdb.exceptions.InfluxDBClientError as ex:
# When a databse is not found, the returned exception resolves

View File

@ -0,0 +1,6 @@
---
features:
- |
Configuration option `batch_size` for InfluxDB to control the maximum
size of batches written to the database. Default value set to 10 000 data
points.