Cloud Profiler on Cloud Run
edriang opened this issue · 2 comments
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Hi there! I wanted to check how can I have Cloud Profiler running with my Cloud Run instances.
I've followed the steps to integrate, but I'm getting the following error (seeing this in Cloud Logger):
Failed to fetch name from metadata: Error: Unsuccessful response status code. Request failed with status code 404
I also tried to follow the steps outlined here; I've provided the projectId
and credentials
field, but the result is the same.
For the credentials, I've created a Service Account, and assigned the Cloud Profiler Agent
and Cloud Profiler User
roles.
I couldn't find any guide or example to integrate Cloud Profiler with Cloud Run, but I would imagine it is certainly possible (or at least it should following the "run elsewhere" steps).
Any idea about this? What else should I try? Thanks in advance
Failed to fetch name from metadata: Error: Unsuccessful response status code. Request failed with status code 404
Sounds like the profiler is trying to query a metadata server but it doesn't exist in Cloud Run. Try setting these fields in the config to avoid hitting the metadata server:
cloud-profiler-nodejs/src/index.ts
Line 129 in f0ef650
That said, YMMV with Cloud Run as its not officially supported. You may need to turn on always on cpu allocation but I'm really not sure. Hope that helps.
FWIW, I'm able see profiles in GCP with with a nodejs web server running in Cloud Run without issues. I just set it up yesterday.
- nodejs version: 18
- @google-cloud/profiler version: 5.0.3
- snippet
require('@google-cloud/profiler')
.start({
serviceContext: {
service: 'my-service',
version: '1.0.0',
},
})