Repository: cdklabs/cdk-monitoring-constructs (language: python)

Issue:
feat: allow specifying regions/accounts at a more granular level
This allows users to target different regions/account for specific things within a facade rather than relying on 1 facade per region/account with the facade's global settings, so something like:

```ts
this.facade
  .monitorDynamoTable({
    ...,
  })
  .monitorDynamoTable({
    ...,
    region: <some_other_region>,
    account: <some_other_account>,
  })
```

---

_By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
Cannot create an Alarm based on a MathExpression which specifies a searchAccount or searchRegion
### Version

5.10.0

### Steps and/or minimal code example to reproduce

I have a few constructs that create DDB alarms, they used to be work with 5.4.2 but fails to build with 5.10.0, I am getting

```
Cannot create an Alarm based on a MathExpression which specifies a searchAccount or searchRegion
```

Here is my alarm config

```
addReadThrottledEventsCountAlarm: {
  Critical: {
    maxThrottledEventsThreshold: 0,
    datapointsToAlarm: 1,
    period: Duration.minutes(1),
    treatMissingDataOverride: TreatMissingData.NOT_BREACHING,
  }
}
```

### Expected behavior

DDB alarms are created.

### Actual behavior

Not able to get alarms created.

### Other details

I think this is related to #415 where we added `searchAccount` and `searchRegion` to `createMetricMath` and ReadThrottledEventsCountAlarm and WriteThrottledEventsCountAlarm use math expression.

https://github.com/cdklabs/cdk-monitoring-constructs/blob/b07f3615de87e160081834d4816a1617565a1e76/lib/monitoring/aws-dynamo/DynamoTableMetricFactory.ts#L138-L141

The change impacts more than just DDB alarms I feel, it affects all alarm creations where math expression will be used


Discussion / hints:

~~I think this also has something to do with different versions of aws-cdk-lib. My package is using 2.91, whereas cdk-monitoring-constructs is using 2.65. Cloudwatch might have introduced a compile time check between the two versions.~~

I think this is because of the global defaults. With #415, the account and region in the global defaults will be passed into MathExpression and I happened to have the global defaults defined.
Easiest fix that I could think of is just strip out account and region somewhere in https://github.com/cdklabs/cdk-monitoring-constructs/blob/b07f3615de87e160081834d4816a1617565a1e76/lib/common/alarm/AlarmFactory.ts#L496 if the metric is a math expression. Though this might give the caller a false impression that MathExpression alarm can have custom `searchAccount` and `searchRegion`.

---
I have also tried to workaround the problem by providing a metricAdjuster to unset `searchAccount` and `searchRegion`, however, there is a short-circuiting logic in aws-cdk-lib that prevents me from unsetting them :(

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts#L652-L660

```typescript
  public with(props: MathExpressionOptions): MathExpression {
    // Short-circuit creating a new object if there would be no effective change
    if ((props.label === undefined || props.label === this.label)
      && (props.color === undefined || props.color === this.color)
      && (props.period === undefined || props.period.toSeconds() === this.period.toSeconds())
      && (props.searchAccount === undefined || props.searchAccount === this.searchAccount)
      && (props.searchRegion === undefined || props.searchRegion === this.searchRegion)) {
      return this;
    }

    return new MathExpression({
      expression: this.expression,
      usingMetrics: this.usingMetrics,
      label: ifUndefined(props.label, this.label),
      color: ifUndefined(props.color, this.color),
      period: ifUndefined(props.period, this.period),
      searchAccount: ifUndefined(props.searchAccount, this.searchAccount),
      searchRegion: ifUndefined(props.searchRegion, this.searchRegion),
    });
  }
```
---

Something like the following will do for the time being

```typescript
adjustMetric: (metric: MetricWithAlarmSupport, alarmScope: Construct, props: AddAlarmProps) => {
        if (metric.toMetricConfig().mathExpression) {
          return new MathExpression({...metric, searchAccount: undefined, searchRegion: undefined} as MathExpressionProps);
        } else {
          return metric;
        }
      }
```
Yeah, #415 would be the cause of this and you should be right with the relation to global defaults being set.

We could potentially pass in the stack's info to `MetricFactory` and only use the global defaults for the `searchRegion` and `searchAccount` if they're actually different.

You'd still encounter the error if you try to alarm on those given you can't do search expressions cross-region/region anyway.

---

[Where the error's thrown, for reference](https://github.com/aws/aws-cdk/blame/c695b6004219426cf0e67cbb92d916a394ddd594/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm.ts#L385-L393)
Does this mean that I can't deploy a stack with alarms containing a `MathExpression` where the resources being monitored are in another account?

I started having this problem when monitoring my RDS cluster (`monitorRdsCluster()`). I specify the `account` at `metricDefaults.account` for this to work, but if I upgrade the `cdk-monitoring-constructs` library I get the error mentioned in this issue..

Fix patch:
diff --git a/API.md b/API.md
index 1e104104..345b02ad 100644
--- a/API.md
+++ b/API.md
@@ -65886,12 +65886,13 @@ public readonly title: string;
 ```typescript
 import { MetricFactory } from 'cdk-monitoring-constructs'
 
-new MetricFactory(props?: MetricFactoryProps)
+new MetricFactory(props?: MetricFactoryProps, scope?: Construct)
 ```
 
 | **Name** | **Type** | **Description** |
 | --- | --- | --- |
 | <code><a href="#cdk-monitoring-constructs.MetricFactory.Initializer.parameter.props">props</a></code> | <code><a href="#cdk-monitoring-constructs.MetricFactoryProps">MetricFactoryProps</a></code> | *No description.* |
+| <code><a href="#cdk-monitoring-constructs.MetricFactory.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
 
 ---
 
@@ -65901,6 +65902,12 @@ new MetricFactory(props?: MetricFactoryProps)
 
 ---
 
+##### `scope`<sup>Optional</sup> <a name="scope" id="cdk-monitoring-constructs.MetricFactory.Initializer.parameter.scope"></a>
+
+- *Type:* constructs.Construct
+
+---
+
 #### Methods <a name="Methods" id="Methods"></a>
 
 | **Name** | **Description** |
diff --git a/lib/common/metric/MetricFactory.ts b/lib/common/metric/MetricFactory.ts
index 2cfebb65..6296bead 100644
--- a/lib/common/metric/MetricFactory.ts
+++ b/lib/common/metric/MetricFactory.ts
@@ -1,10 +1,11 @@
-import { Duration } from "aws-cdk-lib";
+import { Duration, Stack } from "aws-cdk-lib";
 import {
   DimensionsMap,
   IMetric,
   MathExpression,
   Metric,
 } from "aws-cdk-lib/aws-cloudwatch";
+import { Construct } from "constructs";
 
 import { AnomalyDetectionMathExpression } from "./AnomalyDetectionMathExpression";
 import { BaseMetricFactoryProps } from "./BaseMetricFactory";
@@ -42,9 +43,12 @@ export interface MetricFactoryProps {
 
 export class MetricFactory {
   protected readonly globalDefaults: MetricFactoryDefaults;
+  protected readonly scope: Construct | undefined;
 
-  constructor(props?: MetricFactoryProps) {
+  // TODO: make scope required and first. This is for backwards compatability for now.
+  constructor(props?: MetricFactoryProps, scope?: Construct) {
     this.globalDefaults = props?.globalDefaults ?? {};
+    this.scope = scope;
   }
 
   /**
@@ -81,8 +85,8 @@ export class MetricFactory {
         : undefined,
       namespace: this.getNamespaceWithFallback(namespace),
       period: period ?? this.globalDefaults.period ?? DefaultMetricPeriod,
-      region: region ?? this.globalDefaults.region,
-      account: account ?? this.globalDefaults.account,
+      region: this.resolveRegion(region ?? this.globalDefaults.region),
+      account: this.resolveAccount(account ?? this.globalDefaults.account),
     });
   }
 
@@ -112,8 +116,10 @@ export class MetricFactory {
       expression,
       usingMetrics,
       period: period ?? this.globalDefaults.period ?? DefaultMetricPeriod,
-      searchRegion: region ?? this.globalDefaults.region,
-      searchAccount: account ?? this.globalDefaults.account,
+      searchRegion: this.resolveRegion(region ?? this.globalDefaults.region),
+      searchAccount: this.resolveAccount(
+        account ?? this.globalDefaults.account,
+      ),
     });
   }
 
@@ -165,8 +171,10 @@ export class MetricFactory {
       // cannot be an empty string and undefined is no good either
       label: label ?? " ",
       period: finalPeriod,
-      searchRegion: region ?? this.globalDefaults.region,
-      searchAccount: account ?? this.globalDefaults.account,
+      searchRegion: this.resolveRegion(region ?? this.globalDefaults.region),
+      searchAccount: this.resolveAccount(
+        account ?? this.globalDefaults.account,
+      ),
     });
   }
 
@@ -205,8 +213,10 @@ export class MetricFactory {
       usingMetrics,
       expression: `ANOMALY_DETECTION_BAND(${finalExpressionId},${stdev})`,
       period: period ?? this.globalDefaults.period ?? DefaultMetricPeriod,
-      searchRegion: region ?? this.globalDefaults.region,
-      searchAccount: account ?? this.globalDefaults.account,
+      searchRegion: this.resolveRegion(region ?? this.globalDefaults.region),
+      searchAccount: this.resolveAccount(
+        account ?? this.globalDefaults.account,
+      ),
     });
   }
 
@@ -263,6 +273,8 @@ export class MetricFactory {
         label,
         metric.color,
         metric.period,
+        this.getRegion(metric),
+        this.getAccount(metric),
       );
     }
   }
@@ -296,6 +308,8 @@ export class MetricFactory {
         label,
         metric.color,
         metric.period,
+        this.getRegion(metric),
+        this.getAccount(metric),
       );
     }
   }
@@ -351,6 +365,8 @@ export class MetricFactory {
             avgLabel,
             avgMetric.color,
             avgMetric.period,
+            this.getRegion(avgMetric),
+            this.getAccount(avgMetric),
           );
         }
         return avgMetric;
@@ -370,6 +386,8 @@ export class MetricFactory {
           perSecondLabel,
           metric.color,
           metric.period,
+          this.getRegion(metric),
+          this.getAccount(metric),
         );
       case RateComputationMethod.PER_MINUTE:
         return this.createMetricMath(
@@ -378,6 +396,8 @@ export class MetricFactory {
           `${labelPrefix}/m${labelAppendix}`,
           metric.color,
           metric.period,
+          this.getRegion(metric),
+          this.getAccount(metric),
         );
       case RateComputationMethod.PER_HOUR:
         return this.createMetricMath(
@@ -386,6 +406,8 @@ export class MetricFactory {
           `${labelPrefix}/h${labelAppendix}`,
           metric.color,
           metric.period,
+          this.getRegion(metric),
+          this.getAccount(metric),
         );
       case RateComputationMethod.PER_DAY:
         return this.createMetricMath(
@@ -394,6 +416,8 @@ export class MetricFactory {
           `${labelPrefix}/d${labelAppendix}`,
           metric.color,
           metric.period,
+          this.getRegion(metric),
+          this.getAccount(metric),
         );
     }
   }
@@ -452,4 +476,58 @@ export class MetricFactory {
 
     return copy;
   }
+
+  /**
+   * Attempts to get the account from the metric if it differs from the scope.
+   */
+  private resolveAccount(
+    metricAccount: string | undefined,
+  ): string | undefined {
+    if (!this.scope) {
+      return metricAccount;
+    }
+
+    const { account } = Stack.of(this.scope);
+    if (metricAccount !== account) {
+      return metricAccount;
+    }
+
+    return;
+  }
+  private getAccount(metric: MetricWithAlarmSupport): string | undefined {
+    let metricAccount: string | undefined;
+    if (metric instanceof MathExpression) {
+      metricAccount = metric.searchAccount;
+    } else {
+      metricAccount = metric.account;
+    }
+
+    return this.resolveAccount(metricAccount);
+  }
+
+  /**
+   * Attempts to get the region from the metric if it differs from the scope.
+   */
+  private resolveRegion(metricRegion: string | undefined): string | undefined {
+    if (!this.scope) {
+      return metricRegion;
+    }
+
+    const { region } = Stack.of(this.scope);
+    if (metricRegion !== region) {
+      return metricRegion;
+    }
+
+    return;
+  }
+  private getRegion(metric: MetricWithAlarmSupport): string | undefined {
+    let metricRegion: string | undefined;
+    if (metric instanceof MathExpression) {
+      metricRegion = metric.searchRegion;
+    } else {
+      metricRegion = metric.region;
+    }
+
+    return this.resolveRegion(metricRegion);
+  }
 }
diff --git a/lib/facade/MonitoringFacade.ts b/lib/facade/MonitoringFacade.ts
index a52a7c4e..e3620795 100644
--- a/lib/facade/MonitoringFacade.ts
+++ b/lib/facade/MonitoringFacade.ts
@@ -202,7 +202,12 @@ export class MonitoringFacade extends MonitoringScope {
   }
 
   createMetricFactory(): MetricFactory {
-    return new MetricFactory({ globalDefaults: this.metricFactoryDefaults });
+    return new MetricFactory(
+      {
+        globalDefaults: this.metricFactoryDefaults,
+      },
+      this,
+    );
   }
 
   createWidgetFactory(): IWidgetFactory {
diff --git a/lib/monitoring/aws-dynamo/DynamoTableGlobalSecondaryIndexMetricFactory.ts b/lib/monitoring/aws-dynamo/DynamoTableGlobalSecondaryIndexMetricFactory.ts
index 710cb257..05269deb 100644
--- a/lib/monitoring/aws-dynamo/DynamoTableGlobalSecondaryIndexMetricFactory.ts
+++ b/lib/monitoring/aws-dynamo/DynamoTableGlobalSecondaryIndexMetricFactory.ts
@@ -68,6 +68,8 @@ export class DynamoTableGlobalSecondaryIndexMetricFactory extends BaseMetricFact
         consumed_rcu_sum: this.table.metricConsumedReadCapacityUnits({
           statistic: MetricStatistic.SUM,
           dimensionsMap: this.dimensionsMap,
+          region: this.region,
+          account: this.account,
         }),
       },
       "Consumed",
@@ -81,6 +83,8 @@ export class DynamoTableGlobalSecondaryIndexMetricFactory extends BaseMetricFact
         consumed_wcu_sum: this.table.metricConsumedWriteCapacityUnits({
           statistic: MetricStatistic.SUM,
           dimensionsMap: this.dimensionsMap,
+          region: this.region,
+          account: this.account,
         }),
       },
       "Consumed",
diff --git a/lib/monitoring/aws-dynamo/DynamoTableMetricFactory.ts b/lib/monitoring/aws-dynamo/DynamoTableMetricFactory.ts
index f7a4e7a7..246e1ab7 100644
--- a/lib/monitoring/aws-dynamo/DynamoTableMetricFactory.ts
+++ b/lib/monitoring/aws-dynamo/DynamoTableMetricFactory.ts
@@ -72,6 +72,10 @@ export class DynamoTableMetricFactory extends BaseMetricFactory<DynamoTableMetri
         }),
       },
       ConsumedLabel,
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -86,6 +90,10 @@ export class DynamoTableMetricFactory extends BaseMetricFactory<DynamoTableMetri
         }),
       },
       ConsumedLabel,
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -97,6 +105,10 @@ export class DynamoTableMetricFactory extends BaseMetricFactory<DynamoTableMetri
         provisioned_read_cap: this.metricProvisionedReadCapacityUnits(),
       },
       "Utilization",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -108,6 +120,10 @@ export class DynamoTableMetricFactory extends BaseMetricFactory<DynamoTableMetri
         provisioned_write_cap: this.metricProvisionedWriteCapacityUnits(),
       },
       "Utilization",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -121,6 +137,10 @@ export class DynamoTableMetricFactory extends BaseMetricFactory<DynamoTableMetri
       },
       MetricStatistic.AVERAGE,
       DynamoDbNamespace,
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
diff --git a/lib/monitoring/aws-kinesis/KinesisFirehoseMetricFactory.ts b/lib/monitoring/aws-kinesis/KinesisFirehoseMetricFactory.ts
index 873d2f6e..d9424a53 100644
--- a/lib/monitoring/aws-kinesis/KinesisFirehoseMetricFactory.ts
+++ b/lib/monitoring/aws-kinesis/KinesisFirehoseMetricFactory.ts
@@ -151,6 +151,10 @@ export class KinesisFirehoseMetricFactory extends BaseMetricFactory<KinesisFireh
         bytes_max: this.metricBytesPerSecondLimit(),
       },
       "Incoming Bytes / Limit",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -162,6 +166,10 @@ export class KinesisFirehoseMetricFactory extends BaseMetricFactory<KinesisFireh
         records_max: this.metricRecordsPerSecondLimit(),
       },
       "Incoming Records / Limit",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -173,6 +181,10 @@ export class KinesisFirehoseMetricFactory extends BaseMetricFactory<KinesisFireh
         requests_max: this.metricPutRequestsPerSecondLimit(),
       },
       "Incoming PutRequests / Limit",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
diff --git a/lib/monitoring/aws-lambda/LambdaFunctionEnhancedMetricFactory.ts b/lib/monitoring/aws-lambda/LambdaFunctionEnhancedMetricFactory.ts
index c589d5f9..dcc7bef2 100644
--- a/lib/monitoring/aws-lambda/LambdaFunctionEnhancedMetricFactory.ts
+++ b/lib/monitoring/aws-lambda/LambdaFunctionEnhancedMetricFactory.ts
@@ -89,6 +89,8 @@ export class LambdaFunctionEnhancedMetricFactory extends BaseMetricFactory<Lambd
     return this.metricFactory.adaptMetric(
       this.lambdaFunction.metricDuration({
         statistic: MetricStatistic.SUM,
+        region: this.region,
+        account: this.account,
       }),
     );
   }
diff --git a/lib/monitoring/aws-lambda/LambdaFunctionMetricFactory.ts b/lib/monitoring/aws-lambda/LambdaFunctionMetricFactory.ts
index 106f1b64..9a0c612f 100644
--- a/lib/monitoring/aws-lambda/LambdaFunctionMetricFactory.ts
+++ b/lib/monitoring/aws-lambda/LambdaFunctionMetricFactory.ts
@@ -77,6 +77,8 @@ export class LambdaFunctionMetricFactory extends BaseMetricFactory<LambdaFunctio
     return this.metricFactory.adaptMetric(
       this.lambdaFunction.metricInvocations({
         label: "Invocations",
+        region: this.region,
+        account: this.account,
       }),
     );
   }
diff --git a/lib/monitoring/aws-redshift/RedshiftClusterMetricFactory.ts b/lib/monitoring/aws-redshift/RedshiftClusterMetricFactory.ts
index d919d702..67a749f5 100644
--- a/lib/monitoring/aws-redshift/RedshiftClusterMetricFactory.ts
+++ b/lib/monitoring/aws-redshift/RedshiftClusterMetricFactory.ts
@@ -60,6 +60,10 @@ export class RedshiftClusterMetricFactory extends BaseMetricFactory<RedshiftClus
       "sQueryLatency90 / 1000",
       { sQueryLatency90 },
       "Short P90",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -73,6 +77,10 @@ export class RedshiftClusterMetricFactory extends BaseMetricFactory<RedshiftClus
       "mQueryLatency90 / 1000",
       { mQueryLatency90 },
       "Medium P90",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -86,6 +94,10 @@ export class RedshiftClusterMetricFactory extends BaseMetricFactory<RedshiftClus
       "lQueryLatency90 / 1000",
       { lQueryLatency90 },
       "Long P90",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -104,6 +116,10 @@ export class RedshiftClusterMetricFactory extends BaseMetricFactory<RedshiftClus
       "readLatency * 1000",
       { readLatency },
       "Read P90",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -118,6 +134,10 @@ export class RedshiftClusterMetricFactory extends BaseMetricFactory<RedshiftClus
       "writeLatency * 1000",
       { writeLatency },
       "Write P90",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
diff --git a/lib/monitoring/aws-sqs/SqsQueueMetricFactory.ts b/lib/monitoring/aws-sqs/SqsQueueMetricFactory.ts
index e3f31b7b..cd77a4b5 100644
--- a/lib/monitoring/aws-sqs/SqsQueueMetricFactory.ts
+++ b/lib/monitoring/aws-sqs/SqsQueueMetricFactory.ts
@@ -79,6 +79,10 @@ export class SqsQueueMetricFactory extends BaseMetricFactory<SqsQueueMetricFacto
         productionVolume: this.metricIncomingMessageCount(),
       },
       "Production TPS (avg: ${AVG}, max: ${MAX})",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -89,6 +93,10 @@ export class SqsQueueMetricFactory extends BaseMetricFactory<SqsQueueMetricFacto
         consumptionVolume: this.metricDeletedMessageCount(),
       },
       "Consumption TPS (avg: ${AVG}, max: ${MAX})",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
@@ -103,6 +111,10 @@ export class SqsQueueMetricFactory extends BaseMetricFactory<SqsQueueMetricFacto
         consumptionVolume: this.metricDeletedMessageCount(),
       },
       "Time to Drain (seconds) (avg: ${AVG}, max: ${MAX})",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 }
diff --git a/lib/monitoring/aws-step-functions/StepFunctionServiceIntegrationMetricFactory.ts b/lib/monitoring/aws-step-functions/StepFunctionServiceIntegrationMetricFactory.ts
index c5693be2..7b32f53a 100644
--- a/lib/monitoring/aws-step-functions/StepFunctionServiceIntegrationMetricFactory.ts
+++ b/lib/monitoring/aws-step-functions/StepFunctionServiceIntegrationMetricFactory.ts
@@ -169,6 +169,9 @@ export class StepFunctionServiceIntegrationMetricFactory extends BaseMetricFacto
       this.dimensionsMap,
       undefined,
       Namespace,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 
diff --git a/lib/monitoring/aws-wafv2/WafV2MetricFactory.ts b/lib/monitoring/aws-wafv2/WafV2MetricFactory.ts
index bf46a127..5ee17b88 100644
--- a/lib/monitoring/aws-wafv2/WafV2MetricFactory.ts
+++ b/lib/monitoring/aws-wafv2/WafV2MetricFactory.ts
@@ -73,6 +73,10 @@ export class WafV2MetricFactory extends BaseMetricFactory<WafV2MetricFactoryProp
         blocked: this.metricBlockedRequests(),
       },
       "Blocked (rate)",
+      undefined,
+      undefined,
+      this.region,
+      this.account,
     );
   }
 }


Test patch:
diff --git a/test/common/metric/MetricFactory.test.ts b/test/common/metric/MetricFactory.test.ts
index f412487e..83f1cba3 100644
--- a/test/common/metric/MetricFactory.test.ts
+++ b/test/common/metric/MetricFactory.test.ts
@@ -1,5 +1,5 @@
-import { Duration } from "aws-cdk-lib";
-import { Metric } from "aws-cdk-lib/aws-cloudwatch";
+import { Duration, Stack } from "aws-cdk-lib";
+import { Color, Metric } from "aws-cdk-lib/aws-cloudwatch";
 
 import {
   MetricFactory,
@@ -167,16 +167,26 @@ test("snapshot test: createMetricMath", () => {
 });
 
 test("snapshot test: toRate with detail", () => {
-  const metricFactory = new MetricFactory({
-    globalDefaults: {
-      namespace: "DummyNamespace",
+  const stack = new Stack();
+  const metricFactory = new MetricFactory(
+    {
+      globalDefaults: {
+        namespace: "DummyNamespace",
+      },
     },
-  });
+    stack,
+  );
 
   const metric = metricFactory.createMetric(
     "Metric",
     MetricStatistic.SUM,
     "Label",
+    undefined,
+    Color.ORANGE,
+    "Namespace",
+    undefined,
+    "eu-west-1",
+    "01234567890",
   );
 
   const metricAverage = metricFactory.toRate(
@@ -186,6 +196,13 @@ test("snapshot test: toRate with detail", () => {
   );
   expect(metricAverage).toMatchSnapshot();
 
+  const metricAverageWithAccount = metricFactory.toRate(
+    metric.with({ account: "1111111111" }),
+    RateComputationMethod.AVERAGE,
+    true,
+  );
+  expect(metricAverageWithAccount).toMatchSnapshot();
+
   const metricPerSecond = metricFactory.toRate(
     metric,
     RateComputationMethod.PER_SECOND,
diff --git a/test/common/metric/__snapshots__/MetricFactory.test.ts.snap b/test/common/metric/__snapshots__/MetricFactory.test.ts.snap
index 32f8e0fc..ca773302 100644
--- a/test/common/metric/__snapshots__/MetricFactory.test.ts.snap
+++ b/test/common/metric/__snapshots__/MetricFactory.test.ts.snap
@@ -889,12 +889,12 @@ Object {
 
 exports[`snapshot test: toRate with detail 1`] = `
 Metric {
-  "account": undefined,
-  "color": undefined,
+  "account": "01234567890",
+  "color": "#ff7f0e",
   "dimensions": undefined,
   "label": "Label (avg) (min: \${MIN}, max: \${MAX})",
   "metricName": "Metric",
-  "namespace": "DummyNamespace",
+  "namespace": "Namespace",
   "period": Duration {
     "amount": 5,
     "unit": TimeUnit {
@@ -903,7 +903,7 @@ Metric {
       "label": "minutes",
     },
   },
-  "region": undefined,
+  "region": "eu-west-1",
   "statistic": "Average",
   "unit": undefined,
   "warnings": undefined,
@@ -911,8 +911,31 @@ Metric {
 `;
 
 exports[`snapshot test: toRate with detail 2`] = `
+Metric {
+  "account": "1111111111",
+  "color": "#ff7f0e",
+  "dimensions": undefined,
+  "label": "Label (avg) (min: \${MIN}, max: \${MAX})",
+  "metricName": "Metric",
+  "namespace": "Namespace",
+  "period": Duration {
+    "amount": 5,
+    "unit": TimeUnit {
+      "inMillis": 60000,
+      "isoLabel": "M",
+      "label": "minutes",
+    },
+  },
+  "region": "eu-west-1",
+  "statistic": "Average",
+  "unit": undefined,
+  "warnings": undefined,
+}
+`;
+
+exports[`snapshot test: toRate with detail 3`] = `
 MathExpression {
-  "color": undefined,
+  "color": "#ff7f0e",
   "expression": "m1 / PERIOD(m1)",
   "label": "Label/s (min: \${MIN}, max: \${MAX}, avg: \${AVG})",
   "period": Duration {
@@ -923,16 +946,16 @@ MathExpression {
       "label": "minutes",
     },
   },
-  "searchAccount": undefined,
-  "searchRegion": undefined,
+  "searchAccount": "01234567890",
+  "searchRegion": "eu-west-1",
   "usingMetrics": Object {
     "m1": Metric {
-      "account": undefined,
-      "color": undefined,
+      "account": "01234567890",
+      "color": "#ff7f0e",
       "dimensions": undefined,
       "label": "Label",
       "metricName": "Metric",
-      "namespace": "DummyNamespace",
+      "namespace": "Namespace",
       "period": Duration {
         "amount": 5,
         "unit": TimeUnit {
@@ -941,7 +964,7 @@ MathExpression {
           "label": "minutes",
         },
       },
-      "region": undefined,
+      "region": "eu-west-1",
       "statistic": "Sum",
       "unit": undefined,
       "warnings": undefined,
@@ -950,9 +973,9 @@ MathExpression {
 }
 `;
 
-exports[`snapshot test: toRate with detail 3`] = `
+exports[`snapshot test: toRate with detail 4`] = `
 MathExpression {
-  "color": undefined,
+  "color": "#ff7f0e",
   "expression": "(60 * m1) / PERIOD(m1)",
   "label": "Label/m (min: \${MIN}, max: \${MAX}, avg: \${AVG})",
   "period": Duration {
@@ -963,16 +986,16 @@ MathExpression {
       "label": "minutes",
     },
   },
-  "searchAccount": undefined,
-  "searchRegion": undefined,
+  "searchAccount": "01234567890",
+  "searchRegion": "eu-west-1",
   "usingMetrics": Object {
     "m1": Metric {
-      "account": undefined,
-      "color": undefined,
+      "account": "01234567890",
+      "color": "#ff7f0e",
       "dimensions": undefined,
       "label": "Label",
       "metricName": "Metric",
-      "namespace": "DummyNamespace",
+      "namespace": "Namespace",
       "period": Duration {
         "amount": 5,
         "unit": TimeUnit {
@@ -981,7 +1004,7 @@ MathExpression {
           "label": "minutes",
         },
       },
-      "region": undefined,
+      "region": "eu-west-1",
       "statistic": "Sum",
       "unit": undefined,
       "warnings": undefined,
@@ -990,9 +1013,9 @@ MathExpression {
 }
 `;
 
-exports[`snapshot test: toRate with detail 4`] = `
+exports[`snapshot test: toRate with detail 5`] = `
 MathExpression {
-  "color": undefined,
+  "color": "#ff7f0e",
   "expression": "(3600 * m1) / PERIOD(m1)",
   "label": "Label/h (min: \${MIN}, max: \${MAX}, avg: \${AVG})",
   "period": Duration {
@@ -1003,16 +1026,16 @@ MathExpression {
       "label": "minutes",
     },
   },
-  "searchAccount": undefined,
-  "searchRegion": undefined,
+  "searchAccount": "01234567890",
+  "searchRegion": "eu-west-1",
   "usingMetrics": Object {
     "m1": Metric {
-      "account": undefined,
-      "color": undefined,
+      "account": "01234567890",
+      "color": "#ff7f0e",
       "dimensions": undefined,
       "label": "Label",
       "metricName": "Metric",
-      "namespace": "DummyNamespace",
+      "namespace": "Namespace",
       "period": Duration {
         "amount": 5,
         "unit": TimeUnit {
@@ -1021,7 +1044,7 @@ MathExpression {
           "label": "minutes",
         },
       },
-      "region": undefined,
+      "region": "eu-west-1",
       "statistic": "Sum",
       "unit": undefined,
       "warnings": undefined,
@@ -1030,9 +1053,9 @@ MathExpression {
 }
 `;
 
-exports[`snapshot test: toRate with detail 5`] = `
+exports[`snapshot test: toRate with detail 6`] = `
 MathExpression {
-  "color": undefined,
+  "color": "#ff7f0e",
   "expression": "(86400 * m1) / PERIOD(m1)",
   "label": "Label/d (min: \${MIN}, max: \${MAX}, avg: \${AVG})",
   "period": Duration {
@@ -1043,16 +1066,16 @@ MathExpression {
       "label": "minutes",
     },
   },
-  "searchAccount": undefined,
-  "searchRegion": undefined,
+  "searchAccount": "01234567890",
+  "searchRegion": "eu-west-1",
   "usingMetrics": Object {
     "m1": Metric {
-      "account": undefined,
-      "color": undefined,
+      "account": "01234567890",
+      "color": "#ff7f0e",
       "dimensions": undefined,
       "label": "Label",
       "metricName": "Metric",
-      "namespace": "DummyNamespace",
+      "namespace": "Namespace",
       "period": Duration {
         "amount": 5,
         "unit": TimeUnit {
@@ -1061,7 +1084,7 @@ MathExpression {
           "label": "minutes",
         },
       },
-      "region": undefined,
+      "region": "eu-west-1",
       "statistic": "Sum",
       "unit": undefined,
       "warnings": undefined,
diff --git a/test/facade/MonitoringFacade.test.ts b/test/facade/MonitoringFacade.test.ts
index 579a9aaf..b79142fb 100644
--- a/test/facade/MonitoringFacade.test.ts
+++ b/test/facade/MonitoringFacade.test.ts
@@ -2,6 +2,7 @@ import { Duration, Stack } from "aws-cdk-lib";
 import { Capture, Template } from "aws-cdk-lib/assertions";
 import { TextWidget } from "aws-cdk-lib/aws-cloudwatch";
 import { Table } from "aws-cdk-lib/aws-dynamodb";
+import { Function } from "aws-cdk-lib/aws-lambda";
 import { Topic } from "aws-cdk-lib/aws-sns";
 import {
   DefaultDashboardFactory,
@@ -92,6 +93,7 @@ describe("test of defaults", () => {
         action: notifySns(onAlarmTopic),
       },
     });
+
     facade
       .addLargeHeader("My App Dashboard")
       .monitorDynamoTable({
@@ -110,11 +112,18 @@ describe("test of defaults", () => {
         ),
         region: "us-west-2",
         account: "01234567890",
-        addAverageSuccessfulGetItemLatencyAlarm: {
-          Critical: {
-            maxLatency: Duration.seconds(10),
+      })
+      .monitorLambdaFunction({
+        account: "01234567890",
+        region: "us-west-2",
+        lambdaFunction: Function.fromFunctionAttributes(
+          stack,
+          "XaXrImportedFunction",
+          {
+            functionArn: `arn:aws:lambda:us-west-2:01234567890:function:MyFunction`,
+            sameEnvironment: false,
           },
-        },
+        ),
       });
 
     expect(Template.fromStack(stack)).toMatchSnapshot();
diff --git a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap
index cfa5c01f..fa485bc5 100644
--- a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap
+++ b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap
@@ -2070,7 +2070,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
@@ -2152,7 +2152,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
@@ -9216,11 +9216,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests\\",\\"region\\":\\"",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -9228,11 +9224,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests (rate)\\",\\"region\\":\\"",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -9240,19 +9232,11 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"",
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -9274,11 +9258,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests\\",\\"region\\":\\"",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -9286,11 +9266,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests (rate)\\",\\"region\\":\\"",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Blocked Requests (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -9298,19 +9274,11 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"",
-              Object {
-                "Ref": "AWS::Region",
-              },
-              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Allowed\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"",
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Rule\\",\\"ALL\\",{\\"label\\":\\"Blocked\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
diff --git a/test/facade/__snapshots__/MonitoringFacade.test.ts.snap b/test/facade/__snapshots__/MonitoringFacade.test.ts.snap
index 065dec82..e4385a69 100644
--- a/test/facade/__snapshots__/MonitoringFacade.test.ts.snap
+++ b/test/facade/__snapshots__/MonitoringFacade.test.ts.snap
@@ -40,15 +40,15 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Consumed\\",\\"expression\\":\\"consumed_rcu_sum/PERIOD(consumed_rcu_sum)\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\",\\"id\\":\\"consumed_read_cap\\"}],[\\"AWS/DynamoDB\\",\\"ConsumedReadCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"consumed_rcu_sum\\"}],[\\"AWS/DynamoDB\\",\\"ProvisionedReadCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"label\\":\\"Provisioned\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"id\\":\\"provisioned_read_cap\\"}],[{\\"label\\":\\"Utilization\\",\\"expression\\":\\"100*(consumed_read_cap/provisioned_read_cap)\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\",\\"yAxis\\":\\"right\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false},\\"right\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":3,\\"x\\":0,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Write Usage\\",\\"region\\":\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Consumed\\",\\"expression\\":\\"consumed_rcu_sum/PERIOD(consumed_rcu_sum)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"id\\":\\"consumed_read_cap\\"}],[\\"AWS/DynamoDB\\",\\"ConsumedReadCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"consumed_rcu_sum\\"}],[\\"AWS/DynamoDB\\",\\"ProvisionedReadCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"label\\":\\"Provisioned\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"id\\":\\"provisioned_read_cap\\"}],[{\\"label\\":\\"Utilization\\",\\"expression\\":\\"100*(consumed_read_cap/provisioned_read_cap)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"yAxis\\":\\"right\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false},\\"right\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":3,\\"x\\":0,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Write Usage\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Consumed\\",\\"expression\\":\\"consumed_wcu_sum/PERIOD(consumed_wcu_sum)\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\",\\"id\\":\\"consumed_write_cap\\"}],[\\"AWS/DynamoDB\\",\\"ConsumedWriteCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"consumed_wcu_sum\\"}],[\\"AWS/DynamoDB\\",\\"ProvisionedWriteCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"label\\":\\"Provisioned\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"id\\":\\"provisioned_write_cap\\"}],[{\\"label\\":\\"Utilization\\",\\"expression\\":\\"100*(consumed_write_cap/provisioned_write_cap)\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\",\\"yAxis\\":\\"right\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false},\\"right\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":9,\\"height\\":6,\\"x\\":6,\\"y\\":9,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency (Average)\\",\\"region\\":\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Consumed\\",\\"expression\\":\\"consumed_wcu_sum/PERIOD(consumed_wcu_sum)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"id\\":\\"consumed_write_cap\\"}],[\\"AWS/DynamoDB\\",\\"ConsumedWriteCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"consumed_wcu_sum\\"}],[\\"AWS/DynamoDB\\",\\"ProvisionedWriteCapacityUnits\\",\\"TableName\\",\\"my-other-table\\",{\\"label\\":\\"Provisioned\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"id\\":\\"provisioned_write_cap\\"}],[{\\"label\\":\\"Utilization\\",\\"expression\\":\\"100*(consumed_write_cap/provisioned_write_cap)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"yAxis\\":\\"right\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false},\\"right\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":9,\\"height\\":6,\\"x\\":6,\\"y\\":9,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency (Average)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"my-other-table\\\\\\" MetricName=\\\\\\"SuccessfulRequestLatency\\\\\\"', 'Average', 300)\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"GetItem > 10000 for 3 datapoints within 15 minutes\\",\\"value\\":10000,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":3,\\"height\\":6,\\"x\\":15,\\"y\\":9,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Throttles\\",\\"region\\":\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"my-other-table\\\\\\" MetricName=\\\\\\"SuccessfulRequestLatency\\\\\\"', 'Average', 300)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":3,\\"height\\":6,\\"x\\":15,\\"y\\":9,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Throttles\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -56,7 +56,35 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"System Errors\\",\\"expression\\":\\"systemErrorGetItem+systemErrorBatchGetItem+systemErrorScan+systemErrorQuery+systemErrorGetRecords+systemErrorPutItem+systemErrorDeleteItem+systemErrorUpdateItem+systemErrorBatchWriteItem\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"GetItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorGetItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"BatchGetItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorBatchGetItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"Scan\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorScan\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"Query\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorQuery\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"GetRecords\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorGetRecords\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"PutItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorPutItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"DeleteItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorDeleteItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"UpdateItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorUpdateItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"BatchWriteItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorBatchWriteItem\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"System Errors\\",\\"expression\\":\\"systemErrorGetItem+systemErrorBatchGetItem+systemErrorScan+systemErrorQuery+systemErrorGetRecords+systemErrorPutItem+systemErrorDeleteItem+systemErrorUpdateItem+systemErrorBatchWriteItem\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"GetItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorGetItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"BatchGetItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorBatchGetItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"Scan\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorScan\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"Query\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorQuery\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"GetRecords\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorGetRecords\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"PutItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorPutItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"DeleteItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorDeleteItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"UpdateItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorUpdateItem\\"}],[\\"AWS/DynamoDB\\",\\"SystemErrors\\",\\"Operation\\",\\"BatchWriteItem\\",\\"TableName\\",\\"my-other-table\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"systemErrorBatchWriteItem\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":15,\\"properties\\":{\\"markdown\\":\\"### Lambda Function **[XaXrImportedFunction](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/functions/MyFunction)**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":0,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"",
+              Object {
+                "Ref": "AWS::Region",
+              },
+              "\\",\\"metrics\\":[[{\\"label\\":\\"TPS\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}],[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Invocations\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency\\",\\"region\\":\\"",
+              Object {
+                "Ref": "AWS::Region",
+              },
+              "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"P50 (avg: \${AVG})\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"P90 (avg: \${AVG})\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"P99 (avg: \${AVG})\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
+              Object {
+                "Ref": "AWS::Region",
+              },
+              "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Faults (avg)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Rates\\",\\"region\\":\\"",
+              Object {
+                "Ref": "AWS::Region",
+              },
+              "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Throttles (avg)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Provisioned Concurrency Spillovers (avg)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":21,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Invocations\\",\\"region\\":\\"",
+              Object {
+                "Ref": "AWS::Region",
+              },
+              "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Invocations\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Throttles\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"ConcurrentExecutions\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Concurrent\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Provisioned Concurrency Spillovers\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":21,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Iterator\\",\\"region\\":\\"",
+              Object {
+                "Ref": "AWS::Region",
+              },
+              "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"IteratorAge\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Iterator Age\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Maximum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":21,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors\\",\\"region\\":\\"",
+              Object {
+                "Ref": "AWS::Region",
+              },
+              "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"MyFunction\\",{\\"label\\":\\"Faults\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -107,50 +135,6 @@ Object {
       },
       "Type": "AWS::CloudWatch::Alarm",
     },
-    "MyAppFacadeMyAppXaXrImportedTableLatencyAverageGetItemCritical3480F8E9": Object {
-      "Properties": Object {
-        "ActionsEnabled": true,
-        "AlarmActions": Array [
-          Object {
-            "Ref": "OnAlarmTopicF22649A2",
-          },
-        ],
-        "AlarmDescription": "Average latency is too high.",
-        "AlarmName": "MyApp-XaXrImportedTable-Latency-Average-GetItem-Critical",
-        "ComparisonOperator": "GreaterThanThreshold",
-        "DatapointsToAlarm": 3,
-        "EvaluationPeriods": 3,
-        "Metrics": Array [
-          Object {
-            "AccountId": "01234567890",
-            "Id": "m1",
-            "Label": "GetItem",
-            "MetricStat": Object {
-              "Metric": Object {
-                "Dimensions": Array [
-                  Object {
-                    "Name": "Operation",
-                    "Value": "GetItem",
-                  },
-                  Object {
-                    "Name": "TableName",
-                    "Value": "my-other-table",
-                  },
-                ],
-                "MetricName": "SuccessfulRequestLatency",
-                "Namespace": "AWS/DynamoDB",
-              },
-              "Period": 300,
-              "Stat": "Average",
-            },
-            "ReturnData": true,
-          },
-        ],
-        "Threshold": 10000,
-        "TreatMissingData": "notBreaching",
-      },
-      "Type": "AWS::CloudWatch::Alarm",
-    },
     "OnAlarmTopicF22649A2": Object {
       "Properties": Object {
         "TopicName": "Alarm",
diff --git a/test/monitoring/TestMonitoringScope.ts b/test/monitoring/TestMonitoringScope.ts
index 69665d81..a9857b11 100644
--- a/test/monitoring/TestMonitoringScope.ts
+++ b/test/monitoring/TestMonitoringScope.ts
@@ -64,7 +64,10 @@ export class TestMonitoringScope extends MonitoringScope {
   }
 
   createMetricFactory(): MetricFactory {
-    return new MetricFactory({ globalDefaults: DummyGlobalMetricDefaults });
+    return new MetricFactory(
+      { globalDefaults: DummyGlobalMetricDefaults },
+      this,
+    );
   }
 
   createWidgetFactory(): IWidgetFactory {
diff --git a/test/monitoring/aws-cloudfront/CloudFrontDistribution.test.ts b/test/monitoring/aws-cloudfront/CloudFrontDistribution.test.ts
index d593906b..27707edd 100644
--- a/test/monitoring/aws-cloudfront/CloudFrontDistribution.test.ts
+++ b/test/monitoring/aws-cloudfront/CloudFrontDistribution.test.ts
@@ -33,7 +33,11 @@ import { TestMonitoringScope } from "../TestMonitoringScope";
   });
 
   test(`snapshot test: all alarms with additionalMetricsEnabled=${additionalMetricsEnabled}`, () => {
-    const stack = new Stack();
+    const stack = new Stack(undefined, undefined, {
+      env: {
+        region: "us-east-1",
+      },
+    });
     const bucket = new Bucket(stack, "Bucket");
     const distribution = new Distribution(stack, "Distribution", {
       defaultBehavior: {
diff --git a/test/monitoring/aws-cloudfront/__snapshots__/CloudFrontDistribution.test.ts.snap b/test/monitoring/aws-cloudfront/__snapshots__/CloudFrontDistribution.test.ts.snap
index c7cf8f62..731cc979 100644
--- a/test/monitoring/aws-cloudfront/__snapshots__/CloudFrontDistribution.test.ts.snap
+++ b/test/monitoring/aws-cloudfront/__snapshots__/CloudFrontDistribution.test.ts.snap
@@ -177,7 +177,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Traffic\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Traffic\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -185,11 +185,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Downloaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/CloudFront\\",\\"BytesUploaded\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Downloaded\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/CloudFront\\",\\"BytesUploaded\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -197,11 +197,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -396,7 +396,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"height\\":6,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"height\\":6,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -404,11 +404,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -623,7 +623,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Hit Rate\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Hit Rate\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -631,7 +631,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Hit Rate\\",\\"region\\":\\"us-east-1\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Traffic\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Hit Rate\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Traffic\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -639,11 +639,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Downloaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/CloudFront\\",\\"BytesUploaded\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Downloaded\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/CloudFront\\",\\"BytesUploaded\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -651,11 +651,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -850,7 +850,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"height\\":6,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"height\\":6,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -858,11 +858,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -1077,7 +1077,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Hit Rate\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Hit Rate\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -1085,7 +1085,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Hit Rate\\",\\"region\\":\\"us-east-1\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Traffic\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Hit Rate\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Traffic\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -1093,11 +1093,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Downloaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/CloudFront\\",\\"BytesUploaded\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Downloaded\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/CloudFront\\",\\"BytesUploaded\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -1105,11 +1105,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -1304,7 +1304,7 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"height\\":6,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"Uploaded\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Uploaded/s < 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Uploaded/s > 20 for 3 datapoints within 15 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"height\\":6,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"",
               Object {
                 "Ref": "AWS::Region",
               },
@@ -1312,11 +1312,11 @@ Object {
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"4XX\\"}],[\\"AWS/CloudFront\\",\\"5xxErrorRate\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
-              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"Region\\",\\"Global\\",{\\"label\\":\\"5XX\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"4XX > 0.5 for 3 datapoints within 15 minutes\\",\\"value\\":0.5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"5XX > 0.8 for 3 datapoints within 15 minutes\\",\\"value\\":0.8,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -1476,7 +1476,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
@@ -1525,7 +1525,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
@@ -1701,7 +1701,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
@@ -1758,7 +1758,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
@@ -1934,7 +1934,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
@@ -1991,7 +1991,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Uploaded/s\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/CloudFront\\",\\"Requests\\",\\"DistributionId\\",\\"",
               Object {
                 "Ref": "Distribution830FAC52",
               },
diff --git a/test/monitoring/aws-wafv2/__snapshots__/WafV2Monitoring.test.ts.snap b/test/monitoring/aws-wafv2/__snapshots__/WafV2Monitoring.test.ts.snap
index 99d0db60..46b864cf 100644
--- a/test/monitoring/aws-wafv2/__snapshots__/WafV2Monitoring.test.ts.snap
+++ b/test/monitoring/aws-wafv2/__snapshots__/WafV2Monitoring.test.ts.snap
@@ -294,7 +294,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Blocked (rate)\\",\\"expression\\":\\"100 * (blocked / (allowed + blocked))\\"}],[\\"AWS/WAFV2\\",\\"AllowedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Blocked (rate)\\",\\"expression\\":\\"100 * (blocked / (allowed + blocked))\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/WAFV2\\",\\"AllowedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
@@ -319,7 +319,7 @@ Object {
               Object {
                 "Ref": "AWS::Region",
               },
-              "\\",\\"metrics\\":[[{\\"label\\":\\"Blocked (rate)\\",\\"expression\\":\\"100 * (blocked / (allowed + blocked))\\"}],[\\"AWS/WAFV2\\",\\"AllowedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
+              "\\",\\"metrics\\":[[{\\"label\\":\\"Blocked (rate)\\",\\"expression\\":\\"100 * (blocked / (allowed + blocked))\\",\\"region\\":\\"us-east-1\\"}],[\\"AWS/WAFV2\\",\\"AllowedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Allowed\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"allowed\\"}],[\\"AWS/WAFV2\\",\\"BlockedRequests\\",\\"Region\\",\\"us-east-1\\",\\"Rule\\",\\"ALL\\",\\"WebACL\\",\\"DummyAclName\\",{\\"label\\":\\"Blocked\\",\\"region\\":\\"us-east-1\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"blocked\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}",
             ],
           ],
         },
diff --git a/test/monitoring/custom/CustomMonitoring.test.ts b/test/monitoring/custom/CustomMonitoring.test.ts
index 2888e240..a6138497 100644
--- a/test/monitoring/custom/CustomMonitoring.test.ts
+++ b/test/monitoring/custom/CustomMonitoring.test.ts
@@ -244,11 +244,14 @@ test("addToSummaryDashboard attribute takes value from CustomMonitoringProps if
 
 test("anomaly detection", () => {
   const stack = new Stack();
-  const metricFactory = new MetricFactory({
-    globalDefaults: {
-      namespace: "AnomalyNamespace",
+  const metricFactory = new MetricFactory(
+    {
+      globalDefaults: {
+        namespace: "AnomalyNamespace",
+      },
     },
-  });
+    stack,
+  );
 
   const scope = new TestMonitoringScope(stack, "Scope");