question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(apigateway): get metrics from a resource

See original GitHub issue

With API GW CDK it is possible today to easily get metrics at the RestAPI level like this:

RestApi restApi = new RestApi(...);
...
restApi.metricLatency();
restApi.metricServerError();
restApi.metricCount();

This is super useful. These metrics are provided by default with API GW. It is possible to get metrics at the resource level if you enable advanced Cloudwatch Metrics on the API. It would be great if we could have similar methods at the Resource level.

Use Case

If an organization uses one API Gateway RestApi with many resources in it each linked to a unique integrations then the API level metrics are not very useful. When the metrics present a problem then it is unclear which specific resource/integration is the cause of it. Being able to easily get these metrics at the resource level would resolve this.

Proposed Solution

IResource resource = new Resource(..);
...
resource.metricLatency();
resource.metricServerError();
resource.metricCount();

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
humanzzcommented, Nov 9, 2021

This is something I’ve also been looking for. Just adding to @nija-at’s comment, the dimensions for this sort of metric also include Method so in total they are ApiName, Method, Resource, Stage which might mean the method needs to be passed in as well.

1reaction
nija-atcommented, Oct 15, 2021

Ok. I’m adding this to our backlog.

I’m marking this as p2 which means we are unable to get to this right away. Happy to accept pull requests if you would like this feature in earlier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon API Gateway dimensions and metrics
API Gateway metrics ; Count. The total number API requests in a given period. The SampleCount statistic represents this metric. Unit: Count ;...
Read more >
Top 4 must-monitor API Gateway metrics - Blue Matador
API Gateway counts the number of requests made to your API and displays the metric in CloudWatch. This metric is the count of...
Read more >
View API Gateway metrics in the CloudWatch console
In the All metrics tab, choose API Gateway. To view metrics by stage, choose the By Stage panel. And then select desired APIs...
Read more >
Amazon API Gateway Monitoring Integration - Site24x7
API Gateway automatically exposes metrics to CloudWatch on the API and stage-level. To monitor API calls, latency, integration latency, 400 and 500 errors...
Read more >
Amazon API Gateway monitoring integration
The time in milliseconds between when API Gateway receives a request from a client and when it returns a response to the client....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found