This repository was archived by the owner on Dec 1, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export default class CapacityCalculator extends CapacityCalculatorBase {
30
30
// Default algorithm for projecting a good value for the current ConsumedThroughput is:
31
31
// 1. Query 5 average readings each spanning a minute
32
32
// 2. Select the Max value from those 5 readings
33
- let averages = data . Datapoints . map ( dp => dp . Average ) ;
33
+ let averages = data . Datapoints . map ( dp => dp . Sum / data . period ) ;
34
34
return Math . max ( ...averages ) ;
35
35
}
36
36
}
Original file line number Diff line number Diff line change @@ -103,25 +103,27 @@ export default class CapacityCalculatorBase {
103
103
// These values determine how many minutes worth of metrics
104
104
let statisticCount = 5 ;
105
105
let statisticSpanMinutes = 1 ;
106
- let statisticType = 'Average ' ;
106
+ let statisticType = 'Sum ' ;
107
107
108
108
let EndTime = new Date ( ) ;
109
109
let StartTime = new Date ( ) ;
110
110
StartTime . setTime ( EndTime - ( 60000 * statisticSpanMinutes * statisticCount ) ) ;
111
111
let MetricName = isRead ? 'ConsumedReadCapacityUnits' : 'ConsumedWriteCapacityUnits' ;
112
112
let Dimensions = this . getDimensions ( tableName , globalSecondaryIndexName ) ;
113
+ let period = ( statisticSpanMinutes * 60 ) ;
113
114
let params = {
114
115
Namespace : 'AWS/DynamoDB' ,
115
116
MetricName,
116
117
Dimensions,
117
118
StartTime,
118
119
EndTime,
119
- Period : ( statisticSpanMinutes * 60 ) ,
120
+ Period : period ,
120
121
Statistics : [ statisticType ] ,
121
122
Unit : 'Count'
122
123
} ;
123
124
124
125
let statistics = await this . cw . getMetricStatisticsAsync ( params ) ;
126
+ statistics . period = period ;
125
127
let value = this . getProjectedValue ( statistics ) ;
126
128
let result : ConsumedCapacityDesc = {
127
129
tableName,
You can’t perform that action at this time.
0 commit comments