10BC0 helpful error message when multiprocessing dir env is unset by dbalan · Pull Request #206 · prometheus/client_python · GitHub
[go: up one dir, main page]

Skip to content

Conversation

dbalan
Copy link
Contributor
@dbalan dbalan commented Oct 25, 2017

On head it fails with:

ERROR in app: Exception on /metrics [GET]
AttributeError: 'NoneType' object has no attribute 'endswith'

With this change:

  File "build/bdist.linux-x86_64/egg/prometheus_client/multiprocess.py", line 16, in __init__
    raise ValueError('env prometheus_multiproc_dir is not set or not accessible')
ValueError: env prometheus_multiproc_dir is not set or not accessible

… set.

On head it fails with:
ERROR in app: Exception on /metrics [GET]
AttributeError: 'NoneType' object has no attribute 'endswith'

With this change:
  File "build/bdist.linux-x86_64/egg/prometheus_client/multiprocess.py", line 16, in __init__
    raise ValueError('env prometheus_multiproc_dir is not set or not accessible')
ValueError: env prometheus_multiproc_dir is not set or not accessible
@dbalan dbalan changed the title Adds a helpful error message when multiprocessing sync dir env is not… helpful error message when multiprocessing dir env is unset Oct 25, 2017
class MultiProcessCollector(object):
"""Collector for files for multi-process mode."""
def __init__(self, registry, path=os.environ.get('prometheus_multiproc_dir')):
if not path or not os.path.exists(path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check that it is a directory

@dbalan
Copy link
Contributor Author
dbalan commented Oct 26, 2017

@brian-brazil I've changed the code to check for directories, I can squash the commits if you prefer.

@brian-brazil brian-brazil merged commit 7249378 into prometheus:master Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0