Skip to content

Commit 1d28fd2

Browse files
committed
docs: revert SAM example due to low eyesight
1 parent 0e2b64f commit 1d28fd2

File tree

3 files changed

+59
-56
lines changed

3 files changed

+59
-56
lines changed

docs/core/metrics.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,33 @@ Setting | Description | Environment variable | Constructor parameter
3838
???+ tip
3939
Use your application or main service as the metric namespace to easily group all metrics.
4040

41-
???+ example "Example: Using AWS Serverless Application Model (SAM)"
42-
43-
=== "template.yml"
44-
45-
```yaml hl_lines="9 10"
46-
Resources:
47-
HelloWorldFunction:
48-
Type: AWS::Serverless::Function
49-
Properties:
50-
Runtime: python3.8
51-
Environment:
52-
Variables:
53-
POWERTOOLS_SERVICE_NAME: payment
54-
POWERTOOLS_METRICS_NAMESPACE: ServerlessAirline
55-
```
56-
57-
=== "app.py"
58-
59-
```python hl_lines="4 6"
60-
from aws_lambda_powertools import Metrics
61-
from aws_lambda_powertools.metrics import MetricUnit
62-
63-
metrics = Metrics() # Sets metric namespace and service via env var
64-
# OR
65-
metrics = Metrics(namespace="ServerlessAirline", service="orders") # Sets metric namespace, and service as a metric dimension
66-
```
41+
???+ example
42+
**AWS Serverless Application Model (SAM)**
43+
44+
=== "template.yml"
45+
46+
```yaml hl_lines="9 10"
47+
Resources:
48+
HelloWorldFunction:
49+
Type: AWS::Serverless::Function
50+
Properties:
51+
Runtime: python3.8
52+
Environment:
53+
Variables:
54+
POWERTOOLS_SERVICE_NAME: payment
55+
POWERTOOLS_METRICS_NAMESPACE: ServerlessAirline
56+
```
57+
58+
=== "app.py"
59+
60+
```python hl_lines="4 6"
61+
from aws_lambda_powertools import Metrics
62+
from aws_lambda_powertools.metrics import MetricUnit
63+
64+
metrics = Metrics() # Sets metric namespace and service via env var
65+
# OR
66+
metrics = Metrics(namespace="ServerlessAirline", service="orders") # Sets metric namespace, and service as a metric dimension
67+
```
6768

6869

6970
### Creating metrics

docs/core/tracer.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Tracer is an opinionated thin wrapper for [AWS X-Ray Python SDK](https://github.
2020

2121
Before your use this utility, your AWS Lambda function [must have permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to send traces to AWS X-Ray.
2222

23-
> Example using AWS Serverless Application Model (SAM)
23+
???+ example
24+
**AWS Serverless Application Model (SAM)**
2425

2526
=== "template.yml"
2627

docs/utilities/idempotency.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,36 @@ TTL attribute name | `expiration` | This can only be configured after your table
4343
???+ tip "Tip: You can share a single state table for all functions"
4444
You can reuse the same DynamoDB table to store idempotency state. We add your `function_name` in addition to the idempotency key as a hash key.
4545

46-
???+ example "Example: Using AWS Serverless Application Model (SAM)"
47-
48-
=== "template.yml"
49-
50-
```yaml hl_lines="5-13 21-23"
51-
Resources:
52-
IdempotencyTable:
53-
Type: AWS::DynamoDB::Table
54-
Properties:
55-
AttributeDefinitions:
56-
- AttributeName: id
57-
AttributeType: S
58-
KeySchema:
59-
- AttributeName: id
60-
KeyType: HASH
61-
TimeToLiveSpecification:
62-
AttributeName: expiration
63-
Enabled: true
64-
BillingMode: PAY_PER_REQUEST
65-
66-
HelloWorldFunction:
67-
Type: AWS::Serverless::Function
68-
Properties:
69-
Runtime: python3.8
70-
...
71-
Policies:
72-
- DynamoDBCrudPolicy:
73-
TableName: !Ref IdempotencyTable
74-
```
46+
???+ example
47+
**AWS Serverless Application Model (SAM)**
48+
49+
=== "template.yml"
50+
51+
```yaml hl_lines="5-13 21-23"
52+
Resources:
53+
IdempotencyTable:
54+
Type: AWS::DynamoDB::Table
55+
Properties:
56+
AttributeDefinitions:
57+
- AttributeName: id
58+
AttributeType: S
59+
KeySchema:
60+
- AttributeName: id
61+
KeyType: HASH
62+
TimeToLiveSpecification:
63+
AttributeName: expiration
64+
Enabled: true
65+
BillingMode: PAY_PER_REQUEST
66+
67+
HelloWorldFunction:
68+
Type: AWS::Serverless::Function
69+
Properties:
70+
Runtime: python3.8
71+
...
72+
Policies:
73+
- DynamoDBCrudPolicy:
74+
TableName: !Ref IdempotencyTable
75+
```
7576

7677
???+ warning "Warning: Large responses with DynamoDB persistence layer"
7778
When using this utility with DynamoDB, your function's responses must be [smaller than 400KB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-items).

0 commit comments

Comments
 (0)