Skip to content

Commit a8e930e

Browse files
committed
fix(aws-cloudwatch): metric id should be started with a lowercase letter
fixes #13434
1 parent a4dcce2 commit a8e930e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class Alarm extends AlarmBase {
257257
return dispatchMetric(metric, {
258258
withStat(stat, conf) {
259259
self.validateMetricStat(stat, metric);
260-
260+
const id = 'm_' + stat.metricName
261261
if (conf.renderingProperties?.label == undefined) {
262262
return dropUndefined({
263263
dimensions: stat.dimensions,
@@ -283,7 +283,7 @@ export class Alarm extends AlarmBase {
283283
stat: stat.statistic,
284284
unit: stat.unitFilter,
285285
},
286-
id: stat.metricName,
286+
id: id,
287287
label: conf.renderingProperties?.label,
288288
returnData: true,
289289
} as CfnAlarm.MetricDataQueryProperty,

packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Properties": {
66
"Metrics": [
77
{
8-
"Id": "Metric",
8+
"Id": "m_Metric",
99
"Label": "Metric [AVG: ${AVG}]",
1010
"MetricStat": {
1111
"Metric": {
@@ -28,7 +28,7 @@
2828
"Properties": {
2929
"Metrics": [
3030
{
31-
"Id": "Metric",
31+
"Id": "m_Metric",
3232
"Label": "Metric [AVG: ${AVG}]",
3333
"MetricStat": {
3434
"Metric": {

0 commit comments

Comments
 (0)