helpful error message when multiprocessing dir env is unset#206
Merged
brian-brazil merged 3 commits intoprometheus:masterfrom Oct 26, 2017
Merged
Conversation
… 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
prometheus_client/multiprocess.py
Outdated
| 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): |
Contributor
There was a problem hiding this comment.
You should check that it is a directory
Contributor
Author
|
@brian-brazil I've changed the code to check for directories, I can squash the commits if you prefer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On head it fails with:
With this change: