@@ -16,8 +16,8 @@ module.exports = async (
16
16
* Validate parameters
17
17
*/
18
18
19
- rangeStart = rangeStart || moment ( ) . utc ( ) . toISOString ( )
20
- rangeEnd = rangeEnd || moment ( ) . utc ( ) . subtract ( 1 , 'days' ) . toISOString ( )
19
+ rangeStart = rangeStart || moment . utc ( ) . toISOString ( )
20
+ rangeEnd = rangeEnd || moment . utc ( ) . subtract ( 1 , 'days' ) . toISOString ( )
21
21
resources = resources || [ ]
22
22
23
23
// Ensure resources were submitted
@@ -142,8 +142,6 @@ module.exports = async (
142
142
throw new Error ( `Your AWS Cloudwatch query contains ${ cloudwatchMetricQueries . length } queries, but Cloudwatch can only support up to 500 queries.` )
143
143
}
144
144
145
- console . log ( cloudwatchMetricQueries )
146
-
147
145
// Prepare CloudWatch queries
148
146
const params = {
149
147
StartTime : rangeStart . unix ( ) ,
@@ -185,19 +183,19 @@ module.exports = async (
185
183
// Add data which Cloudwatch has returned by inspecting timestamps of CW's returned data
186
184
// If a timestamp exists that matches one of the defaults, add it in.
187
185
metric . xData . forEach ( ( xVal , i2 ) => {
188
- if ( moment ( xVal ) . isSame ( cwVal ) ) {
186
+ if ( moment . utc ( xVal ) . isSame ( cwVal ) ) {
189
187
metric . yDataSets [ 0 ] . yData [ i2 ] = cwMetric . Values [ i ] ;
190
188
}
191
189
} ) ;
190
+ } ) ;
192
191
193
- // Transform data
194
- Object . keys ( resourcesUsed ) . forEach ( ( resourceType ) => {
195
- metric = resourceHandlers [ resourceType ] . transforms ( cwMetric , metric )
196
- } )
192
+ // Transform data
193
+ Object . keys ( resourcesUsed ) . forEach ( ( resourceType ) => {
194
+ metric = resourceHandlers [ resourceType ] . transforms ( cwMetric , metric )
195
+ } )
197
196
198
- // Add to results
199
- result . metrics . push ( metric )
200
- } ) ;
197
+ // Add to results
198
+ result . metrics . push ( metric )
201
199
} )
202
200
203
201
return result ;
0 commit comments