Skip to content

Commit

Permalink
modify comments and add sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
go-to-k committed Sep 5, 2024
1 parent 54040c2 commit 13f3459
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,33 @@ export interface MathExpressionProps extends MathExpressionOptions {
* The key is the identifier that represents the given metric in the
* expression, and the value is the actual Metric object.
*
* The `period` of each Metric object is ignored and instead overridden by
* the `period` of this math expression object. Even if the `period` of the
* math expression is not specified, it is overridden by its default value.
* The `period` of each metric in `usingMetrics` is ignored and instead overridden
* by the `period` specified for the `MathExpression` construct. Even if no `period`
* is specified for the `MathExpression`, it will be overridden by the default
* value (`Duration.minutes(5)`).
*
* Example:
*
* ```ts
* new MathExpression({
* expression: "m1+m2",
* label: "AlbErrors",
* usingMetrics: {
* m1: metrics.custom("HTTPCode_ELB_500_Count", {
* period: Duration.minutes(1), // <- This period will be ignored
* statistic: "Sum",
* label: "HTTPCode_ELB_500_Count",
* }),
* m2: metrics.custom("HTTPCode_ELB_502_Count", {
* period: Duration.minutes(1), // <- This period will be ignored
* statistic: "Sum",
* label: "HTTPCode_ELB_502_Count",
* }),
* },
* period: Duration.minutes(3), // <- This overrides the period of each metric in `usingMetrics`
* // (Even if not specified, it is overridden by the default value)
* });
* ```
*
* @default - Empty map.
*/
Expand Down

0 comments on commit 13f3459

Please sign in to comment.