| 20 | """Collector for files for multi-process mode.""" |
| 21 | |
| 22 | def __init__(self, registry, path=None): |
| 23 | if path is None: |
| 24 | # This deprecation warning can go away in a few releases when removing the compatibility |
| 25 | if 'prometheus_multiproc_dir' in os.environ and 'PROMETHEUS_MULTIPROC_DIR' not in os.environ: |
| 26 | os.environ['PROMETHEUS_MULTIPROC_DIR'] = os.environ['prometheus_multiproc_dir'] |
| 27 | warnings.warn("prometheus_multiproc_dir variable has been deprecated in favor of the upper case naming PROMETHEUS_MULTIPROC_DIR", DeprecationWarning) |
| 28 | path = os.environ.get('PROMETHEUS_MULTIPROC_DIR') |
| 29 | if not path or not os.path.isdir(path): |
| 30 | raise ValueError('env PROMETHEUS_MULTIPROC_DIR is not set or not a directory') |
| 31 | self._path = path |
| 32 | if registry: |
| 33 | registry.register(self) |
| 34 | |
| 35 | @staticmethod |
| 36 | def merge(files, accumulate=True): |