ASFHyP3 / hyp3

A processing environment for HyP3 Plugins in AWS.
BSD 3-Clause "New" or "Revised" License
36 stars 8 forks source link

Cloudwatch alarm for 5xx API responses doesn't work #2044

Open asjohnston-asf opened 7 months ago

asjohnston-asf commented 7 months ago

Our API alarm specifies ApiId, but the cloudwatch docs suggest the correct dimension is ApiName. The metric is 5xx, but should be 5XXError.

https://github.com/ASFHyP3/hyp3/blob/develop/apps/monitoring-cf.yml.j2#L34

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html

The alarm is created, but the metric always reports as No Data even when there are 5xx responses, so the alarm never triggers and no SNS message is ever sent.

asjohnston-asf commented 6 months ago

This issue was introduced in v2.11.0 when the API Gateway was converted from a HTTP API to a REST API. The CloudWatch metric and dimension names differ between the two types of APIs:

asjohnston-asf commented 6 months ago

Unfortunately, there is no straightforward way to retrieve the auto-generated API name for use by the CloudWatch Alarm. I've opened https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/1918 requesting that feature.