Cloudwatch doesn't return values for some resource metrics if the resource was not used e.g. TargetResponseTime for AWS/ApplicationELB.
[ERROR] 2019-09-29T18:50:04.383Z ff7065bb-29de-4073-a4f1-0a48bb5d6ea1 Error retreiving CloudWatch statistics, no datapoints found:
=> Namespace: AWS/ApplicationELB
=> MetricName: TargetResponseTime
=> Dimensions: [{'Name': 'TargetGroup', 'Value': 'targetgroup/ac-re-Targe-13P06UAEX2W9Y/f9002d01ab9053e0'}]
=> Period: 60
=> Statistics: ['Average']
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 94, in lambda_handler
services = gather_services(cluster_name, cluster_def)
File "/var/task/ecsautoscale/services.py", line 248, in gather_services
max_tasks=service["max"]
File "/var/task/ecsautoscale/services.py", line 89, in __init__
res = source.get_data(**item)
File "/var/task/ecsautoscale/metric_sources/cloudwatch.py", line 76, in get_data
namespace, metric_name, dimensions_, period, statistics_)
ecsautoscale.exceptions.CloudWatchError: Error retreiving CloudWatch statistics, no datapoints found:
=> Namespace: AWS/ApplicationELB
=> MetricName: TargetResponseTime
=> Dimensions: [{'Name': 'TargetGroup', 'Value': 'targetgroup/ac-re-Targe-13P06UAEX2W9Y/f9002d01ab9053e0'}]
=> Period: 60
=> Statistics: ['Average']
Cloudwatch doesn't return values for some resource metrics if the resource was not used e.g. TargetResponseTime for AWS/ApplicationELB.
As a result, CloudWatchErrors are always thrown here if the resource is not used