By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Insufficient data for API GW metric

0

Hello,

Could you please specify why an alarm for an API Gateway, default stage, that has Detailed route metrics enabled in Monitor->Metrics section, has the message: Insufficient data for several days ? The API GW has a Lambda integration that sometimes returns a 4xx code that should be counted by the metric.

Thank you,
Mihai ADAM

1 Answer
0
Accepted Answer

There are a few potential reasons why you might be seeing "Insufficient data" for your API Gateway metric alarm, even with detailed route metrics enabled:

  1. Low traffic volume: If your API is not receiving enough requests to generate meaningful metric data, CloudWatch may report "Insufficient data". This is especially true for specific error codes like 4xx that may occur infrequently.

  2. Metric data delay: There can sometimes be a delay in CloudWatch receiving and processing metric data from API Gateway. This delay is usually short, but in some cases, it could extend to several hours.

  3. Metric filtering: Ensure that you're looking at the correct metric for your specific API, stage, and method. The dimensions you use to filter the metrics (such as ApiId, Stage, Method, and Resource) must match your API configuration exactly.

  4. Metric generation limitations: API Gateway might not generate logs and metrics in certain cases, including some 400 series errors. For example, if the 4xx errors are coming from requests sent to a custom domain that has no API mapping, these might not be logged.

  5. CloudWatch configuration: Verify that detailed CloudWatch metrics are indeed enabled for your API stage. You can do this by checking the detailedMetricsEnabled property in the stage settings.

To troubleshoot this issue:

  1. Confirm that your API is receiving traffic and generating the expected 4xx responses.
  2. Double-check your alarm configuration to ensure it's set up correctly for your specific API and stage.
  3. Verify in the API Gateway console that detailed metrics are enabled for your stage.
  4. Try viewing the raw metric data in the CloudWatch console to see if data is being recorded but not triggering the alarm.
  5. If the issue persists, you may want to enable CloudWatch Logs for your API to get more detailed information about the requests and responses.

If after these steps you're still not seeing the expected metric data, you may need to contact AWS support for further assistance.
Sources
Monitor CloudWatch metrics for HTTP APIs in API Gateway - Amazon API Gateway
Monitor HTTP APIs in API Gateway - Amazon API Gateway
Monitoring tools in AWS for API Gateway - Amazon API Gateway

profile picture
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • Thank you for the response,
    I've noticed the issue from troubleshoot: 4.Try viewing the raw metric data in the CloudWatch console to see if data is being recorded but not triggering the alarm.
    The alarm was built using the metric: API Gateway - API Name - 4xxError. I've just re-created the alarm with the metric: API Gateway - API Id - 4xx , an now it works.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions