From f4b33f0920a28d87a59979e1262b5511c80a6dfd Mon Sep 17 00:00:00 2001 From: maxday Date: Tue, 17 Aug 2021 08:51:17 -0400 Subject: [PATCH] lazy load samplers --- aws_xray_sdk/core/recorder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws_xray_sdk/core/recorder.py b/aws_xray_sdk/core/recorder.py index 63ae1170..7f223e24 100644 --- a/aws_xray_sdk/core/recorder.py +++ b/aws_xray_sdk/core/recorder.py @@ -12,8 +12,6 @@ from .models.default_dynamic_naming import DefaultDynamicNaming from .models.dummy_entities import DummySegment, DummySubsegment from .emitters.udp_emitter import UDPEmitter -from .sampling.sampler import DefaultSampler -from .sampling.local.sampler import LocalSampler from .streaming.default_streaming import DefaultStreaming from .context import Context from .daemon_config import DaemonConfig @@ -58,10 +56,12 @@ def __init__(self): context = check_in_lambda() if context: # Special handling when running on AWS Lambda. + from .sampling.local.sampler import LocalSampler self._context = context self.streaming_threshold = 0 self._sampler = LocalSampler() else: + from .sampling.sampler import DefaultSampler self._context = Context() self._sampler = DefaultSampler()