Skip to content

feat(appsync): add EnhancedMetricsConfigProperty for GraphQL api#35328

Merged
mergify[bot] merged 58 commits intoaws:mainfrom
aki-kii:appsync-graphqlapi-enhanced-metrics
Mar 3, 2026
Merged

feat(appsync): add EnhancedMetricsConfigProperty for GraphQL api#35328
mergify[bot] merged 58 commits intoaws:mainfrom
aki-kii:appsync-graphqlapi-enhanced-metrics

Conversation

@aki-kii
Copy link
Copy Markdown
Contributor

@aki-kii aki-kii commented Aug 25, 2025

Issue # (if applicable)

Closes #29933 .

Reason for this change

A property in L1 construct was not in L2 construct.

Description of changes

Add enhancedMetricsConfig property to GraphqlApiProps and set in the CfnGraphQLApi constructor.

  • The enhanced Metrics Config now includes the operationLevelMetricsEnabled property, which has changed from an enum of "ENABLED" and "DISABLED" to a boolean.
  • The properties of EnhancedMetricsConfig are not flattened because they interact with each other.
    For example, if operationLevelMetricsConfig is enabled, dataSourceLevelMetricsBehavior will default to PER_DATA_SOURCE_METRICS.

Describe any new or updated permissions being added

Description of how you validated changes

Added both unit and integration tests.

Checklist


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

@github-actions github-actions Bot added the p2 label Aug 25, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team August 25, 2025 17:00
@github-actions github-actions Bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Aug 25, 2025
@aki-kii aki-kii force-pushed the appsync-graphqlapi-enhanced-metrics branch from 6566b24 to d62f669 Compare August 26, 2025 00:31
Copy link
Copy Markdown
Contributor

@mazyu36 mazyu36 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 the contribution.
Before reviewing the details, let me confirm.
Don’t we need to add the metricConfig property to Resolver and DataSource?
If the API’s config is set to per-resolver metrics, I think the resolver’s config is also needed.

https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-appsync-datasource.html#cfn-appsync-datasource-metricsconfig

https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-appsync-resolver.html#cfn-appsync-resolver-metricsconfig

@mazyu36
Copy link
Copy Markdown
Contributor

mazyu36 commented Aug 26, 2025

There’s an existing issue, please associate it.

#29933

Copy link
Copy Markdown
Contributor

@badmintoncryer badmintoncryer 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 you contribution! I've added some minor comments.

});

api.addNoneDataSource('NoneDS', {
name: cdk.Lazy.string({ produce(): string { return 'NoneDS'; } }),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is it necessary to use Lazy here? 

Copy link
Copy Markdown
Contributor Author

@aki-kii aki-kii Sep 4, 2025

Choose a reason for hiding this comment

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

@badmintoncryer
Thanks.
Thinking it over again, I found I didn't need to use Lazy.

new appsync.GraphqlApi(stack, 'minimal-enhanced-metrics', {
name: 'enhanced-metrics',
schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')),
enhancedMetricsConfig: {},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do other constructs also have arguments where we can pass {} like this?
Personally, I feel that having settings activated as a result of passing {} is not very intuitive.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I found that the appsync.GraphqlApi.logConfig property was passing {}, but I think also passing {} is not very intuitive.

Suggest requiring the dataSourceLevelMetricsBehavior and resolverLevelMetricsBehavior property, because after setting those property the behavior changes.

ex)

EnhancedMetricsConfig {
  readonly dataSourceLevelMetricsBehavior: DataSourceLevelMetricsBehavior;
  readonly operationLevelMetricsEnabled?: boolean;
  readonly resolverLevelMetricsBehavior: ResolverLevelMetricsBehavior;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some of the existing arguments can also accept empty objects! In that case, I don’t think it’s a big issue, so please feel free to implement it in whichever way you prefer!

Copy link
Copy Markdown
Contributor Author

@aki-kii aki-kii Sep 4, 2025

Choose a reason for hiding this comment

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

@badmintoncryer
Implemented dataSourceLevelMetricsBehavior and resolverLevelMetricsBehavior as required properties.

@aki-kii
Copy link
Copy Markdown
Contributor Author

aki-kii commented Aug 26, 2025

Thank you for the contribution. Before reviewing the details, let me confirm. Don’t we need to add the metricConfig property to Resolver and DataSource? If the API’s config is set to per-resolver metrics, I think the resolver’s config is also needed.

https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-appsync-datasource.html#cfn-appsync-datasource-metricsconfig

https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-appsync-resolver.html#cfn-appsync-resolver-metricsconfig

@mazyu36
Thinking it over again, I believe metricConfig property of DataSource and Resolver are necessary.
I’ll go implement those properties.

@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. labels Aug 26, 2025
@aki-kii aki-kii changed the title feat(appsync): add EnhancedMetricsConfigProperty for graphql api feat(appsync): add EnhancedMetricsConfigProperty for graphql api #29933 Aug 26, 2025
@aki-kii aki-kii changed the title feat(appsync): add EnhancedMetricsConfigProperty for graphql api #29933 feat(appsync): add EnhancedMetricsConfigProperty for graphql api Aug 26, 2025
@aki-kii
Copy link
Copy Markdown
Contributor Author

aki-kii commented Aug 26, 2025

There’s an existing issue, please associate it.

#29933

@mazyu36
Sorry. I've associated the issue.

@aki-kii aki-kii force-pushed the appsync-graphqlapi-enhanced-metrics branch from a2a41a7 to d8b65ca Compare August 30, 2025 12:44
@aki-kii aki-kii force-pushed the appsync-graphqlapi-enhanced-metrics branch from d8b65ca to af5940a Compare September 2, 2025 01:35
@aki-kii aki-kii force-pushed the appsync-graphqlapi-enhanced-metrics branch from af5940a to 4b19182 Compare September 2, 2025 01:38
@aki-kii aki-kii force-pushed the appsync-graphqlapi-enhanced-metrics branch from 02248fb to 3f4abf1 Compare September 4, 2025 17:07
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 2, 2026

Merge Queue Status

Rule: default-squash


  • Entered queue2026-03-02 12:09 UTC
  • 🚫 Left the queue2026-03-02 14:49 UTC · at 41cdd9473e6472d0f8f48d0a3b2598f5a96d79b9

This pull request spent 2 hours 39 minutes 49 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/close-stale-prs.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@kumsmrit kumsmrit removed the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Mar 2, 2026
@mergify mergify Bot dismissed kumsmrit’s stale review March 2, 2026 16:52

Pull request has been modified.

kumsmrit
kumsmrit previously approved these changes Mar 2, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 2, 2026

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).

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 2, 2026

Merge Queue Status

Rule: default-squash


  • Entered queue2026-03-02 17:36 UTC
  • 🚫 Left the queue2026-03-02 17:36 UTC · at 609c7fa259d8ad1a82e24daeabc892ff716789d7

This pull request spent 5 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/pr-linter.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 3, 2026

Merge Queue Status

Rule: default-squash


  • Entered queue2026-03-02 17:36 UTC
  • 🚫 Left the queue2026-03-02 17:36 UTC · at 609c7fa259d8ad1a82e24daeabc892ff716789d7

This pull request spent 5 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/pr-linter.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@mergify mergify Bot dismissed kumsmrit’s stale review March 3, 2026 09:26

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 3, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 3, 2026

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).

@mergify mergify Bot temporarily deployed to automation March 3, 2026 10:11 Inactive
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 3, 2026

Merge Queue Status

Rule: default-squash


  • Entered queue2026-03-03 10:11 UTC
  • Checks passed · in-place
  • Merged2026-03-03 10:42 UTC · at 06a14a89118fb20aed4f3597d5ab4b726dc17b2b

This pull request spent 30 minutes 47 seconds in the queue, including 30 minutes 37 seconds running CI.

Required conditions to merge

@mergify mergify Bot temporarily deployed to automation March 3, 2026 10:11 Inactive
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 3, 2026

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).

@mergify mergify Bot merged commit ebfaf89 into aws:main Mar 3, 2026
20 of 21 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 3, 2026

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 3, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-appsync): Add Enhanced Metrics configuration to CDK

6 participants