You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **NOTE**: This will **likely change after Beta** in light of [new Amazon CloudWatch embedded metric format](https://aws.amazon.com/about-aws/whats-new/2019/11/amazon-cloudwatch-launches-embedded-metric-format/), meaning we won't need an additional stack and interface could change.
159
+
> **NOTE**`log_metric` will be removed once it's GA.
160
+
161
+
This feature makes use of CloudWatch Embedded Metric Format (EMF) and metrics are created asynchronously by CloudWatch service
162
+
163
+
> Contrary to `log_metric`, you don't need any custom resource or additional CloudFormation stack anymore.
164
+
165
+
Metrics middleware validates against the minimum necessary for a metric to be published:
152
166
153
-
This feature requires [Custom Metrics SAR App](https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:374852340823:applications~async-custom-metrics) in order to process canonical metric lines in CloudWatch Logs.
167
+
* At least of one Metric and Dimension
168
+
* Maximum of 9 dimensions
169
+
* Only one Namespace
170
+
*[Any Metric unit supported by CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html)
154
171
155
-
If you're starting from scratch, you may want to see a working example, tune to your needs and deploy within your account - [Serverless Airline Log Processing Stack](https://github.com/aws-samples/aws-serverless-airline-booking/blob/develop/src/backend/log-processing/template.yaml)
172
+
**Creating multiple metrics**
173
+
174
+
`log_metrics` decorator calls the decorated function, so leave that for last decorator or will fail with `SchemaValidationError` if no metrics are recorded.
156
175
157
176
```python
158
-
from aws_lambda_powertools.loggingimportMetricUnit, log_metric
177
+
from aws_lambda_powertools.metricsimportMetrics, MetricUnit
CloudWatch EMF uses the same dimensions across all metrics. If you have metrics that should have different dimensions, use `single_metric` to create a single metric with any dimension you want. Generally, this would be an edge case since you [pay for unique metric](https://aws.amazon.com/cloudwatch/pricing/)
> **[Progress towards GA](https://github.com/awslabs/aws-lambda-powertools/projects/1)**
210
+
182
211
This library may change its API/methods or environment variables as it receives feedback from customers. Currently looking for ideas in the following areas before making it stable:
183
212
184
213
***Should Tracer patch all possible imported libraries by default or only AWS SDKs?**
185
214
- Patching all libraries may have a small performance penalty (~50ms) at cold start
186
215
- Alternatively, we could patch only AWS SDK if available and to provide a param to patch multiple `Tracer(modules=("boto3", "requests"))`
187
-
***Create a Tracer provider to support additional tracing**
188
-
- Either duck typing or ABC to allow additional tracing providers
0 commit comments