public async Task EnsureWriteCapacityAlarm(TableDescription table, string alarmNameSuffix, double thresholdFraction, string snsTopicArn, bool dryRun) { var alarmName = GetAlarmName(table, AwsMetrics.ConsumedWriteCapacity, alarmNameSuffix); var thresholdInUnits = AlarmThresholds.Calulate(table.ProvisionedThroughput.WriteCapacityUnits, thresholdFraction); await CheckTableAlarm(alarmName, table.TableName, AwsMetrics.ConsumedWriteCapacity, thresholdInUnits, AwsConstants.FiveMinutesInSeconds, snsTopicArn, dryRun); }
public async Task EnsureReadCapacityAlarm(TableDescription table, GlobalSecondaryIndexDescription index, string alarmNameSuffix, double thresholdFraction, string snsTopicArn, bool dryRun) { var alarmName = GetAlarmName(table, index, AwsMetrics.ConsumedReadCapacity, alarmNameSuffix); var thresholdInUnits = AlarmThresholds.Calulate(index.ProvisionedThroughput.ReadCapacityUnits, thresholdFraction); await CheckIndexAlarm(alarmName, table.TableName, index.IndexName, AwsMetrics.ConsumedReadCapacity, thresholdInUnits, AwsConstants.FiveMinutesInSeconds, snsTopicArn, dryRun); }
public async Task CorrectAlarmsAreCreatedForEachTable() { var mockery = new DynamoAlarmGeneratorMockery(); var generator = mockery.AlarmGenerator; ConfigureTables(mockery); await generator.GenerateAlarmsFor(ConfigWithThresholds(), RunMode.GenerateAlarms); var expectedTable1ReadThreshold = (int)AlarmThresholds.Calulate(ReadCapacity, 0.4); var expectedTable1WriteThreshold = (int)AlarmThresholds.Calulate(WriteCapacity, 0.4); CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch, alarmName: "test1-ConsumedReadCapacityUnits-TestGroup", tableName: "test1", metricName: "ConsumedReadCapacityUnits", threshold: expectedTable1ReadThreshold, period: 300); CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch, alarmName: "test1-ConsumedWriteCapacityUnits-TestGroup", tableName: "test1", metricName: "ConsumedWriteCapacityUnits", threshold: expectedTable1WriteThreshold, period: 300); var expectedTable2ReadThreshold = (int)AlarmThresholds.Calulate(ReadCapacity, 0.65); var expectedTable2WriteThreshold = (int)AlarmThresholds.Calulate(WriteCapacity, 0.65); CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch, alarmName: "test2-ConsumedReadCapacityUnits-TestGroup", tableName: "test2", metricName: "ConsumedReadCapacityUnits", threshold: expectedTable2ReadThreshold, period: 300); CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch, alarmName: "test2-ConsumedWriteCapacityUnits-TestGroup", tableName: "test2", metricName: "ConsumedWriteCapacityUnits", threshold: expectedTable2WriteThreshold, period: 300); }