@@ -52,6 +52,12 @@ class MmapedValue(object):
5252
5353 def __init__ (self , typ , metric_name , name , labelnames , labelvalues , multiprocess_mode = '' , ** kwargs ):
5454 self ._params = typ , metric_name , name , labelnames , labelvalues , multiprocess_mode
55+ # This deprecation warning can go away in a few releases when removing the compatibility
56+ if 'prometheus_multiproc_dir' in os .environ and 'PROMETHEUS_MULTIPROC_DIR' in os .environ :
57+ warnings .warn ("You have declared both env variable in upper case and lower case, keep the upper case only PROMETHEUS_MULTIPROC_DIR'" , DeprecationWarning )
58+ if 'prometheus_multiproc_dir' in os .environ and 'PROMETHEUS_MULTIPROC_DIR' not in os .environ :
59+ os .environ ['PROMETHEUS_MULTIPROC_DIR' ] = os .environ ['prometheus_multiproc_dir' ]
60+ warnings .warn ("You should declare the env variable in upper case PROMETHEUS_MULTIPROC_DIR'" , DeprecationWarning )
5561 with lock :
5662 self .__check_for_pid_change ()
5763 self .__reset ()
@@ -109,10 +115,7 @@ def get_value_class():
109115 # This needs to be chosen before the first metric is constructed,
110116 # and as that may be in some arbitrary library the user/admin has
111117 # no control over we use an environment variable.
112- if 'prometheus_multiproc_dir' in os .environ and 'PROMETHEUS_MULTIPROC_DIR' not in os .environ :
113- os .environ ['PROMETHEUS_MULTIPROC_DIR' ] = os .environ ['prometheus_multiproc_dir' ]
114- warnings .warn ("You should declare the env variable in upper case PROMETHEUS_MULTIPROC_DIR'" , DeprecationWarning )
115- if 'PROMETHEUS_MULTIPROC_DIR' in os .environ :
118+ if 'prometheus_multiproc_dir' in os .environ or 'PROMETHEUS_MULTIPROC_DIR' in os .environ :
116119 return MultiProcessValue ()
117120 else :
118121 return MutexValue
0 commit comments