plugin_name, module_name added to CHART lines
lgz committed
Nov 5, 2017 at 22:28 UTC
3eea0ab283d133456cbd62100ed72e9f492ae363
2 files changed
+6
-3
python.d/python_modules/bases/FrameworkServices/SimpleService.py
+2
-1
@@ -65,7 +65,8 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec
65
self.charts = Charts(job_name=self.actual_name,
66
priority=configuration.pop('priority'),
67
cleanup=configuration.pop('chart_cleanup'),
68
- get_update_every=self.get_update_every)
68
+ get_update_every=self.get_update_every,
69
+ module_name=self.module_name)
70
71
def __repr__(self):
72
return '<{cls_bases}: {name}>'.format(cls_bases=', '.join(c.__name__ for c in self.__class__.__bases__),
python.d/python_modules/bases/charts.py
+4
-2
@@ -13,7 +13,7 @@ DIMENSION_ALGORITHMS = ['absolute', 'incremental', 'percentage-of-absolute-row',
13
14
CHART_BEGIN = 'BEGIN {type}.{id} {since_last}\n'
15
CHART_CREATE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
16
- "{chart_type} {priority} {update_every}\n"
16
+ "{chart_type} {priority} {update_every} '' 'python.d.plugin' '{module_name}'\n"
17
CHART_OBSOLETE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
18
"{chart_type} {priority} {update_every} 'obsolete'\n"
19
@@ -71,7 +71,7 @@ class Charts:
71
All charts stored in a dict.
72
Chart is a instance of Chart class.
73
Charts adding must be done using Charts.add_chart() method only"""
74
- def __init__(self, job_name, priority, cleanup, get_update_every):
74
+ def __init__(self, job_name, priority, cleanup, get_update_every, module_name):
75
"""
76
:param job_name: <bound method>
77
:param priority: <int>
@@ -81,6 +81,7 @@ class Charts:
81
self.priority = priority
82
self.cleanup = cleanup
83
self.get_update_every = get_update_every
84
+ self.module_name = module_name
85
self.charts = dict()
86
87
def __len__(self):
@@ -123,6 +124,7 @@ class Charts:
124
125
new_chart.params['update_every'] = self.get_update_every()
126
new_chart.params['priority'] = self.priority
127
+ new_chart.params['module_name'] = self.module_name
128
129
self.priority += 1
130
self.charts[new_chart.id] = new_chart