do not update chart if no SET found
paulfantom committed
Jul 19, 2016 at 14:28 UTC
2d95b11aaeb3f726739087db21d39579314c8835
1 file changed
+8
-1
python.d/python_modules/base.py
+8
-1
@@ -41,6 +41,7 @@ class BaseService(threading.Thread):
41
self.chart_name = ""
42
self._dimensions = []
43
self._charts = []
44
+ self.__chart_set = False
45
if configuration is None:
46
self.error("BaseService: no configuration parameters supplied. Cannot create Service.")
47
raise RuntimeError
@@ -280,10 +281,16 @@ class BaseService(threading.Thread):
281
self.error("cannot set non-numeric value:", value)
282
return False
283
self._line("SET", id, "=", str(value))
284
+ self.__chart_set = True
285
return True
286
287
def end(self):
286
- self._line("END")
288
+ if self.__chart_set:
289
+ self._line("END")
290
+ self.__chart_set = False
291
+ else:
292
+ pos = self._data_stream.rfind("BEGIN")
293
+ self._data_stream = self._data_stream[:pos]
294
295
def commit(self):
296
"""