1 Answer
- Newest
- Most votes
- Most comments
0
API Gateway only enables Metrics when the 'MetricsEnabled' value is set to true for 'StageDescription' [1] on the API Gateway Stage level. If this value is diabled API Gateway will not send these metrics unless you have explicitly enabled detailed CloudWatch metrics [2] on the stage level. The 'MethodSetting' only works when the stage level metrics has been enabled, method level metrics allows you to be able to filter these metrics on cloudwatch. The 'MethodSettings' property of the Amazon API Gateway Deployment StageDescription property type contains a list of MethodSetting property types [3].
Enable stage metrics on the cloudformation stack and test if this works, eg:
StageDescription:
Description: API details
LoggingLevel: INFO
MetricsEnabled: True
MethodSettings:
- ResourcePath: "/test"
HttpMethod: "POST"
LoggingLevel: INFO
MetricsEnabled: True
References:
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-deployment-stagedescription.html
- https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-deployment-methodsetting.html
answered 9 months ago
Relevant content
- asked 7 months ago
- asked 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 8 months ago
Thanks for the reply. We created the API gateway using the following CloudFormation AWS::Serverless::Api template [1], where we configured the MethodSetting [2] to enable metrics for all resource paths and changed the API gateway name so that it does not match other API gateways with the same name.
Type: AWS::Serverless::Api Properties: Name: OtherName MethodSettings: - MetricsEnabled: true HttpMethod: ' * ' ResourcePath: ' /* '
After several requests to the API, no metrics were generated in CloudWatch for this API gateway.
References: