diff --git a/monasca_persister/conf/repositories.py b/monasca_persister/conf/repositories.py index 6b96929f..e72850ad 100644 --- a/monasca_persister/conf/repositories.py +++ b/monasca_persister/conf/repositories.py @@ -32,7 +32,11 @@ repositories_opts = [ name='events_driver', help='The repository driver to use for events', default=('monasca_persister.repositories.elasticsearch.events_repository:' - 'ElasticSearchEventsRepository'))] + 'ElasticSearchEventsRepository')), + cfg.BoolOpt( + 'ignore_parse_point_error', + help='Specifies if InfluxDB parse point errors should be ignored and measurements dropped', + default=False)] repositories_group = cfg.OptGroup(name='repositories', title='repositories') diff --git a/monasca_persister/repositories/persister.py b/monasca_persister/repositories/persister.py index ba8e83ed..9d13ef80 100644 --- a/monasca_persister/repositories/persister.py +++ b/monasca_persister/repositories/persister.py @@ -15,6 +15,7 @@ # limitations under the License. import os +from oslo_config import cfg from oslo_log import log from monasca_common.kafka import consumer @@ -61,6 +62,13 @@ class Persister(object): LOG.warning("Some points older than retention policy were dropped") self._data_points = [] self._consumer.commit() + + elif cfg.CONF.repositories.ignore_parse_point_error \ + and "unable to parse points" in ex.message: + LOG.warning("Some points unable to parse were dropped") + self._data_points = [] + self._consumer.commit() + else: LOG.exception("Error writing to database: {}" .format(self._data_points)) diff --git a/releasenotes/notes/fix-influxdb-parse-error-17402d74ffc39d4c.yaml b/releasenotes/notes/fix-influxdb-parse-error-17402d74ffc39d4c.yaml new file mode 100644 index 00000000..06b66ce7 --- /dev/null +++ b/releasenotes/notes/fix-influxdb-parse-error-17402d74ffc39d4c.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Configuration option `ignore_parse_point_error` added to allow dropping + malformed InfluxDB data points. +fixes: + - | + Fixed handling of InfluxDB parse point errors in case these were not + validated in the API.