Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDK generates alarm with both ExtendedStatistic and Statistic when percentile is used #7341

Closed
yukuan1988 opened this issue Apr 14, 2020 · 0 comments · Fixed by #7383
Closed
Assignees
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. p1

Comments

@yukuan1988
Copy link

description of the bug: when I use percentile in Statistic, alarm is generated with both Statistic and ExtendedStatistic.

Reproduction Steps

CDK code:

function getAlarm(construct: cdk.Construct, id: string, alarmName: string, metricName: string, threshold: number, alarmDescription: string, statistic: string): Alarm {
            return new Alarm(construct, id, {
                alarmName,
                alarmDescription,
                metric: new Metric({
                    namespace: 'AWS/ES',
                    metricName,
                    dimensions: {
                        DomainName: esDomain.domainName,
                        ClientId: account
                    }
                }),
                threshold,
                statistic,
                evaluationPeriods: 3,
                period: cdk.Duration.minutes(5),
                comparisonOperator: ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
                treatMissingData: TreatMissingData.NOT_BREACHING
            });
        }

            getAlarm(this, 'ES_DOMAIN_HIGHWRITELATENCY_ALARM', 'ES_DOMAIN_HIGHWRITELATENCY', 'WriteLatency', 2/* seconds */, 'Alarm for when the ES cluster has high write latency', 'p90'),

Generated template:

"ESDOMAINHIGHWRITELATENCYALARM8819DAF6": {
        "Type": "AWS::CloudWatch::Alarm",
        "Properties": {
          "ComparisonOperator": "GreaterThanOrEqualToThreshold",
          "EvaluationPeriods": 3,
          "AlarmDescription": "Alarm for when the ES cluster has high write latency",
          "AlarmName": "ES_DOMAIN_HIGHWRITELATENCY",
          "Dimensions": [
            {
              "Name": "ClientId",
              "Value": "453055088523"
            },
            {
              "Name": "DomainName",
              "Value": "contents-simonyu"
            }
          ],
          "ExtendedStatistic": "p90",
          "MetricName": "WriteLatency",
          "Namespace": "AWS/ES",
          "Period": 300,
          "Statistic": "Average",
          "Threshold": 2,
          "TreatMissingData": "notBreaching"
        },
        "Metadata": {
          "aws:cdk:path": "Monitoring-Dev-simonyu/ES_DOMAIN_HIGHWRITELATENCY_ALARM/Resource"
        }
      },

Error Log

Environment

  • **CLI Version : 1.23.0
  • **Framework Version: 1.23.0
  • **OS : MacOS & Linux
  • **Language : TypeScript

Other


This is 🐛 Bug Report

@yukuan1988 yukuan1988 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 14, 2020
@SomayaB SomayaB added the @aws-cdk/aws-cloudwatch Related to Amazon CloudWatch label Apr 14, 2020
rix0rrr added a commit that referenced this issue Apr 16, 2020
A simple statistic of a `Metric` couldn't be overridden with a
percentile statistic while creating an `Alarm`.

Because of the way the objects were combined, both `Statistic`
and `ExtendedStatistic` properties would be present in the resulting
object, which is an error for CloudWatch.

Fixes #7341.
@rix0rrr rix0rrr added the p1 label Apr 16, 2020
@mergify mergify bot closed this as completed in #7383 Apr 21, 2020
mergify bot pushed a commit that referenced this issue Apr 21, 2020
A simple statistic of a `Metric` couldn't be overridden with a
percentile statistic while creating an `Alarm`.

Because of the way the objects were combined, both `Statistic`
and `ExtendedStatistic` properties would be present in the resulting
object, which is an error for CloudWatch.

Fixes #7341.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants