@cryptotaxi247 / netdata-1 / commits / afd07313d

python.d: always create a runtime chart on `create` call (#10296)

Ilya Mashchenko committed Nov 30, 2020 at 18:12 UTC afd07313d0a10aff360529050b8a84a5d32d0f1d
2 files changed +13 -6
collectors/python.d.plugin/alarms/alarms.conf
+1 -1
@@ -20,7 +20,7 @@
20
21 # update_every sets the default data collection frequency.
22 # If unset, the python.d.plugin default is used.
23 -update_every: 5
23 +# update_every: 10
24
25 # priority controls the order of charts at the netdata dashboard.
26 # Lower numbers move the charts towards the top of the page.
collectors/python.d.plugin/python_modules/bases/charts.py
+12 -5
@@ -16,8 +16,7 @@ CHART_BEGIN = 'BEGIN {type}.{id} {since_last}\n'
16 CHART_CREATE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
17 "{chart_type} {priority} {update_every} '{hidden}' 'python.d.plugin' '{module_name}'\n"
18 CHART_OBSOLETE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
19 - "{chart_type} {priority} {update_every} '{hidden} obsolete'\n"
20 -
19 + "{chart_type} {priority} {update_every} '{hidden} obsolete'\n"
20
21 DIMENSION_CREATE = "DIMENSION '{id}' '{name}' {algorithm} {multiplier} {divisor} '{hidden} {obsolete}'\n"
22 DIMENSION_SET = "SET '{id}' = {value}\n"
@@ -40,13 +39,17 @@ def create_runtime_chart(func):
39 :param func: class method
40 :return:
41 """
42 +
43 def wrapper(*args, **kwargs):
44 self = args[0]
45 + chart = RUNTIME_CHART_CREATE.format(
46 + job_name=self.name,
47 + update_every=self._runtime_counters.update_every,
48 + )
49 + safe_print(chart)
50 ok = func(*args, **kwargs)
46 - if ok:
47 - safe_print(RUNTIME_CHART_CREATE.format(job_name=self.name,
48 - update_every=self._runtime_counters.update_every))
51 return ok
52 +
53 return wrapper
54
55
@@ -72,6 +75,7 @@ class Charts:
75 All charts stored in a dict.
76 Chart is a instance of Chart class.
77 Charts adding must be done using Charts.add_chart() method only"""
78 +
79 def __init__(self, job_name, priority, cleanup, get_update_every, module_name):
80 """
81 :param job_name: <bound method>
@@ -138,6 +142,7 @@ class Charts:
142
143 class Chart:
144 """Represent a chart"""
145 +
146 def __init__(self, params):
147 """
148 :param params: <list>
@@ -281,6 +286,7 @@ class Chart:
286
287 class Dimension:
288 """Represent a dimension"""
289 +
290 def __init__(self, params):
291 """
292 :param params: <list>
@@ -346,6 +352,7 @@ class Dimension:
352
353 class ChartVariable:
354 """Represent a chart variable"""
355 +
356 def __init__(self, params):
357 """
358 :param params: <list>