Skip to content

Commit

Permalink
gcp - metrics - fix start/end time now need to end with Z (cloud-cust…
Browse files Browse the repository at this point in the history
  • Loading branch information
kentnsw authored Aug 10, 2022
1 parent 97142af commit 4f6b221
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/c7n_gcp/c7n_gcp/filters/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def process(self, resources, event=None):
self.reducer = self.data.get('reducer', 'REDUCE_NONE')
self.group_by_fields = self.data.get('group-by-fields', [])
self.missing_value = self.data.get('missing-value')
self.end = datetime.utcnow()
self.end = datetime.utcnow().replace(microsecond=0)
self.start = self.end - duration
self.period = str((self.end - self.start).total_seconds()) + 's'
self.resource_metric_dict = {}
Expand All @@ -128,8 +128,8 @@ def process(self, resources, event=None):
for batched_filter in self.get_batched_query_filter(resources):
query_params = {
'filter': batched_filter,
'interval_startTime': self.start.isoformat(),
'interval_endTime': self.end.isoformat(),
'interval_startTime': self.start.isoformat() + 'Z',
'interval_endTime': self.end.isoformat() + 'Z',
'aggregation_alignmentPeriod': self.period,
"aggregation_perSeriesAligner": self.aligner,
"aggregation_crossSeriesReducer": self.reducer,
Expand Down

0 comments on commit 4f6b221

Please sign in to comment.