Skip to content

Commit 82f4a67

Browse files
committed
bugfix: resolves #31 aiohttp lazy import
1 parent a43a75d commit 82f4a67

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

Diff for: python/HISTORY.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# HISTORY
22

3+
## May 14th
4+
5+
**0.9.2**
6+
7+
* **Tracer**: Bugfix - aiohttp lazy import so it's not a hard dependency
8+
39
## May 12th
410

511
**0.9.0**

Diff for: python/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ You can use `tracer.provider` attribute to access all methods provided by `xray_
142142

143143
**Example using aiohttp with an async context manager**
144144

145+
> NOTE: It expects you have `aiohttp` as a dependency. `aiohttp_trace_config` uses lazy import to create a trace_config object following `aiohttp` protocol.
146+
145147
```python
146148
import asyncio
147149
import aiohttp

Diff for: python/aws_lambda_powertools/tracing/__init__.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"""Tracing utility
22
"""
3-
from aws_xray_sdk.ext.aiohttp.client import aws_xray_trace_config as aiohttp_trace_config
43

5-
from .tracer import Tracer
6-
7-
aiohttp_trace_config.__doc__ = "aiohttp extension for X-Ray (aws_xray_trace_config)"
84

5+
from .extensions import aiohttp_trace_config
6+
from .tracer import Tracer
97

108
__all__ = ["Tracer", "aiohttp_trace_config"]

Diff for: python/aws_lambda_powertools/tracing/extensions.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def aiohttp_trace_config():
2+
"""aiohttp extension for X-Ray (aws_xray_trace_config)
3+
4+
It expects you to have aiohttp as a dependency.
5+
6+
Returns
7+
-------
8+
TraceConfig
9+
aiohttp trace config
10+
"""
11+
from aws_xray_sdk.ext.aiohttp.client import aws_xray_trace_config
12+
13+
aws_xray_trace_config.__doc__ = "aiohttp extension for X-Ray (aws_xray_trace_config)"
14+
15+
return aws_xray_trace_config()

Diff for: python/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "aws_lambda_powertools"
3-
version = "0.9.0"
3+
version = "0.9.2"
44
description = "Python utilities for AWS Lambda functions including but not limited to tracing, logging and custom metric"
55
authors = ["Amazon Web Services"]
66
classifiers=[

0 commit comments

Comments
 (0)