Skip to content

Commit b0c0188

Browse files
committed
chore: fix test coverage
1 parent ec939c5 commit b0c0188

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: aws_lambda_powertools/tracing/tracer.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,9 @@ def __init__(
166166
if self.auto_patch:
167167
self.patch(modules=patch_modules)
168168

169-
if "aws_xray_sdk" in self.provider.__module__:
169+
if self._is_xray_provider():
170170
self._disable_xray_trace_batching()
171171

172-
def _disable_xray_trace_batching(self):
173-
"""Configure X-Ray SDK to send subsegment individually over batching
174-
Known issue: https://github.com/awslabs/aws-lambda-powertools-python/issues/283
175-
"""
176-
if self.disabled:
177-
logger.debug("Tracing has been disabled, aborting streaming override")
178-
return
179-
180-
aws_xray_sdk.core.xray_recorder.configure(streaming_threshold=0)
181-
182172
def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]):
183173
"""Adds annotation to existing segment or subsegment
184174
@@ -776,5 +766,15 @@ def _patch_xray_provider(self):
776766

777767
return provider
778768

769+
def _disable_xray_trace_batching(self):
770+
"""Configure X-Ray SDK to send subsegment individually over batching
771+
Known issue: https://github.com/awslabs/aws-lambda-powertools-python/issues/283
772+
"""
773+
if self.disabled:
774+
logger.debug("Tracing has been disabled, aborting streaming override")
775+
return
776+
777+
aws_xray_sdk.core.xray_recorder.configure(streaming_threshold=0)
778+
779779
def _is_xray_provider(self):
780780
return "aws_xray_sdk" in self.provider.__module__

0 commit comments

Comments
 (0)