Skip to content

Commit 11d7e29

Browse files
committed
refactor(metrics): update comments to follow new naming convention of throwOnEmptyMetrics property
1 parent 996dba6 commit 11d7e29

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Diff for: docs/core/metrics.md

+2-2
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)

Diff for: packages/metrics/examples/decorator/empty-metrics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Lambda implements LambdaInterface {
1919
@metrics.logMetrics({ throwOnEmptyMetrics: true })
2020
public handler<TEvent, TResult>(_event: TEvent, _context: Context, _callback: Callback<TResult>): void | Promise<TResult> {
2121
// Notice that no metrics are added
22-
// Since the throwOnEmptyMetrics parameter is set to true, the Powertool throw an Error
22+
// Since the throwOnEmptyMetrics parameter is set to true, the Powertool throws an Error
2323
}
2424

2525
}

Diff for: packages/metrics/examples/empty-metrics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const metrics = new Metrics();
1414

1515
const lambdaHandler = async (): Promise<void> => {
1616
// Notice that no metrics are added
17-
// Since the throwOnEmptyMetrics parameter is set to true, the Powertool throw an Error
17+
// Since the throwOnEmptyMetrics parameter is set to true, the Powertool throws an Error
1818
};
1919

2020
const handlerWithMiddleware = middy(lambdaHandler)

Diff for: packages/metrics/src/Metrics.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const DEFAULT_NAMESPACE = 'default_namespace';
3535
* If you are used to TypeScript Class usage to encapsulate your Lambda handler you can leverage the [@metrics.logMetrics()](./_aws_lambda_powertools_metrics.Metrics.html#logMetrics) decorator to automatically:
3636
* * create cold start metric
3737
* * flush buffered metrics
38-
* * raise on empty metrics
38+
* * throw on empty metrics
3939
*
4040
* @example
4141
*
@@ -202,7 +202,7 @@ class Metrics implements MetricsInterface {
202202
}
203203

204204
/**
205-
* A decorator automating coldstart capture, raise on empty metrics and publishing metrics on handler exit.
205+
* A decorator automating coldstart capture, throw on empty metrics and publishing metrics on handler exit.
206206
*
207207
* @example
208208
*

0 commit comments

Comments
 (0)