Skip to content

feat(applicationsignals-alpha): introduce Application Signals SLO L2 constructs #34413

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
467d2a6
Add application signals enablement L2
bjrara Jan 9, 2025
9516a5b
Address comments
bjrara Jan 22, 2025
a314a29
Update daemon test
bjrara Jan 22, 2025
22fad49
Address additional comments
bjrara Jan 22, 2025
4acf1ef
feat: Add L2 CDK for application-signals-slo
liunia-amazon Mar 31, 2025
3ffca9e
Improve interface definition and add more default values
liunia-amazon Apr 4, 2025
588dc02
update keyAttributes and add unit tests
TejeshreeDaliVenugopal May 9, 2025
015af7f
Merge branch 'main' into dalivete-dev/application-signals-slo
moelasmar May 10, 2025
60bec35
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
c5904e9
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
95ff88e
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
2c7cc85
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
82f93d3
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
c928a78
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
5c18ee9
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
27c51ef
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
10f503a
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
6a59aff
Delete packages/@aws-cdk/aws-applicationsignals-alpha/test/integ.ecs-…
moelasmar May 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions packages/@aws-cdk/aws-applicationsignals-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,91 @@ class MyStack extends cdk.Stack {
}
}
```

## Application Signals SLO L2 Constructs

A collection of L2 constructs which leverages native L1 CFN resources, simplifying Application Signals Service Level
Objectives (SLOs) creation process to monitor the reliability of a service against customer expectations.


### ServiceLevelObjective

`ServiceLevelObjective` aims to address key challenges in the current CDK process of creating and managing SLOs while providing the flexibility.
The construct provides two types of SLOs:<br>
Period-based SLOs: Evaluate performance against goals using defined time periods.<br>
Request-based SLOs: Measure performance based on request success ratios

Key Features:

1. Easy creation of both period-based and request-based SLOs.
2. Support for custom CloudWatch metrics and math expressions.
3. Automatic error budget calculation and tracking.

#### Use Case 1 - Create a Period-based SLO with custom metrics, default attainmentGoal: 99.9 and warningThreshold: 30

```
const periodSlo = ServiceLevelObjective.periodBased(this, 'PeriodSLO', {
name: 'my-period-slo',
goal: {
interval: Interval.rolling({
duration: 7,
unit: DurationUnit.DAY,
}),
},
metric: {
metricThreshold: 100,
periodSeconds: 300,
statistic: 'Average',
metricDataQueries: [/* ... */],
},
});
```

#### Use Case 2 - Create a Period-based SLO with service/operation, attainmentGoal is 99.99 and warningThreshold is 50

```
const availabilitySlo = ServiceLevelObjective.periodBased(this, 'ApiAvailabilitySlo', {
name: 'api-availability-slo',
description: 'API endpoint availability SLO',
goal: {
attainmentGoal: 99.99,
warningThreshold: 50,
interval: Interval.calendar({
duration: 1,
unit: DurationUnit.MONTH,
// default startTime is now,
}),
},
metric: {
metricThreshold: 99,
metricType: MetricType.AVAILABILITY,
operationName: 'OrderProcessing',
keyAttributes: KeyAttributes.service({
name: 'MyService',
environment: 'Development',
});
periodSeconds: 300,
statistic: 'Average',
},
});
```

#### Use Case 3 - Create request based SLO with custom metrics

```
const requestSlo = ServiceLevelObjective.requestBased(this, 'RequestSLO', {
name: 'my-request-slo',
goal: {
interval: Interval.calendar({
duration: 30,
unit: DurationUnit.DAY,
startTime: 1,
}),
},
metric: {
metricThreshold: 200,
goodCountMetrics: [/* ... */],
totalCountMetrics: [/* ... */],
},
});
```
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-applicationsignals-alpha/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export * from './enablement/constants';
export * from './enablement/instrumentation-versions';
export * from './enablement/ecs-cloudwatch-agent';
export * from './enablement/ecs-sdk-instrumentation';
export * from './slo/slo';
export * from './slo/slo-types';
162 changes: 162 additions & 0 deletions packages/@aws-cdk/aws-applicationsignals-alpha/lib/slo/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/**
* Types of metrics that can be used for SLIs
*/
export enum MetricType {
/**
* Latency-based metric type
* Used for measuring response time or duration
*/
LATENCY = 'LATENCY',

/**
* Availability-based metric type
* Used for measuring uptime or success rate
*/
AVAILABILITY = 'AVAILABILITY'
}

/**
* Default values for goal configuration
*/
export const DEFAULT_GOAL_CONFIG = {
ATTAINMENT_GOAL: 99.9,
WARNING_THRESHOLD: 30,
} as const;

/**
* Comparison operators for metric thresholds
*/
export enum ComparisonOperator {
/**
* Greater than operator
* True if metric value is strictly greater than threshold
*/
GREATER_THAN = 'GREATER_THAN',

/**
* Less than operator
* True if metric value is strictly less than threshold
*/
LESS_THAN = 'LESS_THAN',

/**
* Greater than or equal operator
* True if metric value is greater than or equal to threshold
*/
GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL',

/**
* Less than or equal operator
* True if metric value is less than or equal to threshold
*/
LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL'
}

/**
* Statistical methods for aggregating metric values
*/
export enum MetricStatistic {
/**
* Average of all values in the period
*/
AVERAGE = 'Average',

/**
* Sum of all values in the period
*/
SUM = 'Sum',

/**
* Minimum value in the period
*/
MINIMUM = 'Minimum',

/**
* Maximum value in the period
*/
MAXIMUM = 'Maximum',

/**
* Count of samples in the period
*/
SAMPLE_COUNT = 'SampleCount',

/**
* 99th percentile of values in the period
*/
P99 = 'p99',

/**
* 95th percentile of values in the period
*/
P95 = 'p95',

/**
* 90th percentile of values in the period
*/
P90 = 'p90',

/**
* 50th percentile (median) of values in the period
*/
P50 = 'p50'
}

/**
* Types of services that can be monitored
*/
export enum KeyAttributeType {
/**
* Service running in your account
*/
SERVICE = 'SERVICE',

/**
* AWS managed service
*/
AWS_SERVICE = 'AWS_SERVICE',

/**
* External service
*/
REMOTE_SERVICE = 'REMOTE_SERVICE',

/**
* Resource
*/

RESOURCE = 'RESOURCE',

/**
* AWS managed Resource
*/

AWS_RESOURCE = 'AWS::RESOURCE'

}

/**
* Units for duration measurement in SLO intervals
*/
export enum DurationUnit {
/**
* Minute unit for fine-grained intervals
*/
MINUTE = 'MINUTE',

/**
* Hour unit for medium-term intervals
*/
HOUR = 'HOUR',

/**
* Day unit for daily intervals
*/
DAY = 'DAY',

/**
* Month unit for long-term intervals
* Used for calendar-aligned monitoring
*/
MONTH = 'MONTH'
}
Loading
Loading