diff --git a/aws_xray_sdk/core/context.py b/aws_xray_sdk/core/context.py index 53d9cf80..309dc861 100644 --- a/aws_xray_sdk/core/context.py +++ b/aws_xray_sdk/core/context.py @@ -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' @@ -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) diff --git a/docs/configurations.rst b/docs/configurations.rst index eca0f693..fdc7b042 100644 --- a/docs/configurations.rst +++ b/docs/configurations.rst @@ -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 ----------------------