2 from logging import Logger
3 from typing import Any, Callable, Iterable
5 from aws_xray_sdk import global_sdk_config as global_sdk_config
6 from aws_xray_sdk.version import VERSION as VERSION
8 from .context import Context as Context
9 from .daemon_config import DaemonConfig as DaemonConfig
10 from .emitters.udp_emitter import UDPEmitter as UDPEmitter
11 from .exceptions.exceptions import (
12 SegmentNameMissingException as SegmentNameMissingException,
13 SegmentNotFoundException as SegmentNotFoundException,
15 from .lambda_launcher import check_in_lambda as check_in_lambda
16 from .models.default_dynamic_naming import DefaultDynamicNaming as DefaultDynamicNaming
17 from .models.dummy_entities import DummySegment as DummySegment, DummySubsegment as DummySubsegment
18 from .models.segment import Segment as Segment, SegmentContextManager as SegmentContextManager
19 from .models.subsegment import Subsegment as Subsegment, SubsegmentContextManager as SubsegmentContextManager
20 from .plugins.utils import get_plugin_modules as get_plugin_modules
21 from .sampling.local.sampler import LocalSampler as LocalSampler
22 from .sampling.sampler import DefaultSampler as DefaultSampler
23 from .streaming.default_streaming import DefaultStreaming as DefaultStreaming
24 from .utils import stacktrace as stacktrace
25 from .utils.compat import string_types as string_types
30 CONTEXT_MISSING_KEY: str
34 class AWSXRayRecorder:
35 def __init__(self) -> None: ...
38 sampling: bool | None = ...,
39 plugins: Iterable[str] | None = ...,
40 context_missing: str | None = ...,
41 sampling_rules: dict[str, Any] | str | None = ...,
42 daemon_address: str | None = ...,
43 service: str | None = ...,
44 context: Context | None = ...,
45 emitter: UDPEmitter | None = ...,
46 streaming: DefaultStreaming | None = ...,
47 dynamic_naming: DefaultDynamicNaming | None = ...,
48 streaming_threshold: int | None = ...,
49 max_trace_back: int | None = ...,
50 sampler: LocalSampler | DefaultSampler | None = ...,
51 stream_sql: bool | None = ...,
53 def in_segment(self, name: str | None = ..., **segment_kwargs) -> SegmentContextManager: ...
54 def in_subsegment(self, name: str | None = ..., **subsegment_kwargs) -> SubsegmentContextManager: ...
56 self, name: str | None = ..., traceid: str | None = ..., parent_id: str | None = ..., sampling: bool | None = ...
57 ) -> Segment | DummySegment: ...
58 def end_segment(self, end_time: time.struct_time | None = ...) -> None: ...
59 def current_segment(self) -> Segment: ...
60 def begin_subsegment(self, name: str, namespace: str = ...) -> DummySubsegment | Subsegment | None: ...
61 def current_subsegment(self) -> Subsegment | DummySubsegment | None: ...
62 def end_subsegment(self, end_time: time.struct_time | None = ...) -> None: ...
63 def put_annotation(self, key: str, value: Any) -> None: ...
64 def put_metadata(self, key: str, value: Any, namespace: str = ...) -> None: ...
65 def is_sampled(self) -> bool: ...
66 def get_trace_entity(self) -> Segment | Subsegment | DummySegment | DummySubsegment: ...
67 def set_trace_entity(self, trace_entity: Segment | Subsegment | DummySegment | DummySubsegment) -> None: ...
68 def clear_trace_entities(self) -> None: ...
69 def stream_subsegments(self) -> None: ...
70 def capture(self, name: str | None = ...) -> SubsegmentContextManager: ...
71 def record_subsegment(
73 wrapped: Callable[..., Any],
76 kwargs: dict[str, Any],
79 meta_processor: Callable[..., Any],
82 def enabled(self) -> bool: ...
84 def enabled(self, value: bool) -> None: ...
86 def sampling(self) -> bool: ...
88 def sampling(self, value: bool) -> None: ...
90 def sampler(self) -> LocalSampler | DefaultSampler: ...
92 def sampler(self, value: LocalSampler | DefaultSampler) -> None: ...
94 def service(self) -> str: ...
96 def service(self, value: str) -> None: ...
98 def dynamic_naming(self) -> Any | DefaultDynamicNaming: ...
99 @dynamic_naming.setter
100 def dynamic_naming(self, value: Any | DefaultDynamicNaming) -> None: ...
102 def context(self) -> Context: ...
104 def context(self, cxt: Context) -> None: ...
106 def emitter(self) -> UDPEmitter: ...
108 def emitter(self, value: UDPEmitter) -> None: ...
110 def streaming(self) -> DefaultStreaming: ...
112 def streaming(self, value: DefaultStreaming) -> None: ...
114 def streaming_threshold(self) -> int: ...
115 @streaming_threshold.setter
116 def streaming_threshold(self, value: int) -> None: ...
118 def max_trace_back(self) -> int: ...
119 @max_trace_back.setter
120 def max_trace_back(self, value: int) -> None: ...
122 def stream_sql(self) -> bool: ...
124 def stream_sql(self, value: bool) -> None: ...