]> arthur.barton.de Git - netdata.git/commitdiff
do not escape everything
authorpaulfantom <paulfantom@gmail.com>
Thu, 23 Jun 2016 16:08:55 +0000 (18:08 +0200)
committerpaulfantom <paulfantom@gmail.com>
Thu, 23 Jun 2016 16:08:55 +0000 (18:08 +0200)
python.d/example.chart.py
python.d/python_modules/base.py

index ddf13c8c495cf3c1318e85be4dc63fa51233ae4a..bc1846b76daf90f00feae715d04d16b985a1feaa 100644 (file)
@@ -24,7 +24,7 @@ class Service(BaseService):
     def create(self):
         self.chart("example.python_random", '', 'A random number', 'random number',
                    'random', 'random', 'line', self.priority, self.update_every)
-        self.dimension('random1', '', 'absolute', 1, 1)
+        self.dimension('random1')
         self.commit()
         return True
     
index 6796d9e0fb05c75accc84b75d043c6ed57ec9593..1183c42886ed1a85cceeaf99decaa4cc106831e4 100644 (file)
@@ -142,13 +142,14 @@ class BaseService(threading.Thread):
         Converts *params to string and joins them with one space between every one.
         :param params: str/int/float
         """
-        self.data_stream += instruction + " "
+        self.data_stream += instruction
         for p in params:
             p = str(p)
             if len(p) == 0:
-                p = ""
-            self.data_stream += "'" + p
-            self.data_stream += "' "
+                p = "''"
+            if ' ' in p:
+                p = "'" + p + "'"
+            self.data_stream += " " + p
         self.data_stream += "\n"
 
     def chart(self, type_id, name="", title="", units="", family="",
@@ -192,6 +193,8 @@ class BaseService(threading.Thread):
             divisor = 1
         if name is None:
             name = id
+        if algorithm not in ("absolute", "incremental", "percentage-of-absolute-row", "percentage-of-incremental-row"):
+            algorithm = "absolute"
 
         self.dimensions.append(id)
         if hidden: