Ruff format
This commit is contained in:
parent
a0edf5d9e9
commit
7c24308039
1 changed files with 13 additions and 6 deletions
|
@ -29,10 +29,10 @@ for page in paginator.paginate(Namespace="AWS/Logs", MetricName="IncomingBytes")
|
|||
"Metric": {
|
||||
"Namespace": metric["Namespace"],
|
||||
"MetricName": metric["MetricName"],
|
||||
"Dimensions": metric["Dimensions"]
|
||||
"Dimensions": metric["Dimensions"],
|
||||
},
|
||||
"Period": int(period.total_seconds()),
|
||||
"Stat": "Sum"
|
||||
"Stat": "Sum",
|
||||
},
|
||||
}
|
||||
if not metric["Dimensions"]:
|
||||
|
@ -47,10 +47,17 @@ for page in paginator.paginate(Namespace="AWS/Logs", MetricName="IncomingBytes")
|
|||
# otherwise we would have to chunk up the calls to GetMetricData.
|
||||
results = []
|
||||
data_paginator = cw.get_paginator("get_metric_data")
|
||||
for data_page in data_paginator.paginate(MetricDataQueries=queries, StartTime=start_time, EndTime=end_time):
|
||||
for data_page in data_paginator.paginate(
|
||||
MetricDataQueries=queries, StartTime=start_time, EndTime=end_time
|
||||
):
|
||||
for result in data_page["MetricDataResults"]:
|
||||
if result["Values"]:
|
||||
results.append({"LogGroup": query_names[result["Id"]], "IncomingBytes": result["Values"][0]})
|
||||
results.append(
|
||||
{
|
||||
"LogGroup": query_names[result["Id"]],
|
||||
"IncomingBytes": result["Values"][0],
|
||||
}
|
||||
)
|
||||
|
||||
results.sort(key=lambda x: x["IncomingBytes"], reverse=True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue