added debugging info to python.d.plugin; added FIXME comments in problematic places
Costa Tsaousis committed
Jun 22, 2016 at 01:56 UTC
482b4c1de4774115eeefbc09759397663d001cc9
2 files changed
+14
-3
plugins.d/python.d.plugin
+10
-3
@@ -167,7 +167,7 @@ class PythonCharts(object):
167
else:
168
return imp.load_source(name, path)
169
except Exception as e:
170
- debug("Problem loading", name, str(e))
170
+ error("Problem loading", name, str(e))
171
return None
172
173
def _load_modules(self, path, modules, disabled):
@@ -255,6 +255,7 @@ class PythonCharts(object):
255
# get default values
256
defaults = {}
257
for key in BASE_CONFIG:
258
+ # FIXME for some reason this is called 3 times per module
259
debug(module.__name__ + ": reading configuration")
260
try:
261
# get defaults from module config
@@ -364,6 +365,8 @@ class PythonCharts(object):
365
if not job.check():
366
self._stop(job, "failed check")
367
else:
368
+ # FIXME job.name is incomplete here
369
+ # it shows None is example and only the job name without the module in mysql
370
debug(job.name, ": check succeeded")
371
i += 1
372
except AttributeError:
@@ -418,13 +421,14 @@ class PythonCharts(object):
421
t_start = time.time()
422
# check if it is time to execute job update() function
423
if job.timetable['next'] > t_start:
421
- debug("it is not a time to invoke update on", job.chart_name)
424
+ debug(job.chart_name + " will be run in " + str(int((job.timetable['next'] - t_start) * 1000)) + " ms")
425
return True
426
try:
427
if self.first_run:
428
since_last = 0
429
else:
430
since_last = int((t_start - job.timetable['last']) * 1000000)
431
+ debug(job.chart_name + " ready to run, after " + str(int((t_start - job.timetable['last']) * 1000)) + " ms (update_every: " + str(job.timetable['freq'] * 1000) + " ms, latency: " + str(int((t_start - job.timetable['next']) * 1000)) + " ms)")
432
if not job.update(since_last):
433
if job.retries_left <= 0:
434
self._stop(job, "update failed")
@@ -442,7 +446,7 @@ class PythonCharts(object):
446
job.timetable['next'] = t_end - (t_end % job.timetable['freq']) + job.timetable['freq']
447
# draw performance graph
448
run_time = str(int((t_end - t_start) * 1000))
445
- debug(job.chart_name, "updated in", run_time)
449
+ debug(job.chart_name, "updated in", run_time, "ms")
450
sys.stdout.write("BEGIN netdata.plugin_pythond_" + job.chart_name + " " + str(since_last) + '\n')
451
sys.stdout.write("SET run_time = " + run_time + '\n')
452
sys.stdout.write("END\n")
@@ -515,6 +519,9 @@ def parse_cmdline(directory, *commands):
519
mods.append(cmd.replace(".chart.py", ""))
520
else:
521
try:
522
+ # FIXME for some reason this overwrites the module configuration
523
+ # it should not - it is always passed by netdata to its plugins
524
+ # so, the update_every in modules configurations will never be used
525
BASE_CONFIG['update_every'] = int(cmd)
526
OVERRIDE_UPDATE_EVERY = True
527
debug(PROGRAM, "overriding update interval to", str(int(cmd)))
python.d/pip_install.sh
+4
@@ -1,5 +1,9 @@
1
#!/bin/bash
2
3
+# FIXME
4
+# 1. make sure you are in the proper directory
5
+# 2. In fedora 24, the python modules names are not known
6
+
7
PIP=`which pip`
8
9
${PIP} install --target="python_modules" yaml