Skip to content

Commit

Permalink
fix: Global Default Region and Account not set in certain metrics (#615)
Browse files Browse the repository at this point in the history
Adds them to the metric in adaptMetric if they are present in
globalDefault

---

_By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license_
  • Loading branch information
umardab-amzn authored Dec 18, 2024
1 parent 54d6a06 commit 8b50140
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 8b50140

Please sign in to comment.