summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py')
-rw-r--r--collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
index ed1b2e669..a7acc23b6 100644
--- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
+++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
@@ -4,14 +4,13 @@
# Author: Ilya Mashchenko (ilyam8)
# SPDX-License-Identifier: GPL-3.0-or-later
-
-from time import sleep, time
-
-from third_party.monotonic import monotonic
+import os
from bases.charts import Charts, ChartError, create_runtime_chart
from bases.collection import safe_print
from bases.loggers import PythonDLimitedLogger
+from third_party.monotonic import monotonic
+from time import sleep, time
RUNTIME_CHART_UPDATE = 'BEGIN netdata.runtime_{job_name} {since_last}\n' \
'SET run_time = {elapsed}\n' \
@@ -20,6 +19,8 @@ RUNTIME_CHART_UPDATE = 'BEGIN netdata.runtime_{job_name} {since_last}\n' \
PENALTY_EVERY = 5
MAX_PENALTY = 10 * 60 # 10 minutes
+ND_INTERNAL_MONITORING_DISABLED = os.getenv("NETDATA_INTERNALS_MONITORING") == "NO"
+
class RuntimeCounters:
def __init__(self, configuration):
@@ -79,11 +80,13 @@ class SimpleService(PythonDLimitedLogger, object):
self.module_name = clean_module_name(self.__module__)
self.job_name = configuration.pop('job_name')
+ self.actual_job_name = self.job_name or self.module_name
self.override_name = configuration.pop('override_name')
self.fake_name = None
self._runtime_counters = RuntimeCounters(configuration=configuration)
self.charts = Charts(job_name=self.actual_name,
+ actual_job_name=self.actual_job_name,
priority=configuration.pop('priority'),
cleanup=configuration.pop('chart_cleanup'),
get_update_every=self.get_update_every,
@@ -208,9 +211,10 @@ class SimpleService(PythonDLimitedLogger, object):
job.elapsed = int((monotonic() - job.start_mono) * 1e3)
job.prev_update = job.start_real
job.retries, job.penalty = 0, 0
- safe_print(RUNTIME_CHART_UPDATE.format(job_name=self.name,
- since_last=since,
- elapsed=job.elapsed))
+ if not ND_INTERNAL_MONITORING_DISABLED:
+ safe_print(RUNTIME_CHART_UPDATE.format(job_name=self.name,
+ since_last=since,
+ elapsed=job.elapsed))
self.debug('update => [{status}] (elapsed time: {elapsed}, failed retries in a row: {retries})'.format(
status='OK' if updated else 'FAILED',
elapsed=job.elapsed if updated else '-',