Skip to content

Commit bdced91

Browse files
committed
resolve merge conflicts
2 parents 7902db5 + 471eaca commit bdced91

17 files changed

+5961
-4668
lines changed

Diff for: docs/core/metrics.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,12 @@ You can flush metrics automatically using one of the following methods:
274274
* [Middy-compatible](https://github.com/middyjs/middy){target=_blank} middleware
275275
* class decorator
276276

277-
Using the Middy middleware or decorator will **automatically validate, serialize, and flush** all your metrics. During metrics validation, if no metrics are provided then a warning will be logged, but no exception will be raised.
277+
Using the Middy middleware or decorator will **automatically validate, serialize, and flush** all your metrics. During metrics validation, if no metrics are provided then a warning will be logged, but no exception will be thrown.
278278
If you do not use the middleware or decorator, you have to flush your metrics manually.
279279

280280

281281
!!! warning "Metric validation"
282-
If metrics are provided, and any of the following criteria are not met, a **`RangeError`** exception will be raised:
282+
If metrics are provided, and any of the following criteria are not met, a **`RangeError`** exception will be thrown:
283283

284284
* Maximum of 9 dimensions
285285
* Namespace is set only once (or none)
@@ -433,7 +433,7 @@ The `logMetrics` decorator of the metrics utility can be used when your Lambda h
433433

434434
#### Throwing a RangeError when no metrics are emitted
435435

436-
If you want to ensure that at least one metric is emitted before you flush them, you can use the `raiseOnEmptyMetrics` parameter and pass it to the middleware or decorator:
436+
If you want to ensure that at least one metric is emitted before you flush them, you can use the `throwOnEmptyMetrics` parameter and pass it to the middleware or decorator:
437437

438438
```typescript hl_lines="11"
439439
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
@@ -446,7 +446,7 @@ If you want to ensure that at least one metric is emitted before you flush them,
446446
}
447447

448448
export const handler = middy(lambdaHandler)
449-
.use(logMetrics(metrics, { raiseOnEmptyMetrics: true }));
449+
.use(logMetrics(metrics, { throwOnEmptyMetrics: true }));
450450
```
451451

452452
### Capturing a cold start invocation as metric

Diff for: examples/cdk/lib/example-function.MyFunction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const handler = async (_event: unknown, context: Context): Promise<void>
2929

3030
// ### Experiment metrics
3131
metrics.captureColdStartMetric();
32-
metrics.raiseOnEmptyMetrics();
32+
metrics.throwOnEmptyMetrics();
3333
metrics.setDefaultDimensions({ environment: 'example', type: 'standardFunction' });
3434
metrics.addMetric('test-metric', MetricUnits.Count, 10);
3535

Diff for: examples/cdk/lib/example-function.MyFunctionWithDecorator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class MyFunctionWithDecorator {
1515
@logger.injectLambdaContext()
1616
@metrics.logMetrics({
1717
captureColdStartMetric: true,
18-
raiseOnEmptyMetrics: true,
18+
throwOnEmptyMetrics: true,
1919
defaultDimensions: { environment: 'example', type: 'withDecorator' },
2020
})
2121
public handler(_event: unknown, _context: Context, _callback: Callback<unknown>): void | Promise<unknown> {

0 commit comments

Comments
 (0)