Skip to content

Commit 4c2d7d1

Browse files
committed
Merge branch 'develop' into feat-async-btach-processor
* develop: (24 commits) chore(deps): bump docker/setup-buildx-action from 2.4.0 to 2.4.1 (aws-powertools#1903) chore(deps-dev): bump aws-cdk-lib from 2.63.0 to 2.63.2 (aws-powertools#1904) update changelog with latest changes docs(idempotency): add IAM permissions section (aws-powertools#1902) chore(deps-dev): bump mkdocs-material from 9.0.10 to 9.0.11 (aws-powertools#1896) chore(deps-dev): bump mypy-boto3-appconfig from 1.26.0.post1 to 1.26.63 (aws-powertools#1895) chore(maintainers): fix release workflow rename update changelog with latest changes docs(homepage): set url for end-of-support in announce block (aws-powertools#1893) chore(deps-dev): bump mkdocs-material from 9.0.9 to 9.0.10 (aws-powertools#1888) chore(deps-dev): bump mypy-boto3-s3 from 1.26.58 to 1.26.62 (aws-powertools#1889) chore(deps-dev): bump black from 22.12.0 to 23.1.0 (aws-powertools#1886) chore(deps-dev): bump aws-cdk-lib from 2.62.2 to 2.63.0 (aws-powertools#1887) update changelog with latest changes feat(metrics): add default_dimensions to single_metric (aws-powertools#1880) chore: update v2 layer ARN on documentation bump version to 2.7.1 update changelog with latest changes docs(homepage): add banner for end-of-support v1 (aws-powertools#1879) fix(license): correction to MIT + MIT-0 (no proprietary anymore) (aws-powertools#1883) ...
2 parents 3d64789 + e2bfae0 commit 4c2d7d1

File tree

69 files changed

+1967
-845
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1967
-845
lines changed

.github/workflows/publish_v2_layer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
# NOTE: we need QEMU to build Layer against a different architecture (e.g., ARM)
6666
- name: Set up Docker Buildx
6767
id: builder
68-
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98 # v2.4.0
68+
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1
6969
with:
7070
install: true
7171
driver: docker

CHANGELOG.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,65 @@
44
<a name="unreleased"></a>
55
# Unreleased
66

7+
## Documentation
8+
9+
* **homepage:** set url for end-of-support in announce block ([#1893](https://github.com/awslabs/aws-lambda-powertools-python/issues/1893))
10+
* **idempotency:** add IAM permissions section ([#1902](https://github.com/awslabs/aws-lambda-powertools-python/issues/1902))
11+
12+
## Features
13+
14+
* **metrics:** add default_dimensions to single_metric ([#1880](https://github.com/awslabs/aws-lambda-powertools-python/issues/1880))
15+
16+
## Maintenance
17+
18+
* **deps-dev:** bump mkdocs-material from 9.0.10 to 9.0.11 ([#1896](https://github.com/awslabs/aws-lambda-powertools-python/issues/1896))
19+
* **deps-dev:** bump mypy-boto3-appconfig from 1.26.0.post1 to 1.26.63 ([#1895](https://github.com/awslabs/aws-lambda-powertools-python/issues/1895))
20+
* **deps-dev:** bump mkdocs-material from 9.0.9 to 9.0.10 ([#1888](https://github.com/awslabs/aws-lambda-powertools-python/issues/1888))
21+
* **deps-dev:** bump mypy-boto3-s3 from 1.26.58 to 1.26.62 ([#1889](https://github.com/awslabs/aws-lambda-powertools-python/issues/1889))
22+
* **deps-dev:** bump black from 22.12.0 to 23.1.0 ([#1886](https://github.com/awslabs/aws-lambda-powertools-python/issues/1886))
23+
* **deps-dev:** bump aws-cdk-lib from 2.62.2 to 2.63.0 ([#1887](https://github.com/awslabs/aws-lambda-powertools-python/issues/1887))
24+
* **maintainers:** fix release workflow rename
25+
26+
27+
<a name="v2.7.1"></a>
28+
## [v2.7.1] - 2023-02-01
729
## Bug Fixes
830

931
* parallel_run should fail when e2e tests fail
1032
* bump aws-cdk version
1133
* **ci:** scope e2e tests by python version
34+
* **ci:** add auth to API HTTP Gateway and Lambda Function Url ([#1882](https://github.com/awslabs/aws-lambda-powertools-python/issues/1882))
35+
* **license:** correction to MIT + MIT-0 (no proprietary anymore) ([#1883](https://github.com/awslabs/aws-lambda-powertools-python/issues/1883))
36+
* **license:** add MIT-0 license header ([#1871](https://github.com/awslabs/aws-lambda-powertools-python/issues/1871))
37+
* **tests:** make logs fetching more robust ([#1878](https://github.com/awslabs/aws-lambda-powertools-python/issues/1878))
38+
* **tests:** remove custom workers
39+
* **tests:** make sure multiple e2e tests run concurrently ([#1861](https://github.com/awslabs/aws-lambda-powertools-python/issues/1861))
1240

1341
## Documentation
1442

1543
* **event-source:** fix incorrect method in example CloudWatch Logs ([#1857](https://github.com/awslabs/aws-lambda-powertools-python/issues/1857))
44+
* **homepage:** add banner for end-of-support v1 ([#1879](https://github.com/awslabs/aws-lambda-powertools-python/issues/1879))
45+
* **parameters:** snippets split, improved, and lint ([#1564](https://github.com/awslabs/aws-lambda-powertools-python/issues/1564))
1646

1747
## Maintenance
1848

49+
* update v2 layer ARN on documentation
50+
* **deps:** bump docker/setup-buildx-action from 2.0.0 to 2.4.0 ([#1873](https://github.com/awslabs/aws-lambda-powertools-python/issues/1873))
1951
* **deps:** bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 ([#1855](https://github.com/awslabs/aws-lambda-powertools-python/issues/1855))
52+
* **deps-dev:** bump mypy-boto3-s3 from 1.26.0.post1 to 1.26.58 ([#1868](https://github.com/awslabs/aws-lambda-powertools-python/issues/1868))
53+
* **deps-dev:** bump isort from 5.11.4 to 5.11.5 ([#1875](https://github.com/awslabs/aws-lambda-powertools-python/issues/1875))
54+
* **deps-dev:** bump aws-cdk-lib from 2.62.1 to 2.62.2 ([#1869](https://github.com/awslabs/aws-lambda-powertools-python/issues/1869))
55+
* **deps-dev:** bump mkdocs-material from 9.0.6 to 9.0.8 ([#1874](https://github.com/awslabs/aws-lambda-powertools-python/issues/1874))
2056
* **deps-dev:** bump aws-cdk-lib from 2.62.0 to 2.62.1 ([#1866](https://github.com/awslabs/aws-lambda-powertools-python/issues/1866))
2157
* **deps-dev:** bump mypy-boto3-cloudformation from 1.26.35.post1 to 1.26.57 ([#1865](https://github.com/awslabs/aws-lambda-powertools-python/issues/1865))
2258
* **deps-dev:** bump coverage from 7.0.5 to 7.1.0 ([#1862](https://github.com/awslabs/aws-lambda-powertools-python/issues/1862))
2359
* **deps-dev:** bump aws-cdk-lib from 2.61.1 to 2.62.0 ([#1863](https://github.com/awslabs/aws-lambda-powertools-python/issues/1863))
60+
* **deps-dev:** bump flake8-bugbear from 22.12.6 to 23.1.20 ([#1854](https://github.com/awslabs/aws-lambda-powertools-python/issues/1854))
2461
* **deps-dev:** bump mypy-boto3-lambda from 1.26.49 to 1.26.55 ([#1856](https://github.com/awslabs/aws-lambda-powertools-python/issues/1856))
2562

63+
## Reverts
64+
* fix(tests): remove custom workers
65+
2666

2767
<a name="v2.7.0"></a>
2868
## [v2.7.0] - 2023-01-24
@@ -2801,7 +2841,8 @@
28012841
* Merge pull request [#5](https://github.com/awslabs/aws-lambda-powertools-python/issues/5) from jfuss/feat/python38
28022842

28032843

2804-
[Unreleased]: https://github.com/awslabs/aws-lambda-powertools-python/compare/v2.7.0...HEAD
2844+
[Unreleased]: https://github.com/awslabs/aws-lambda-powertools-python/compare/v2.7.1...HEAD
2845+
[v2.7.1]: https://github.com/awslabs/aws-lambda-powertools-python/compare/v2.7.0...v2.7.1
28052846
[v2.7.0]: https://github.com/awslabs/aws-lambda-powertools-python/compare/v2.6.0...v2.7.0
28062847
[v2.6.0]: https://github.com/awslabs/aws-lambda-powertools-python/compare/v2.5.0...v2.6.0
28072848
[v2.5.0]: https://github.com/awslabs/aws-lambda-powertools-python/compare/v2.4.0...v2.5.0

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
MIT No Attribution
2+
13
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy of

MAINTAINERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ These are some questions to keep in mind when drafting your first or future rele
218218

219219
Once you're happy, hit `Publish release` 🎉🎉🎉.
220220

221-
This will kick off the [Publishing workflow](https://github.com/awslabs/aws-lambda-powertools-python/actions/workflows/on_release_notes.yml) and within a few minutes you should see the latest version in PyPi, and all issues labeled as `pending-release` will be closed and notified.
221+
This will kick off the [Publishing workflow](https://github.com/awslabs/aws-lambda-powertools-python/actions/workflows/release.yml) and within a few minutes you should see the latest version in PyPi, and all issues labeled as `pending-release` will be closed and notified.
222222

223223
> TODO: Include information to verify SAR and Lambda Layers deployment; we're still finalizing Lambda Layer automated deployment in GitHub Actions - ping @am29d when in doubt.
224224

aws_lambda_powertools/metrics/base.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,11 @@ def add_metric(self, name: str, unit: Union[MetricUnit, str], value: float) -> N
463463

464464
@contextmanager
465465
def single_metric(
466-
name: str, unit: MetricUnit, value: float, namespace: Optional[str] = None
466+
name: str,
467+
unit: MetricUnit,
468+
value: float,
469+
namespace: Optional[str] = None,
470+
default_dimensions: Optional[Dict[str, str]] = None,
467471
) -> Generator[SingleMetric, None, None]:
468472
"""Context manager to simplify creation of a single metric
469473
@@ -516,6 +520,11 @@ def single_metric(
516520
try:
517521
metric: SingleMetric = SingleMetric(namespace=namespace)
518522
metric.add_metric(name=name, unit=unit, value=value)
523+
524+
if default_dimensions:
525+
for dim_name, dim_value in default_dimensions.items():
526+
metric.add_dimension(name=dim_name, value=dim_value)
527+
519528
yield metric
520529
metric_set = metric.serialize_metric_set()
521530
finally:

docs/core/metrics.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ CloudWatch EMF uses the same dimensions across all your metrics. Use `single_met
216216
--8<-- "examples/metrics/src/single_metric_output.json"
217217
```
218218

219+
By default it will skip all previously defined dimensions including default dimensions. Use `default_dimensions` keyword argument if you want to reuse default dimensions or specify custom dimensions from a dictionary.
220+
221+
=== "single_metric_default_dimensions_inherit.json"
222+
223+
```json hl_lines="10 15"
224+
--8<-- "examples/metrics/src/single_metric_default_dimensions_inherit.py"
225+
```
226+
227+
=== "single_metric_default_dimensions.py"
228+
229+
```python hl_lines="12"
230+
--8<-- "examples/metrics/src/single_metric_default_dimensions.py"
231+
```
232+
219233
### Flushing metrics manually
220234

221235
If you prefer not to use `log_metrics` because you might want to encapsulate additional logic when doing so, you can manually flush and clear metrics as follows:

0 commit comments

Comments
 (0)