diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-30 18:47:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-30 18:47:05 +0000 |
commit | 97e01009d69b8fbebfebf68f51e3d126d0ed43fc (patch) | |
tree | 02e8b836c3a9d89806f3e67d4a5fe9f52dbb0061 /collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py | |
parent | Releasing debian version 1.36.1-1. (diff) | |
download | netdata-97e01009d69b8fbebfebf68f51e3d126d0ed43fc.tar.xz netdata-97e01009d69b8fbebfebf68f51e3d126d0ed43fc.zip |
Merging upstream version 1.37.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py | 18 |
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 '-', |