You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -104,17 +99,21 @@ You can browse the documentation at https://constructs.dev/packages/cdk-monitori
104
99
105
100
## Getting started
106
101
107
-
### Create monitoring stack and facade
102
+
### Create a facade
108
103
109
104
_Important note_: **Please, do NOT import anything from the `/dist/lib` package.** This is unsupported and might break any time.
110
105
111
-
Create an instance of `MonitoringFacade`, which is the main entry point:
106
+
1. Create an instance of `MonitoringFacade`, which is the main entrypoint.
107
+
1. Call methods on the facade like `.monitorLambdaFunction()` and chain them together to define your monitors. You can also use methods to add your own widgets, headers of various sizes, and more.
108
+
109
+
For examples of monitoring different resources, refer to [the unit tests](https://github.com/cdklabs/cdk-monitoring-constructs/tree/main/test/monitoring).
@@ -129,21 +128,15 @@ export class MonitoringStack extends DeploymentStack {
129
128
// Monitor your resources
130
129
monitoring
131
130
.addLargeHeader("Storage")
132
-
.monitorDynamoTable({ /* table1 */ })
133
-
.monitorDynamoTable({ /* table2 */ })
134
-
.monitorDynamoTable({ /* table3 */ })
135
-
// etc.
131
+
.monitorDynamoTable({ /* Monitor a DynamoDB table */ })
132
+
.monitorDynamoTable({ /* and a different table */ })
133
+
.monitorLambdaFunction({ /* and a Lambda function */ })
134
+
.monitorCustom({ /* and some arbitrary metrics in CloudWatch */ })
135
+
// ... etc.
136
136
}
137
137
}
138
138
```
139
139
140
-
### Set up your monitoring
141
-
142
-
Once the facade is created, you can use it to call methods like `.monitorLambdaFunction()` and chain them together to define your monitors.
143
-
144
-
You can also use facade methods to add your own widgets, headers of various sizes, and more.
145
-
146
-
147
140
### Customize actions
148
141
149
142
Alarms should have an action setup, otherwise they are not very useful. Currently, we support notifying an SNS queue.
@@ -257,33 +250,28 @@ monitorCustom({
257
250
})
258
251
```
259
252
260
-
Search metric does not support setting an alarm, that is a CloudWatch limitation.
253
+
Search metrics do not support setting an alarm, which is a CloudWatch limitation.
261
254
262
-
### Custom monitoring segment
255
+
### Custom monitoring segments
263
256
264
-
If you want even more flexibility, you can create your own Dashboard Segment.
257
+
If you want even more flexibility, you can create your own segment.
265
258
266
259
This is a general procedure on how to do it:
267
260
268
261
1. Extend the `Monitoring` class
269
262
1. Override the `widgets()` method (and/or similar ones)
270
-
1. Leverage the metric factor and alarm factory, provided by the base class (you can create additional factories, if you will)
263
+
1. Leverage the metric factory and alarm factory provided by the base class (you can create additional factories, if you will)
271
264
1. Add all alarms to `.addAlarm()` so they are visible to the user and being placed on the alarm summary dashboard
272
265
273
-
Both of these monitoring base classes are dashboard segments, so you can add them to your monitoring by calling `.addSegment()`.
274
-
275
-
### Monitoring Scopes
276
-
277
-
With CDK Monitoring Constructs, you can monitor complete CDK construct scopes. It will automatically discover all monitorable resources within the scope (recursively)) and add them to your dashboard.
266
+
Both of these monitoring base classes are dashboard segments, so you can add them to your monitoring by calling `.addSegment()` on the `MonitoringFacade`.
278
267
279
-
```ts
280
-
monitoring.monitorScope(stack);
281
-
```
268
+
### Monitoring scopes
282
269
283
-
You can also specify default alarms for any specific resource and disable automatic monitoring for it as well.
270
+
You can monitor complete CDK construct scopes using an aspect. It will automatically discover all monitorable resources within the scope recursively and add them to your dashboard.
0 commit comments