in src/dynamodb.ts [63:85]
private createWidgetsForProvisionedTable(title: string,
table: dynamodb.Table,
readCapacityThresholdPercent?: number,
writeCapacityThresholdPercent?: number) {
const cfnTable = table.node.defaultChild as dynamodb.CfnTable;
const metrics = this.metrics.metricConsumedCapacityUnits(table.tableName);
const readCapacityMetric = metrics.read;
const writeCapacityMetric = metrics.write;
const throughput = cfnTable.provisionedThroughput as dynamodb.CfnTable.ProvisionedThroughputProperty;
this.watchful.addAlarm(this.createDynamoCapacityAlarm('read', readCapacityMetric, throughput.readCapacityUnits, readCapacityThresholdPercent));
this.watchful.addAlarm(this.createDynamoCapacityAlarm('write', writeCapacityMetric, throughput.writeCapacityUnits, writeCapacityThresholdPercent));
this.watchful.addSection(title, {
links: [{ title: 'Amazon DynamoDB Console', url: linkForDynamoTable(table) }],
});
this.watchful.addWidgets(
this.createDynamoCapacityGraph('Read', readCapacityMetric, throughput.readCapacityUnits, readCapacityThresholdPercent),
this.createDynamoCapacityGraph('Write', writeCapacityMetric, throughput.writeCapacityUnits, writeCapacityThresholdPercent),
);
}