Skip to content

Added the option to ignore missing segments #338

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

Merged
merged 6 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 2 deletions aws_xray_sdk/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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 @@ -121,7 +121,7 @@ def handle_context_missing(self):
"""
if self.context_missing == 'RUNTIME_ERROR':
raise SegmentNotFoundException(MISSING_SEGMENT_MSG)
else:
elif self.context_missing == 'LOG_ERROR':
log.error(MISSING_SEGMENT_MSG)

def _is_subsegment(self, entity):
Expand Down
1 change: 1 addition & 0 deletions aws_xray_sdk/core/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def configure(self, sampling=None, plugins=None,
RUNTIME_ERROR means the recorder will raise an exception.
LOG_ERROR means the recorder will only log the error and
do nothing.
IGNORE means the recorder will do nothing
:param str daemon_address: The X-Ray daemon address where the recorder
sends data to.
:param str service: default segment name if creating a segment without
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: will do nothing

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