This repository was archived by the owner on Jun 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-11
lines changed
Expand file tree Collapse file tree 3 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -481,6 +481,8 @@ Advanced options can be configured as a parameter to the init() method or as env
481481| - | DISABLE_EPSAGON_PATCH | Boolean| ` False ` | Disable the library patching (instrumentation) |
482482| - | EPSAGON_LAMBDA_TIMEOUT_THRESHOLD_MS | Integer| ` 200 ` | The threshold in millieseconds to send the trace before a Lambda timeout occurs |
483483| - | EPSAGON_PAYLOADS_TO_IGNORE | List | - | Array of dictionaries to not instrument. Example: ` '[{"source": "serverless-plugin-warmup"}]' ` |
484+ | - | EPSAGON_REMOVE_EXCEPTION_FRAMES| Boolean| ` False ` | Disable the automatic capture of exception frames data |
485+
484486
485487
486488## Getting Help
Original file line number Diff line number Diff line change 4242# List of ignored endpoints for web frameworks.
4343IGNORED_ENDPOINTS = []
4444
45+ # Indicates whether to skip collection of the exception frames part
46+ SHOULD_REMOVE_EXCEPTION_FRAMES = (
47+ os .getenv ('EPSAGON_REMOVE_EXCEPTION_FRAMES' , 'false' ).lower () == 'true'
48+ )
49+
4550EPSAGON_MARKER = '__EPSAGON'
4651EPSAGON_HEADER = 'epsagon-trace-id'
4752# In some web frameworks, there is an automated capitalization
Original file line number Diff line number Diff line change 88import inspect
99import uuid
1010from .common import ErrorCode
11+ from .constants import (
12+ SHOULD_REMOVE_EXCEPTION_FRAMES ,
13+ )
1114
1215
1316class BaseEvent (object ):
@@ -152,19 +155,20 @@ def set_exception(
152155 traceback_data
153156 )
154157 self .exception ['time' ] = time .time ()
155-
158+ # Check if to collect the frames
156159 # Adding python frames (input data of functions in stack) in python 3.
157160 # Ignoring filenames with /epsagon since they are ours.
158- if sys .version_info .major == 3 :
159- self .exception ['frames' ] = {
160- '/' .join ([
161- frame .filename ,
162- frame .function ,
163- str (frame .lineno )
164- ]): frame .frame .f_locals
165- for frame in inspect .trace ()
166- if '/epsagon' not in frame .filename and frame .frame .f_locals
167- }
161+ if not SHOULD_REMOVE_EXCEPTION_FRAMES :
162+ if sys .version_info .major == 3 :
163+ self .exception ['frames' ] = {
164+ '/' .join ([
165+ frame .filename ,
166+ frame .function ,
167+ str (frame .lineno )
168+ ]): frame .frame .f_locals
169+ for frame in inspect .trace ()
170+ if '/epsagon' not in frame .filename and frame .frame .f_locals
171+ }
168172 self .exception .setdefault ('additional_data' , {})['handled' ] = handled
169173 if from_logs :
170174 self .exception ['additional_data' ]['from_logs' ] = True
You can’t perform that action at this time.
0 commit comments