summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2020-11-30 18:12:07 +0300
committerGitHub <noreply@github.com>2020-11-30 18:12:07 +0300
commitafd07313d0a10aff360529050b8a84a5d32d0f1d (patch)
treea90ad5ee2deed069f1ce1d1c8ac2af1c4a403d45 /collectors
parent95407a625c6a55f157cdf8b0e59096d178098d41 (diff)
python.d: always create a runtime chart on `create` call (#10296)
Diffstat (limited to 'collectors')
-rw-r--r--collectors/python.d.plugin/alarms/alarms.conf2
-rw-r--r--collectors/python.d.plugin/python_modules/bases/charts.py17
2 files changed, 13 insertions, 6 deletions
diff --git a/collectors/python.d.plugin/alarms/alarms.conf b/collectors/python.d.plugin/alarms/alarms.conf
index e851f4e15b..fd7780c595 100644
--- a/collectors/python.d.plugin/alarms/alarms.conf
+++ b/collectors/python.d.plugin/alarms/alarms.conf
@@ -20,7 +20,7 @@
# update_every sets the default data collection frequency.
# If unset, the python.d.plugin default is used.
-update_every: 5
+# update_every: 10
# priority controls the order of charts at the netdata dashboard.
# Lower numbers move the charts towards the top of the page.
diff --git a/collectors/python.d.plugin/python_modules/bases/charts.py b/collectors/python.d.plugin/python_modules/bases/charts.py
index 6e78ed6e7c..93be43d149 100644
--- a/collectors/python.d.plugin/python_modules/bases/charts.py
+++ b/collectors/python.d.plugin/python_modules/bases/charts.py
@@ -16,8 +16,7 @@ CHART_BEGIN = 'BEGIN {type}.{id} {since_last}\n'
CHART_CREATE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
"{chart_type} {priority} {update_every} '{hidden}' 'python.d.plugin' '{module_name}'\n"
CHART_OBSOLETE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
- "{chart_type} {priority} {update_every} '{hidden} obsolete'\n"
-
+ "{chart_type} {priority} {update_every} '{hidden} obsolete'\n"
DIMENSION_CREATE = "DIMENSION '{id}' '{name}' {algorithm} {multiplier} {divisor} '{hidden} {obsolete}'\n"
DIMENSION_SET = "SET '{id}' = {value}\n"
@@ -40,13 +39,17 @@ def create_runtime_chart(func):
:param func: class method
:return:
"""
+
def wrapper(*args, **kwargs):
self = args[0]
+ chart = RUNTIME_CHART_CREATE.format(
+ job_name=self.name,
+ update_every=self._runtime_counters.update_every,
+ )
+ safe_print(chart)
ok = func(*args, **kwargs)
- if ok:
- safe_print(RUNTIME_CHART_CREATE.format(job_name=self.name,
- update_every=self._runtime_counters.update_every))
return ok
+
return wrapper
@@ -72,6 +75,7 @@ class Charts:
All charts stored in a dict.
Chart is a instance of Chart class.
Charts adding must be done using Charts.add_chart() method only"""
+
def __init__(self, job_name, priority, cleanup, get_update_every, module_name):
"""
:param job_name: <bound method>
@@ -138,6 +142,7 @@ class Charts:
class Chart:
"""Represent a chart"""
+
def __init__(self, params):
"""
:param params: <list>
@@ -281,6 +286,7 @@ class Chart:
class Dimension:
"""Represent a dimension"""
+
def __init__(self, params):
"""
:param params: <list>
@@ -346,6 +352,7 @@ class Dimension:
class ChartVariable:
"""Represent a chart variable"""
+
def __init__(self, params):
"""
:param params: <list>