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

(cloudfront): Flag on Distribution L2 to enable publishing additional CloudWatch metrics #22922

Closed
2 tasks
straygar opened this issue Nov 15, 2022 · 4 comments · Fixed by #28777
Closed
2 tasks
Assignees
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@straygar
Copy link

Describe the feature

The CloudFront UI and API lets you enable more granular metrics per-distribution, at an additional (fixed) cost.

There is an L1 construct that lets you do this, which can be easily integrated into the L2 construct and enabled via a prop.

Use Case

I want to create a dashboard of data like origin latency, Lambda@Edge error rate etc. and alarm on these metrics.

Proposed Solution

An additional prop for cloudfront.Distribution:

new Distribution(this, 'Distro', {
    ...,
    publishAdditionalMetrics: true,  // default: false
});

If this is set to true a CfnMonitoringSubscription instance is created:

new CfnMonitoringSubscription(nextJsDeployment.distribution, 'MonitoringSubscription', {
    distributionId: nextJsDeployment.distribution.distributionId,
    monitoringSubscription: {
        realtimeMetricsSubscriptionConfig: {
            realtimeMetricsSubscriptionStatus: 'Enabled',
        }
    }
});

Also, we probably want to expose these metrics via distro.metricsXyz() methods (should probably throw, if publishAdditionalMetrics is set to false.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.50.0

Environment details (OS name and version, etc.)

n/a

@straygar straygar added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 15, 2022
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Nov 15, 2022
@straygar straygar changed the title (cloudfront): Monitoring Subscription, to enable additional CloudWatch metrics (cloudfront): Create CfnMonitoringSubscription in Distribution, to publish additional CloudWatch metrics Nov 15, 2022
@straygar straygar changed the title (cloudfront): Create CfnMonitoringSubscription in Distribution, to publish additional CloudWatch metrics (cloudfront): Flag on Distribution L2 to enable publishing additional CloudWatch metrics Nov 15, 2022
@peterwoodworth peterwoodworth added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 15, 2022
@peterwoodworth
Copy link
Contributor

Thanks for the feature request @straygar,

I am marking this issue as p2, which means that we are unable to work on this immediately.

We use +1s to help prioritize our work, and are happy to revaluate this issue based on community feedback. You can reach out to the cdk.dev community on Slack to solicit support for reprioritization.

Check out our contributing guide if you're interested in contributing yourself. Before you start contributing, you will probably want to spend some time discussing the best direction to go with someone on the team. There aren't any L2s for CfnMonitoringSubscription yet, it's possible we'd want to tackle that first before this feature.

@straygar
Copy link
Author

straygar commented Nov 19, 2022

@peterwoodworth Alright, thanks! I'd like to contribute, but I'm not sure what discussion is to be had there. CfnMonitoringSubscription is currently just a boolean flag wrapped in some objects, I reckon creating an L2 might be overkill. Happy to be challenged though.

My suggestion above was just a publishAdditionalMetrics/publishRealtimeMetrics flag, but we can also make it an object to be ready for future CFN changes:

monitoringSubscriptions: { 
    realtimeMetrics: RealtimeMetrics.ENABLED/DISABLED 
}

In any case, what is the best way to involve somebody from the CDK team to discuss this?

Copy link

This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.

@github-actions github-actions bot added p1 and removed p2 labels Nov 19, 2023
@mergify mergify bot closed this as completed in #28777 Jan 25, 2024
mergify bot pushed a commit that referenced this issue Jan 25, 2024
This PR supports the activation of [additional cloudfront distribution metrics](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/viewing-cloudfront-metrics.html#monitoring-console.distributions-additional).

```ts
new cloudfront.Distribution(this, 'myDist', {
  defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') },
  publishAdditionalMetrics: true, // added
});
```

Closes #22922.

----

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

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Vandita2020 pushed a commit to Vandita2020/aws-cdk that referenced this issue Jan 30, 2024
This PR supports the activation of [additional cloudfront distribution metrics](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/viewing-cloudfront-metrics.html#monitoring-console.distributions-additional).

```ts
new cloudfront.Distribution(this, 'myDist', {
  defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') },
  publishAdditionalMetrics: true, // added
});
```

Closes aws#22922.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
SankyRed pushed a commit that referenced this issue Feb 8, 2024
This PR supports the activation of [additional cloudfront distribution metrics](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/viewing-cloudfront-metrics.html#monitoring-console.distributions-additional).

```ts
new cloudfront.Distribution(this, 'myDist', {
  defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') },
  publishAdditionalMetrics: true, // added
});
```

Closes #22922.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants