Cloud Run and Cloud Run on GKE are automatically integrated with Stackdriver Monitoring with no setup or configuration required. This means that metrics of your Cloud Run or Cloud Run on GKE services are captured automatically when they are running. You do have to add your project to a workspace to see the metrics in Stackdriver Monitoring.
The resource names you use differ for Cloud Run and Cloud Run on GKE:
For Cloud Run the monitoring resource name is Cloud Run Revision.
For Cloud Run on GKE the monitoring resource names are Kubernetes Container .
Adding your project to a Stackdriver Monitoring workspace
Stackdriver Monitoring is automatically available to all Cloud Run projects. However, in order to access the metrics, you must add your project to a workspace. For more information on workspaces, see Stackdriver Monitoring workspaces. For pricing information, see Stackdriver pricing.
Viewing Cloud Run metrics in Stackdriver Monitoring
For complete information on metrics in Stackdriver Monitoring, see Metrics, Time Series, and Resources.
To access metrics for your project:
Make sure you have already added your project to a workspace.
Visit the Stackdriver Monitoring Metrics Explorer page in your project:
If you are using Cloud Run, locate the Find resource type and metric, textbox and enter
Cloud Run Revision, then select one of the metrics in the dropdown list:
Cloud Run Revision metrics Description Container CPU usage The total CPU usage of running container instances, in seconds. Measures usage only when the container image is actively processing requests. Container memory allocation The total memory allocation of running container instances, in Gigabytes-seconds. Measures usage only when the container image is actively processing requests. Request Count The number of service requests. Request Latencies Distribution of service request times in milliseconds.
If you are using Cloud Run on GKE, locate the Find resource type and metric, textbox and enter
Kubernetes Container, then select one of the metrics in the dropdown list:
Kubernetes Container metrics Description CPU limit utilization The fraction of the CPU limit that is currently in use on the instance. This value cannot exceed 1 as usage cannot exceed the limit. CPU request utilization The fraction of the requested CPU that is currently in use on the instance. This value can be greater than 1 as usage can exceed the request. CPU usage time Cumulative CPU usage on all cores used by the container in seconds. Server request count Number of requests received by the service. Server response latencies Distribution of service response latency for incoming requests.
You can use the following filters and groupings:
- Group by revision
- Group by revision and latency
- Filter by knative service, then group by service revision
Adding Uptime checks
You can use Stackdriver Monitoring to keep track of your services' performance. For more information, see Verify availability of your service (uptime checks).
You can use Stackdriver Monitoring to send notification about certain events, such as uptime check failures. For more information, see Create and manage alerting policies for your service.