-
Notifications
You must be signed in to change notification settings - Fork 854
Multiprocess environment variable in upper case #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
2d2fc94
156a5e8
3ab5a3c
c451b2e
9bcbb68
38c65cf
2ba399d
e448d98
8028b6f
63e6cd5
48c4fb6
02209e0
cf2d434
64e584d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
|
|
||
| import os | ||
| from threading import Lock | ||
| import warnings | ||
|
|
||
| from .mmap_dict import mmap_key, MmapedDict | ||
|
|
||
|
|
@@ -64,7 +65,7 @@ def __reset(self): | |
| file_prefix = typ | ||
| if file_prefix not in files: | ||
| filename = os.path.join( | ||
| os.environ['prometheus_multiproc_dir'], | ||
| os.environ.get('PROMETHEUS_MULTIPROC_DIR'), | ||
|
marcaurele marked this conversation as resolved.
|
||
| '{0}_{1}.db'.format(file_prefix, pid['value'])) | ||
|
|
||
| files[file_prefix] = MmapedDict(filename) | ||
|
|
@@ -108,7 +109,10 @@ def get_value_class(): | |
| # This needs to be chosen before the first metric is constructed, | ||
| # and as that may be in some arbitrary library the user/admin has | ||
| # no control over we use an environment variable. | ||
| if 'prometheus_multiproc_dir' in os.environ: | ||
| if 'prometheus_multiproc_dir' in os.environ and 'PROMETHEUS_MULTIPROC_DIR' not in os.environ: | ||
| os.environ['PROMETHEUS_MULTIPROC_DIR'] = os.environ['prometheus_multiproc_dir'] | ||
| warnings.warn("You should declare the env variable in upper case PROMETHEUS_MULTIPROC_DIR'", DeprecationWarning) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like I left a comment about the warnings in the overall comment instead of a specific one. My inclination is to allow either lower or upper case without any deprecation warnings as both are valid. Do you have any concerns with just allowing either?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to encourage people to use the upper case to follow standard practice in Unix env variables. If we don't put that in the readme, we don't say anything in the code to promote the use of the uppercase I don't see how people will move to that variable name in upper case.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems reasonable, let's keep the deprecation notice. I do plan to merge your README change after I do a release with this change as well. |
||
| if 'PROMETHEUS_MULTIPROC_DIR' in os.environ: | ||
| return MultiProcessValue() | ||
| else: | ||
| return MutexValue | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.