|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -import inspect |
16 | 15 | import logging |
17 | 16 | import random |
18 | 17 | import sys |
|
23 | 22 | from newrelic.api.settings import STRIP_EXCEPTION_MESSAGE |
24 | 23 | from newrelic.common.object_names import parse_exc_info |
25 | 24 | from newrelic.core.attribute import MAX_NUM_USER_ATTRIBUTES, process_user_attribute |
26 | | -from newrelic.core.config import is_expected_error, should_ignore_error |
27 | 25 | from newrelic.core.code_level_metrics import ( |
28 | 26 | extract_code_from_callable, |
29 | 27 | extract_code_from_traceback, |
30 | 28 | ) |
| 29 | +from newrelic.core.config import is_expected_error, should_ignore_error |
31 | 30 | from newrelic.core.trace_cache import trace_cache |
32 | 31 |
|
33 | 32 | _logger = logging.getLogger(__name__) |
@@ -119,7 +118,9 @@ def __enter__(self): |
119 | 118 | self.activated = True |
120 | 119 |
|
121 | 120 | # Extract source code context |
122 | | - settings = self.settings or self.transaction.settings # Some derived classes do not have self.settings immediately |
| 121 | + settings = ( |
| 122 | + self.settings or self.transaction.settings |
| 123 | + ) # Some derived classes do not have self.settings immediately |
123 | 124 | if self._source is not None: |
124 | 125 | self.add_code_level_metrics(self._source) |
125 | 126 |
|
@@ -212,7 +213,10 @@ def add_code_level_metrics(self, source): |
212 | 213 | node = extract_code_from_callable(source) |
213 | 214 | node.add_attrs(self._add_agent_attribute) |
214 | 215 | except: |
215 | | - _logger.error("Failed to extract source code context from callable %s. Report this issue to newrelic support." % source) |
| 216 | + _logger.error( |
| 217 | + "Failed to extract source code context from callable %s. Report this issue to newrelic support." |
| 218 | + % source |
| 219 | + ) |
216 | 220 |
|
217 | 221 | def _observe_exception(self, exc_info=None, ignore=None, expected=None, status_code=None): |
218 | 222 | # Bail out if the transaction is not active or |
@@ -256,7 +260,7 @@ def _observe_exception(self, exc_info=None, ignore=None, expected=None, status_c |
256 | 260 |
|
257 | 261 | # Check to see if we need to strip the message before recording it. |
258 | 262 |
|
259 | | - if settings.strip_exception_messages.enabled and fullname not in settings.strip_exception_messages.whitelist: |
| 263 | + if settings.strip_exception_messages.enabled and fullname not in settings.strip_exception_messages.allowlist: |
260 | 264 | message = STRIP_EXCEPTION_MESSAGE |
261 | 265 |
|
262 | 266 | # Where expected or ignore are a callable they should return a |
@@ -384,7 +388,6 @@ def notice_error(self, error=None, attributes=None, expected=None, ignore=None, |
384 | 388 | ) |
385 | 389 | custom_params = {} |
386 | 390 |
|
387 | | - |
388 | 391 | if settings and settings.code_level_metrics and settings.code_level_metrics.enabled: |
389 | 392 | source = extract_code_from_traceback(tb) |
390 | 393 | else: |
|
0 commit comments