Skip to content

Conversation

@liunia-amazon
Copy link

Issue # (if applicable)

Description of changes

This PR adds L2 constructs to simplify the Application Signals slo process. See aws/aws-cdk-rfcs#673 for more details.

Describe any new or updated permissions being added

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team March 31, 2025 20:26
@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Mar 31, 2025
@moelasmar moelasmar self-assigned this Apr 7, 2025
@moelasmar moelasmar added the pr/do-not-merge This PR should not be merged at this time. label Apr 24, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter fails with the following errors:

❌ Features must contain a change to a README file.
❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 4aa9cf0
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing

To prevent automatic closure:

  • Resume work on the PR
  • OR request an exemption by adding a comment containing 'Exemption Request' with justification e.x "Exemption Request: "
  • OR request clarification by adding a comment containing 'Clarification Request' with a question e.x "Clarification Request: "

This PR will automatically close in 14 days if no action is taken.

Copy link
Contributor

@moelasmar moelasmar left a comment

Choose a reason for hiding this comment

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

Please add more docs to the created classes, functions, and properties.
Also, I believe the changes in integ test snapshots are not correct, and should be cleaned.
You need to add unit testing, and integ testing

Comment on lines +21 to +24
export const DEFAULT_GOAL_CONFIG = {
ATTAINMENT_GOAL: 99.9,
WARNING_THRESHOLD: 30,
} as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

either move these constants as static properties in some class and it is better to be the classes where these values be used, or make them private. Do we need to add these values in CDK Docs, and let the customers use them ?

Comment on lines +7 to +8
export * from './slo/slo';
export * from './slo/slo-types';
Copy link
Contributor

Choose a reason for hiding this comment

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

add an index.ts in the slo dir, and expose whatever you want there. Here, add only the directory

/**
* Types of services that can be monitored
*/
export enum KeyAttributeType {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see some difference between the implementation and the RFC. RFC suggested more values (RESOURCE, AWS::RESOURCE)

/**
* Interface defining SLO behavior and runtime properties
*/
export interface ISlo {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is the L2 construct interface, so I prefer use the I<> format. so, it should be IServiceLevelObjective. Also, in comment, mention that this is the Interface for L2 construct of the resource AWS::ApplicationSignals::ServiceLevelObjective

Comment on lines +151 to +157
/**
* Binds the SLO configuration to L1 construct properties
* Used internally by CDK to generate CloudFormation
*
* @returns The L1 construct properties
*/
_bind(): any;
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we do not need this. if this is the L2, we usually will create the L1 construct in the L2 class' constructor

Copy link
Contributor

Choose a reason for hiding this comment

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

if I am wrong, and this is needed. Please add @internal annotation to it, so we do not expose this function to external customers, and skip adding it in docs

Comment on lines +348 to +357

/**
* Period-based metric properties
*/
export type PeriodBasedMetricProps = PeriodBasedAppSignalsMetricProps | PeriodBasedCloudWatchMetricProps;

/**
* Request-based metric properties
*/
export type RequestBasedMetricProps = RequestBasedAppSignalsMetricProps | RequestBasedCloudWatchMetricProps;
Copy link
Contributor

Choose a reason for hiding this comment

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

we do not use union types. Use Inheritance for this pattern, also do you want that type to be exposed to customers, if no, use @internal annotation on it

Comment on lines +96 to +110
export type SliMetricBaseProps = {
/**
* The threshold value for the metric
*
* @required
*/
readonly metricThreshold: number;

/**
* The comparison operator
*
* @default - Based on metric type
*/
readonly comparisonOperator?: ComparisonOperator;
} & (ApplicationSignalsMetricProps | CloudWatchMetricProps);
Copy link
Contributor

Choose a reason for hiding this comment

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

create actual interfaces, we do not support this while translating these types to other languages using JSII

return new RollingInterval(props);
}

abstract bind(): any;
Copy link
Contributor

Choose a reason for hiding this comment

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

make it _bind() and also annotated with @internal

return {
attainmentGoal: this.props.attainmentGoal ?? DEFAULT_GOAL_CONFIG.ATTAINMENT_GOAL,
warningThreshold: this.props.warningThreshold ?? DEFAULT_GOAL_CONFIG.WARNING_THRESHOLD,
interval: this.props.interval._bind(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is wrong, you defined in the interface as bind not _bind

Comment on lines +80 to +88
bind() {
return {
calendarInterval: {
duration: this.duration,
durationUnit: this.unit,
startTime: this.startTime,
},
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the returning type ?

@moelasmar moelasmar marked this pull request as draft May 23, 2025 22:24
@moelasmar moelasmar closed this May 24, 2025
@github-actions
Copy link
Contributor

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 May 24, 2025
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 p2 pr/do-not-merge This PR should not be merged at this time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants