Store {} when value_meta is empty

Always store {} when value_meta is empty for Influxdb.

Needed because the Java Influxdb driver is
capable of storing an empty string, but the
Python Influxdb driver is not.

Change-Id: Id6b7b795454afc1a4ab2e6230c6a9d3bd94790f7
This commit is contained in:
Deklan Dieterly 2015-10-13 17:05:03 -06:00
parent 075002df2f
commit f88f71c51f
2 changed files with 4 additions and 5 deletions

View File

@ -95,9 +95,9 @@ public class InfluxV9MetricRepo extends InfluxMetricRepo {
String valueMetaJSONString = measurement.getValueMetaJSONString();
if (valueMetaJSONString == null) {
if (valueMetaJSONString == null || valueMetaJSONString.isEmpty()) {
valueMap.put("value_meta", "");
valueMap.put("value_meta", "{}");
} else {

View File

@ -517,7 +517,7 @@ class MetricPersister(AbstractPersister):
else:
value_meta = ''
value_meta = {}
LOG.debug('value_meta: %s', value_meta)
@ -533,8 +533,7 @@ class MetricPersister(AbstractPersister):
"fields": {
"value": value,
"value_meta": json.dumps(value_meta,
ensure_ascii=False).encode(
'utf8') if value_meta else value_meta.encode('utf8')
ensure_ascii=False).encode('utf8')
},
"tags": tags}