Skip to content

Commit 0e1f935

Browse files
authored
Merge pull request #312 from maxday/maxday/lazy-load-samplers
Lazy load samplers to speed up coldstart in a Lambda environment
2 parents 86248a5 + f4b33f0 commit 0e1f935

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aws_xray_sdk/core/recorder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
from .models.default_dynamic_naming import DefaultDynamicNaming
1313
from .models.dummy_entities import DummySegment, DummySubsegment
1414
from .emitters.udp_emitter import UDPEmitter
15-
from .sampling.sampler import DefaultSampler
16-
from .sampling.local.sampler import LocalSampler
1715
from .streaming.default_streaming import DefaultStreaming
1816
from .context import Context
1917
from .daemon_config import DaemonConfig
@@ -58,10 +56,12 @@ def __init__(self):
5856
context = check_in_lambda()
5957
if context:
6058
# Special handling when running on AWS Lambda.
59+
from .sampling.local.sampler import LocalSampler
6160
self._context = context
6261
self.streaming_threshold = 0
6362
self._sampler = LocalSampler()
6463
else:
64+
from .sampling.sampler import DefaultSampler
6565
self._context = Context()
6666
self._sampler = DefaultSampler()
6767

0 commit comments

Comments
 (0)