Skip to content
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

add suport for IGNORE context missing strategy #126

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion aws_xray_sdk/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
log = logging.getLogger(__name__)

MISSING_SEGMENT_MSG = 'cannot find the current segment/subsegment, please make sure you have a segment open'
SUPPORTED_CONTEXT_MISSING = ('RUNTIME_ERROR', 'LOG_ERROR')
SUPPORTED_CONTEXT_MISSING = ('RUNTIME_ERROR', 'LOG_ERROR', 'IGNORE')
CXT_MISSING_STRATEGY_KEY = 'AWS_XRAY_CONTEXT_MISSING'


Expand Down Expand Up @@ -116,6 +116,8 @@ def handle_context_missing(self):
if self.context_missing == 'RUNTIME_ERROR':
log.error(MISSING_SEGMENT_MSG)
raise SegmentNotFoundException(MISSING_SEGMENT_MSG)
elif self.context_missing == 'IGNORE':
return
else:
log.error(MISSING_SEGMENT_MSG)

Expand Down
1 change: 1 addition & 0 deletions docs/configurations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Supported strategies are:

* RUNTIME_ERROR: throw an SegmentNotFoundException
* LOG_ERROR: log an error and continue
* IGNORE: do nothing

Segment Dynamic Naming
----------------------
Expand Down