2

I have REST API running on GCP Cloud Run. I would like to monitor latency / response time, grouped per path (URI), so that I can spot paths that have bad response times.

For instance, let say I have 3 paths, I would like to see some metrics like:

  • /v1/users → percentile 50%: 500 ms, percentile 95%: 2400 ms
  • /v1/book → percentile 50%: 240 ms, percentile 95%: 1003 ms
  • /v1/readlists → percentile 50%: 10 ms, percentile 95%: 13 ms

I tried creating some kind of visualization with Monitoring and Trace, but failed to filter (so that I see only /v1 URIs) and group (by path). The best I have so far is a report on Trace that show me these metrics for /v1. I could theoretically create one report per endpoint, but that looks cumbersome and I am certain I can do the grouping on 1 visualization.

I am a beginner on monitoring on GCP, is it possible to do this?

Edit for clarification: I would like to do it using Monitoring (so that I can see it on my dashboard) or another product. But I would like to avoid modifying the application code (such as with Cloud Endpoint). I know the metrics I want are already available, because I can generate a Trace report for each endpoint. I am just missing a way to display that data in a single place, without having to manually specify each endpoint.

Bastien
  • 694
  • 5
  • 19
  • What GCP products are you willing to use? Currently you only mention Cloud Monitoring and Cloud Trace, but there are other products like Cloud Endpoints which offer this functionality. Please clarify if you are looking for a solution with Cloud Monitoring only. – nareddyt Apr 17 '23 at 03:30

1 Answers1

1

One option is to configure Cloud Endpoints for your API. It will automatically report request counts, payload sizes, and latencies to Cloud Monitoring per method (method in the docs means HTTP method + HTTP path combination). That should fit your needs.

Directly using Cloud Trace and Cloud Monitoring should also work fine.

but failed to filter (so that I see only /v1 URIs) and group (by path)

You only need to filter by the full path. For Cloud Trace, this would look something like +url:/v1/users. A plain old filter should work fine as long as you don't have IDs in the paths.

Ref: https://cloud.google.com/trace/docs/trace-filters#filter_syntax

nareddyt
  • 1,016
  • 10
  • 20