some points unable to parse

some metrics get from kafka,may not a standard point that
influxdb can parse.in this case,points should be dropped.

Task: 29641
Story: 2005069

Change-Id: Ib907a280ced26ef2c228efe14b57440f894d8aad
This commit is contained in:
zhangjianweibj 2019-02-22 14:24:11 +08:00 committed by Witek Bedyk
parent 47e5d1b4c6
commit 0ab568481f
3 changed files with 22 additions and 1 deletions

View File

@ -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')

View File

@ -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))

View File

@ -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.