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

feat(logs): add dimensions to metric filter #21654

Merged
merged 14 commits into from
Sep 26, 2022
Merged

feat(logs): add dimensions to metric filter #21654

merged 14 commits into from
Sep 26, 2022

Conversation

iRoachie
Copy link
Contributor

@iRoachie iRoachie commented Aug 18, 2022

Allows attaching dimensions to a metric filter.

Uses the API design suggested by @marcogrcr in his comment which is agreed on.

resolves #16999


All Submissions:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Sorry, something went wrong.

@gitpod-io
Copy link

gitpod-io bot commented Aug 18, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team August 18, 2022 03:45
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 labels Aug 18, 2022
@iRoachie
Copy link
Contributor Author

@rix0rrr, @peterwoodworth could you review this?

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! This looks great, I just have a few comments inline.

Also, please make sure that your PR body describes the problem the PR is solving, and the design approach and alternatives considered. Explain why the PR solves the problem. A link to an issue is helpful, but does not replace an explanation of your thought process (See Contributing Guide, Pull Requests)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review August 18, 2022 17:04

Pull request has been modified.

@iRoachie
Copy link
Contributor Author

Updated the description of the pull request

iRoachie and others added 2 commits September 5, 2022 00:40

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review September 5, 2022 04:41

Pull request has been modified.

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting this back in change requested to reflect the status.

Verified

This commit was signed with the committer’s verified signature.
iRoachie Kyle Roach
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review September 12, 2022 12:02

Pull request has been modified.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was signed with the committer’s verified signature.
iRoachie Kyle Roach

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was signed with the committer’s verified signature.
iRoachie Kyle Roach
@iRoachie
Copy link
Contributor Author

@TheRealAmazonKendra Changes made

@mergify
Copy link
Contributor

mergify bot commented Sep 26, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mergify mergify bot merged commit f834a45 into aws:main Sep 26, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 26, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 9e1a5ca
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@iRoachie iRoachie deleted the metric-filters branch September 26, 2022 19:11
arewa pushed a commit to arewa/aws-cdk that referenced this pull request Oct 8, 2022
Allows attaching dimensions to a metric filter. 

Uses the API design suggested by @marcogrcr in his [comment](aws#16999 (comment)) which is agreed on.

resolves aws#16999


----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
homakk pushed a commit to homakk/aws-cdk that referenced this pull request Dec 1, 2022
Allows attaching dimensions to a metric filter. 

Uses the API design suggested by @marcogrcr in his [comment](aws#16999 (comment)) which is agreed on.

resolves aws#16999


----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@msambol
Copy link
Contributor

msambol commented Jan 7, 2023

@iRoachie I can't seem to get this to work, with a less than helpful error returned by CFN. It deploys if I remove dimensions. Posting here first but happy to move this to an issue if necessary.

        new logs.MetricFilter(this, 'Example', {
          logGroup: lambda.logGroup,
          metricNamespace: namingPrefix,
          metricName: metricOne,
          filterPattern: logs.FilterPattern.allTerms('[SUCCESS]'),
          metricValue: '1',
          dimensions: {
            'LambdaFunctionName': '$.lambdaFunctionName'
          }
        })

Error:

Resource handler returned message: "Invalid request provided: AWS::Logs::MetricFilter" (RequestToken: redacted, HandlerErrorCode: InvalidRequest)

CDK version:

❯ cdk --version                                            
2.55.0 (build 077d77d)

@msambol
Copy link
Contributor

msambol commented Jan 8, 2023

Closing the loop here, I figured this out with help from the console. I believe the reason my example above didn't work is because of my filter pattern. In the console you see: Dimensions – only applicable for JSON or delimited filter patterns.

@rosmcmahon
Copy link

Alarms don't seem to trigger when a dimension is included in the metric it's created with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-cdk/aws-logs: Cannot add dimensions to MetricFilter
5 participants