Skip to content

Commit

Permalink
fix: Global Default Region and Account not set in certain metrics
Browse files Browse the repository at this point in the history
Adds them to the metric in adaptMetric if they are present in globalDefault
  • Loading branch information
umardab-amzn committed Dec 18, 2024
1 parent 54d6a06 commit 5aa9986
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
8 changes: 8 additions & 0 deletions lib/common/metric/MetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ export class MetricFactory {
* @param metric metric to be adapted
*/
adaptMetric(metric: MetricWithAlarmSupport): MetricWithAlarmSupport {
if (this.globalDefaults.region) {
metric = metric.with({ region: this.globalDefaults.region });
}

if (this.globalDefaults.account) {
metric = metric.with({ account: this.globalDefaults.account });
}

return metric.with({
period: this.globalDefaults.period ?? DefaultMetricPeriod,
});
Expand Down
Loading

0 comments on commit 5aa9986

Please sign in to comment.