Skip to content

Commit e158ca0

Browse files
Fixing base provider + won't change Tracer
1 parent f0fbd01 commit e158ca0

File tree

5 files changed

+572
-105
lines changed

5 files changed

+572
-105
lines changed

aws_lambda_powertools/tracing/provider/aws_xray/aws_xray_tracer.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from contextlib import asynccontextmanager, contextmanager
44
from numbers import Number
5-
from typing import Any, AsyncGenerator, Generator, Literal, Sequence, Union
5+
from typing import Any, AsyncGenerator, Generator, Literal, Optional, Sequence, Union
66

77
from aws_lambda_powertools.shared import constants
88
from aws_lambda_powertools.shared.lazy_import import LazyLoader
@@ -69,14 +69,26 @@ def record_exception(self, exception: BaseException, **kwargs):
6969

7070

7171
class AwsXrayProvider(BaseProvider):
72-
def __init__(self, xray_recorder=None):
73-
if not xray_recorder:
74-
from aws_xray_sdk.core import xray_recorder
72+
73+
def __init__(
74+
self,
75+
service: str = "",
76+
disabled: Optional[bool] = None,
77+
auto_patch: Optional[bool] = None,
78+
patch_modules: Optional[Sequence[str]] = None,
79+
):
80+
from aws_xray_sdk.core import xray_recorder # type: ignore
7581

7682
self.recorder = xray_recorder
7783
self.in_subsegment = self.recorder.in_subsegment
7884
self.in_subsegment_async = self.recorder.in_subsegment_async
7985

86+
self.service = service
87+
88+
super().__init__(
89+
service=self.service,
90+
)
91+
8092
@contextmanager
8193
def trace(self, name: str, **kwargs) -> Generator[XraySpan, None, None]:
8294
with self.in_subsegment(name=name, **kwargs) as sub_segment:

0 commit comments

Comments
 (0)