Skip to content

Commit a371e31

Browse files
author
Eugene Cheung
authored
chore: update docs [skip ci] (#195)
Closes #146 Also includes some other general/minor doc cleanups. --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent 3081e36 commit a371e31

File tree

51 files changed

+266
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+266
-206
lines changed

API.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,7 @@ public readonly evaluationPeriods: number;
22242224
```
22252225

22262226
- *Type:* number
2227-
- *Default:* {number} Same as datapointsToAlarm.
2227+
- *Default:* Same as datapointsToAlarm.
22282228

22292229
Number of periods to consider when checking the number of breaching datapoints.
22302230

@@ -2937,7 +2937,7 @@ public readonly evaluationPeriods: number;
29372937
```
29382938

29392939
- *Type:* number
2940-
- *Default:* {number} Same as datapointsToAlarm.
2940+
- *Default:* Same as datapointsToAlarm.
29412941

29422942
Number of periods to consider when checking the number of breaching datapoints.
29432943

@@ -20012,7 +20012,7 @@ const logMonitoringProps: LogMonitoringProps = { ... }
2001220012
| <code><a href="#cdk-monitoring-constructs.LogMonitoringProps.property.addToSummaryDashboard">addToSummaryDashboard</a></code> | <code>boolean</code> | Flag indicating if the widgets should be added to summary dashboard. |
2001320013
| <code><a href="#cdk-monitoring-constructs.LogMonitoringProps.property.useCreatedAlarms">useCreatedAlarms</a></code> | <code><a href="#cdk-monitoring-constructs.IAlarmConsumer">IAlarmConsumer</a></code> | Calls provided function to process all alarms created. |
2001420014
| <code><a href="#cdk-monitoring-constructs.LogMonitoringProps.property.logGroupName">logGroupName</a></code> | <code>string</code> | name of the log group to analyze for the given pattern. |
20015-
| <code><a href="#cdk-monitoring-constructs.LogMonitoringProps.property.pattern">pattern</a></code> | <code>string</code> | pattern to show, e.g. ERROR. |
20015+
| <code><a href="#cdk-monitoring-constructs.LogMonitoringProps.property.pattern">pattern</a></code> | <code>string</code> | pattern to show, e.g. "ERROR". |
2001620016
| <code><a href="#cdk-monitoring-constructs.LogMonitoringProps.property.limit">limit</a></code> | <code>number</code> | number of log messages to search for. |
2001720017
| <code><a href="#cdk-monitoring-constructs.LogMonitoringProps.property.title">title</a></code> | <code>string</code> | widget title. |
2001820018

@@ -20136,7 +20136,7 @@ public readonly pattern: string;
2013620136

2013720137
- *Type:* string
2013820138

20139-
pattern to show, e.g. ERROR.
20139+
pattern to show, e.g. "ERROR".
2014020140

2014120141
---
2014220142

README.md

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ In your `package.json`:
2828
"dependencies": {
2929
"cdk-monitoring-constructs": "^1.0.0",
3030

31-
// peer dependencies
31+
// peer dependencies of cdk-monitoring-constructs
3232
"@aws-cdk/aws-apigatewayv2-alpha": "^2.18.0-alpha.0",
3333
"@aws-cdk/aws-appsync-alpha": "^2.18.0-alpha.0",
3434
"@aws-cdk/aws-redshift-alpha": "^2.18.0-alpha.0",
3535
"@aws-cdk/aws-synthetics-alpha": "^2.18.0-alpha.0",
3636
"aws-cdk-lib": "^2.18.0",
3737
"constructs": "^10.0.5"
3838

39-
// (your other dependencies)
39+
// ...your other dependencies...
4040
}
4141
}
4242
```
@@ -66,12 +66,13 @@ You can also browse the documentation at https://constructs.dev/packages/cdk-mon
6666

6767
| Item | Monitoring | Alarms | Notes |
6868
| ---- | ---------- | ------ | ----- |
69-
| AWS API Gateway (REST API) (`.monitorApiGateway()`) | TPS, latency, errors | Latency, error count/rate | To see metrics, you have to enable Advanced Monitoring |
70-
| AWS API Gateway V2 (HTTP API) (`.monitorApiGatewayV2HttpApi()`) | TPS, latency, errors | Latency, error count/rate | To see route level metrics, you have to enable Advanced Monitoring |
69+
| AWS API Gateway (REST API) (`.monitorApiGateway()`) | TPS, latency, errors | Latency, error count/rate, low/high TPS | To see metrics, you have to enable Advanced Monitoring |
70+
| AWS API Gateway V2 (HTTP API) (`.monitorApiGatewayV2HttpApi()`) | TPS, latency, errors | Latency, error count/rate, low/high TPS | To see route level metrics, you have to enable Advanced Monitoring |
7171
| AWS AppSync (GraphQL API) (`.monitorAppSyncApi()`) | TPS, latency, errors | Latency, error count/rate, low/high TPS | |
7272
| AWS Billing (`.monitorBilling()`) | AWS account cost | | [Requires enabling](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/gs_monitor_estimated_charges_with_cloudwatch.html#gs_turning_on_billing_metrics) the **Receive Billing Alerts** option in AWS Console / Billing Preferences |
7373
| AWS Certificate Manager (`.monitorCertificate()`) | Certificate expiration | Days until expiration | |
7474
| AWS CloudFront (`.monitorCloudFrontDistribution()`) | TPS, traffic, latency, errors | Error rate, low/high TPS | |
75+
| AWS CloudWatch Logs (`.monitorLog()`) | Patterns present in the log group | | |
7576
| AWS CloudWatch Synthetics Canary (`.monitorSyntheticsCanary()`) | Latency, error count/rate | Error count/rate, latency | |
7677
| AWS CodeBuild (`.monitorCodeBuildProject()`) | Build counts (total, successful, failed), failed rate, duration | Failed build count/rate, duration | |
7778
| AWS DocumentDB (`.monitorDocumentDbCluster()`) | CPU, throttling, read/write latency, transactions, cursors | CPU | |
@@ -80,23 +81,22 @@ You can also browse the documentation at https://constructs.dev/packages/cdk-mon
8081
| AWS EC2 (`.monitorEC2Instances()`) | CPU, disk operations, network | | |
8182
| AWS EC2 Auto Scaling Groups (`.monitorAutoScalingGroup()`) | Group size, instance status | | |
8283
| AWS ECS (`.monitorFargateService()`, `.monitorEc2Service()`, `.monitorSimpleFargateService()`, `monitorSimpleEc2Service()`, `.monitorQueueProcessingFargateService()`, `.monitorQueueProcessingEc2Service()`) | System resources and task health | Unhealthy task count, running tasks count, CPU/memory usage, and bytes processed by load balancer (if any) | Use for ecs-patterns load balanced ec2/fargate constructs (NetworkLoadBalancedEc2Service, NetworkLoadBalancedFargateService, ApplicationLoadBalancedEc2Service, ApplicationLoadBalancedFargateService) |
83-
| AWS ElastiCache (`.monitorElastiCacheCluster()`) | CPU/memory usage, evictions and connections | | |
84-
| AWS Glue (`.monitorGlueJob()`) | Traffic, job status, memory/CPU usage | | |
85-
| AWS Kinesis Data Analytics (`.monitorKinesisDataAnalytics`) | Up/Downtime, CPU/memory usage, KPU usage, checkpoint metrics, and garbage collection metrics | Downtime | |
86-
| AWS Kinesis Data Stream (`.monitorKinesisDataStream()`) | Put/Get/Incoming Record/s and Throttling | Throttling, iterator max age | |
87-
| AWS Kinesis Firehose (`.monitorKinesisFirehose()`) | Number of records, requests, latency, throttling | | |
84+
| AWS ElastiCache (`.monitorElastiCacheCluster()`) | CPU/memory usage, evictions and connections | CPU, memory, items count | |
85+
| AWS Glue (`.monitorGlueJob()`) | Traffic, job status, memory/CPU usage | Failed/killed task count/rate | |
86+
| AWS Kinesis Data Analytics (`.monitorKinesisDataAnalytics`) | Up/Downtime, CPU/memory usage, KPU usage, checkpoint metrics, and garbage collection metrics | Downtime, full restart count | |
87+
| AWS Kinesis Data Stream (`.monitorKinesisDataStream()`) | Put/Get/Incoming Record/s and Throttling | Throttling, throughput, iterator max age | |
88+
| AWS Kinesis Firehose (`.monitorKinesisFirehose()`) | Number of records, requests, latency, throttling | Throttling | |
8889
| AWS Lambda (`.monitorLambdaFunction()`) | Latency, errors, iterator max age | Latency, errors, throttles, iterator max age | Optional Lambda Insights metrics (opt-in) support |
8990
| AWS Load Balancing (`.monitorNetworkLoadBalancer()`, `.monitorFargateApplicationLoadBalancer()`, `.monitorFargateNetworkLoadBalancer()`, `.monitorEc2ApplicationLoadBalancer()`, `.monitorEc2NetworkLoadBalancer()`) | System resources and task health | Unhealthy task count, running tasks count, (for Fargate/Ec2 apps) CPU/memory usage | Use for FargateService or Ec2Service backed by a NetworkLoadBalancer or ApplicationLoadBalancer |
90-
| AWS OpenSearch/Elasticsearch (`.monitorOpenSearchCluster()`, `.monitorElasticsearchCluster()`) | Indexing and search latency, disk/memory/CPU usage | Indexing and search latency, disk/memory/CPU usage, cluster status | |
91+
| AWS OpenSearch/Elasticsearch (`.monitorOpenSearchCluster()`, `.monitorElasticsearchCluster()`) | Indexing and search latency, disk/memory/CPU usage | Indexing and search latency, disk/memory/CPU usage, cluster status, KMS keys | |
9192
| AWS RDS (`.monitorRdsCluster()`) | Query duration, connections, latency, disk/CPU usage | Disk and CPU usage | |
9293
| AWS Redshift (`.monitorRedshiftCluster()`) | Query duration, connections, latency, disk/CPU usage | Disk and CPU usage | |
9394
| AWS S3 Bucket (`.monitorS3Bucket()`) | Bucket size and number of objects | | |
94-
| AWS SecretsManager (`.monitorSecretsManagerSecret()`) | Days since last rotation | Days since last rotation | |
95-
| AWS SNS Topic (`.monitorSnsTopic()`) | Message count, size, failed notifications | Failed notifications | |
95+
| AWS SecretsManager (`.monitorSecretsManagerSecret()`) | Days since last rotation | Days since last change or rotation | |
96+
| AWS SNS Topic (`.monitorSnsTopic()`) | Message count, size, failed notifications | Failed notifications, min/max published messages | |
9697
| AWS SQS Queue (`.monitorSqsQueue()`, `.monitorSqsQueueWithDlq()`) | Message count, age, size | Message count, age, DLQ incoming messages | |
9798
| AWS Step Functions (`.monitorStepFunction()`, `.monitorStepFunctionActivity()`, `monitorStepFunctionLambdaIntegration()`, `.monitorStepFunctionServiceIntegration()`) | Execution count and breakdown per state | Duration, failed, failed rate, aborted, throttled, timed out executions | |
9899
| AWS Web Application Firewall (`.monitorWebApplicationFirewallAcl()`) | Allowed/blocked requests | | |
99-
| CloudWatch Logs (`.monitorLog()`) | Patterns present in the log group | | |
100100
| Custom metrics (`.monitorCustom()`) | Addition of custom metrics into the dashboard (each group is a widget) | | Supports anomaly detection |
101101

102102

@@ -118,16 +118,19 @@ export class MonitoringStack extends DeploymentStack {
118118
super(parent, name, props);
119119

120120
const monitoring = new MonitoringFacade(this, "Monitoring", {
121-
// Define all necessary props
121+
// Defaults are provided for these, but they can be customized as desired
122+
metricFactoryDefaults: { ... },
123+
alarmFactoryDefaults: { ... },
124+
dashboardFactory: { ... },
122125
});
123126

124-
// Setup your monitoring
127+
// Monitor your resources
125128
monitoring
126129
.addLargeHeader("Storage")
127130
.monitorDynamoTable({ /* table1 */ })
128131
.monitorDynamoTable({ /* table2 */ })
129132
.monitorDynamoTable({ /* table3 */ })
130-
// ...and more
133+
// etc.
131134
}
132135
}
133136
```
@@ -181,7 +184,7 @@ The first two also support alarming.
181184

182185
Below we are listing a couple of examples. Let us assume that there are three existing metric variables: `m1`, `m2`, `m3`.
183186
They can either be created by hand (`new Metric({...})`) or (preferably) by using `metricFactory` (that can be obtained from facade).
184-
The advantage of using the shared `metricFactory` is that you do not need to worry about period, etc.
187+
The advantage of using the shared `metricFactory` is that you do not need to worry about period, etc.
185188

186189
```ts
187190
// create metrics manually
@@ -197,59 +200,58 @@ const m1 = metricFactory.createMetric(/* ... */);
197200

198201
#### Example: metric with anomaly detection
199202

200-
In this case, only one metric is supported.
203+
In this case, only one metric is supported.
201204
Multiple metrics cannot be rendered with anomaly detection in a single widget due to a CloudWatch limitation.
202205

203206
```ts
204207
monitorCustom({
205-
title: "Metric with anomaly detection",
206-
metrics: [
207-
{
208-
metric: m1,
209-
anomalyDetectionStandardDeviationToRender: 3
210-
}
211-
]
208+
title: "Metric with anomaly detection",
209+
metrics: [
210+
{
211+
metric: m1,
212+
anomalyDetectionStandardDeviationToRender: 3
213+
}
214+
]
212215
})
213216
```
214217

215218
Adding an alarm:
216219

217220
```ts
218221
monitorCustom({
219-
title: "Metric with anomaly detection and alarm",
220-
metrics: [
221-
{
222-
metric: m1,
223-
alarmFriendlyName: "MetricWithAnomalyDetectionAlarm",
224-
anomalyDetectionStandardDeviationToRender: 3,
225-
addAlarmOnAnomaly: {
226-
Warning: {
227-
standardDeviationForAlarm: 4,
228-
alarmWhenAboveTheBand: true,
229-
alarmWhenBelowTheBand: true
230-
}
231-
}
222+
title: "Metric with anomaly detection and alarm",
223+
metrics: [
224+
{
225+
metric: m1,
226+
alarmFriendlyName: "MetricWithAnomalyDetectionAlarm",
227+
anomalyDetectionStandardDeviationToRender: 3,
228+
addAlarmOnAnomaly: {
229+
Warning: {
230+
standardDeviationForAlarm: 4,
231+
alarmWhenAboveTheBand: true,
232+
alarmWhenBelowTheBand: true
232233
}
233-
]
234+
}
235+
}
236+
]
234237
})
235238
```
236239

237240
#### Example: search metrics
238241

239242
```ts
240243
monitorCustom({
241-
title: "Metric search",
242-
metrics: [
243-
{
244-
searchQuery: "My.Prefix.",
245-
dimensionsMap: {
246-
FirstDimension: "FirstDimensionValue",
247-
// allow any value for the given dimension
248-
// (pardon the weird typing due to JSII)
249-
SecondDimension: undefined as unknown as string
250-
}
251-
}
252-
]
244+
title: "Metric search",
245+
metrics: [
246+
{
247+
searchQuery: "My.Prefix.",
248+
dimensionsMap: {
249+
FirstDimension: "FirstDimensionValue",
250+
// Allow any value for the given dimension (pardon the weird typing to satisfy DimensionsMap)
251+
SecondDimension: undefined as unknown as string
252+
}
253+
}
254+
]
253255
})
254256
```
255257

@@ -287,7 +289,12 @@ monitoring.monitorScope(stack, {
287289
},
288290
},
289291
},
292+
293+
// Some resources that aren't dependent on nodes (e.g. general metrics across instances/account) may be included
294+
// by default, but can be explicitly disabled.
290295
billing: { enabled: false },
296+
ec2: { enabled: false },
297+
elasticCache: { enabled: false },
291298
});
292299
```
293300

0 commit comments

Comments
 (0)