From 97e01009d69b8fbebfebf68f51e3d126d0ed43fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 30 Nov 2022 19:47:05 +0100 Subject: Merging upstream version 1.37.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/python.d.plugin.in | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'collectors/python.d.plugin/python.d.plugin.in') diff --git a/collectors/python.d.plugin/python.d.plugin.in b/collectors/python.d.plugin/python.d.plugin.in index c04cb3ff0..681ceb403 100644 --- a/collectors/python.d.plugin/python.d.plugin.in +++ b/collectors/python.d.plugin/python.d.plugin.in @@ -131,7 +131,7 @@ def dirs(): DIRS = dirs() -IS_ATTY = sys.stdout.isatty() +IS_ATTY = sys.stdout.isatty() or sys.stderr.isatty() MODULE_SUFFIX = '.chart.py' @@ -496,7 +496,16 @@ class FileLockRegistry: self.path = path self.locks = dict() + @staticmethod + def rename(name): + # go version name is 'docker' + if name.startswith("dockerd"): + name = "docker" + name[7:] + return name + + def register(self, name): + name = self.rename(name) if name in self.locks: return file = os.path.join(self.path, '{0}.collector.lock'.format(name)) @@ -505,6 +514,7 @@ class FileLockRegistry: self.locks[name] = lock def unregister(self, name): + name = self.rename(name) if name not in self.locks: return lock = self.locks[name] @@ -893,6 +903,11 @@ def main(): registry, ) + # cheap attempt to reduce chance of python.d job running before go.d + # TODO: better implementation needed + if not IS_ATTY: + time.sleep(1.5) + try: if not p.setup(): return -- cgit v1.2.3