From e87fbe39717233f8488f1809a9788346ad0f91df Mon Sep 17 00:00:00 2001 From: Michael Bielinski Date: Mon, 2 Nov 2015 12:30:43 -0600 Subject: [PATCH] force measurement value to type float before writing to db whole number values (such as 0) are json decoded as type int If the value field is first written to InfluxDB as type int (example: 0) and later as type float (example 0.123), InfluxDB throws a "field type conflict" exception. Forcing all data to type float fixes. Change-Id: Ifc139bbc67077137501ffe9045a988b8afc393e4 --- monasca_persister/persister.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monasca_persister/persister.py b/monasca_persister/persister.py index 59ddecae..cf082c66 100644 --- a/monasca_persister/persister.py +++ b/monasca_persister/persister.py @@ -526,7 +526,7 @@ class MetricPersister(AbstractPersister): time_stamp = metric['timestamp'] LOG.debug('timestamp %s', time_stamp) - value = metric['value'] + value = float(metric['value']) LOG.debug('value: %s', value) if 'value_meta' in metric and metric['value_meta']: