4040HTTP_URL = attributes_helper .COMMON_ATTRIBUTES ['HTTP_URL' ]
4141HTTP_STATUS_CODE = attributes_helper .COMMON_ATTRIBUTES ['HTTP_STATUS_CODE' ]
4242
43- BLACKLIST_PATHS = 'BLACKLIST_PATHS '
44- BLACKLIST_HOSTNAMES = 'BLACKLIST_HOSTNAMES '
43+ EXCLUDELIST_PATHS = 'EXCLUDELIST_PATHS '
44+ EXCLUDELIST_HOSTNAMES = 'EXCLUDELIST_HOSTNAMES '
4545
4646log = logging .getLogger (__name__ )
4747
@@ -52,8 +52,8 @@ class FlaskMiddleware(object):
5252 :type app: :class: `~flask.Flask`
5353 :param app: A flask application.
5454
55- :type blacklist_paths : list
56- :param blacklist_paths : Paths that do not trace.
55+ :type excludelist_paths : list
56+ :param excludelist_paths : Paths that do not trace.
5757
5858 :type sampler: :class:`~opencensus.trace.samplers.base.Sampler`
5959 :param sampler: A sampler. It should extend from the base
@@ -76,10 +76,10 @@ class FlaskMiddleware(object):
7676 :class:`.TextFormatPropagator`.
7777 """
7878
79- def __init__ (self , app = None , blacklist_paths = None , sampler = None ,
79+ def __init__ (self , app = None , excludelist_paths = None , sampler = None ,
8080 exporter = None , propagator = None ):
8181 self .app = app
82- self .blacklist_paths = blacklist_paths
82+ self .excludelist_paths = excludelist_paths
8383 self .sampler = sampler
8484 self .exporter = exporter
8585 self .propagator = propagator
@@ -112,10 +112,10 @@ def init_app(self, app):
112112 if isinstance (self .propagator , six .string_types ):
113113 self .propagator = configuration .load (self .propagator )
114114
115- self .blacklist_paths = settings .get (BLACKLIST_PATHS ,
116- self .blacklist_paths )
115+ self .excludelist_paths = settings .get (EXCLUDELIST_PATHS ,
116+ self .excludelist_paths )
117117
118- self .blacklist_hostnames = settings .get (BLACKLIST_HOSTNAMES , None )
118+ self .excludelist_hostnames = settings .get (EXCLUDELIST_HOSTNAMES , None )
119119
120120 self .setup_trace ()
121121
@@ -129,8 +129,10 @@ def _before_request(self):
129129
130130 See: http://flask.pocoo.org/docs/0.12/api/#flask.Flask.before_request
131131 """
132- # Do not trace if the url is blacklisted
133- if utils .disable_tracing_url (flask .request .url , self .blacklist_paths ):
132+ # Do not trace if the url is in the exclude list
133+ if utils .disable_tracing_url (
134+ flask .request .url , self .excludelist_paths
135+ ):
134136 return
135137
136138 try :
@@ -161,8 +163,8 @@ def _before_request(self):
161163 HTTP_URL , str (flask .request .url )
162164 )
163165 execution_context .set_opencensus_attr (
164- 'blacklist_hostnames ' ,
165- self .blacklist_hostnames
166+ 'excludelist_hostnames ' ,
167+ self .excludelist_hostnames
166168 )
167169 except Exception : # pragma: NO COVER
168170 log .error ('Failed to trace request' , exc_info = True )
@@ -172,8 +174,10 @@ def _after_request(self, response):
172174
173175 See: http://flask.pocoo.org/docs/0.12/api/#flask.Flask.after_request
174176 """
175- # Do not trace if the url is blacklisted
176- if utils .disable_tracing_url (flask .request .url , self .blacklist_paths ):
177+ # Do not trace if the url is in the exclude list
178+ if utils .disable_tracing_url (
179+ flask .request .url , self .excludelist_paths
180+ ):
177181 return response
178182
179183 try :
@@ -193,8 +197,10 @@ def _after_request(self, response):
193197 return response
194198
195199 def _teardown_request (self , exception ):
196- # Do not trace if the url is blacklisted
197- if utils .disable_tracing_url (flask .request .url , self .blacklist_paths ):
200+ # Do not trace if the url is in the exclude list
201+ if utils .disable_tracing_url (
202+ flask .request .url , self .excludelist_paths
203+ ):
198204 return
199205
200206 try :
0 commit comments