Skip to content

Commit

Permalink
fix(cloudwatch): cannot create Alarms from labeled metrics that start…
Browse files Browse the repository at this point in the history
… with a digit (#13560)

fixes #13434


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
BLasan committed Mar 12, 2021
1 parent d3f4284 commit 278029f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ export class Alarm extends AlarmBase {
return dispatchMetric(metric, {
withStat(stat, conf) {
self.validateMetricStat(stat, metric);

if (conf.renderingProperties?.label == undefined) {
return dropUndefined({
dimensions: stat.dimensions,
Expand All @@ -283,7 +282,7 @@ export class Alarm extends AlarmBase {
stat: stat.statistic,
unit: stat.unitFilter,
},
id: stat.metricName,
id: 'm1',
label: conf.renderingProperties?.label,
returnData: true,
} as CfnAlarm.MetricDataQueryProperty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Properties": {
"Metrics": [
{
"Id": "Metric",
"Id": "m1",
"Label": "Metric [AVG: ${AVG}]",
"MetricStat": {
"Metric": {
Expand All @@ -28,7 +28,7 @@
"Properties": {
"Metrics": [
{
"Id": "Metric",
"Id": "m1",
"Label": "Metric [AVG: ${AVG}]",
"MetricStat": {
"Metric": {
Expand Down

0 comments on commit 278029f

Please sign in to comment.