Skip to content

Commit 5ae7741

Browse files
authored
Improv tracer - async support, patch, test coverage and X-Ray escape hatch (#29)
* feat: use new TraceProvider * improv: update tests * improv: update docs, linting * improv: docstring readability and links * improv: remove tracer provider * fix: patch modules type * improv: use client ctx_manager for race conditions * improv: make disabling provider private again * chore: linting * fix: race condition annotation/metadata * chore: linting * feat: add async support for methods * improv: document async use cases, and edge cases * improv: upgrade xray, flex pinning * chore: linting * improv: update example for async, escape hatch * fix: add example dev deps in project * improv: add patch_modules example, formatting * improv: break down concurrent async calls example * docs: main doc clean up * docs: document async, escape hatch usage * chore: lint * docs: update example SAM template comments * chore: updates poetry lock file * improv: example to use py 3.8 * fix: AsyncMockMixin not being awaitable in 3.8 * fix: 3.8 defaulting to AsyncMock * improv: include x-ray bug for concurrent async calls * fix: address nicolas's feedback * improv: add security baseline as part of PR process * improv: enforce lower code complexity * chore: whitespace * improv: add complexity baseline * chore: bump version to 0.9.0 * chore: clean up history changes Co-authored-by: heitorlessa <[email protected]>
1 parent 70d9277 commit 5ae7741

File tree

18 files changed

+1481
-429
lines changed

18 files changed

+1481
-429
lines changed

Diff for: python/.flake8

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
exclude = docs, .eggs, setup.py, example, .aws-sam
33
ignore = E203, E266, W503, BLK100, W291, I004
44
max-line-length = 120
5-
max-complexity = 18
5+
max-complexity = 15
66

77
[isort]
88
multi_line_output = 3
99
include_trailing_comma = true
1010
force_grid_wrap = 0
1111
use_parentheses = true
1212
line_length = 120
13-

Diff for: python/HISTORY.md

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

3+
## May 12th
4+
5+
**0.9.0**
6+
7+
* **Tracer**: Support for async functions in `Tracer` via `capture_method` decorator
8+
* **Tracer**: Support for `aiohttp` via `aiohttp_trace_config` trace config
9+
* **Tracer**: Support for patching specific modules via `patch_modules` param
10+
* **Tracer**: Document escape hatch mechanisms via `tracer.provider`
11+
312
## May 1st
413

514
**0.8.1**
615

7-
* Fix metric unit casting logic if one passes plain string (value or key)
8-
* Fix `MetricUnit` enum values for
16+
* **Metrics**: Fix metric unit casting logic if one passes plain string (value or key)
17+
* **Metrics: **Fix `MetricUnit` enum values for
918
- `BytesPerSecond`
1019
- `KilobytesPerSecond`
1120
- `MegabytesPerSecond`
@@ -22,35 +31,35 @@
2231

2332
**0.8.0**
2433

25-
* Introduces `Logger` for stuctured logging as a replacement for `logger_setup`
26-
* Introduces `Logger.inject_lambda_context` decorator as a replacement for `logger_inject_lambda_context`
27-
* Raise `DeprecationWarning` exception for both `logger_setup`, `logger_inject_lambda_context`
34+
* **Logger**: Introduces `Logger` class for stuctured logging as a replacement for `logger_setup`
35+
* **Logger**: Introduces `Logger.inject_lambda_context` decorator as a replacement for `logger_inject_lambda_context`
36+
* **Logger**: Raise `DeprecationWarning` exception for both `logger_setup`, `logger_inject_lambda_context`
2837

2938
## April 20th, 2020
3039

3140
**0.7.0**
3241

33-
* Introduces Middleware Factory to build your own middleware
34-
* Fixes Metrics dimensions not being included correctly in EMF
42+
* **Middleware factory**: Introduces Middleware Factory to build your own middleware via `lambda_handler_decorator`
43+
* **Metrics**: Fixes metrics dimensions not being included correctly in EMF
3544

3645
## April 9th, 2020
3746

3847
**0.6.3**
3948

40-
* Fix `log_metrics` decorator logic not calling the decorated function, and exception handling
49+
* **Logger**: Fix `log_metrics` decorator logic not calling the decorated function, and exception handling
4150

4251
## April 8th, 2020
4352

4453
**0.6.1**
4554

46-
* Introduces Metrics middleware to utilise CloudWatch Embedded Metric Format
47-
* Adds deprecation warning for `log_metrics`
55+
* **Metrics**: Introduces Metrics middleware to utilise CloudWatch Embedded Metric Format
56+
* **Metrics**: Adds deprecation warning for `log_metrics`
4857

4958
## February 20th, 2020
5059

5160
**0.5.0**
5261

53-
* Introduces log sampling for debug - Thanks to [Danilo's contribution](https://github.com/awslabs/aws-lambda-powertools/pull/7)
62+
* **Logger**: Introduces log sampling for debug - Thanks to [Danilo's contribution](https://github.com/awslabs/aws-lambda-powertools/pull/7)
5463

5564
## November 15th, 2019
5665

Diff for: python/Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test:
2020
coverage-html:
2121
poetry run pytest --cov-report html
2222

23-
pr: lint test
23+
pr: lint test security-baseline complexity-baseline
2424

2525
build: pr
2626
poetry run build
@@ -31,6 +31,15 @@ docs: dev
3131
docs-dev:
3232
poetry run pdoc --http : aws_lambda_powertools
3333

34+
security-baseline:
35+
poetry run bandit --baseline bandit.baseline -r aws_lambda_powertools
36+
37+
complexity-baseline:
38+
$(info Maintenability index)
39+
poetry run radon mi aws_lambda_powertools
40+
$(info Cyclomatic complexity index)
41+
poetry run xenon --max-absolute C --max-modules A --max-average A aws_lambda_powertools
42+
3443
#
3544
# Use `poetry version <major>/<minor></patch>` for version bump
3645
#

0 commit comments

Comments
 (0)