0

I tried using the following code but it doesn't seem to be sending data to GCP Profiler

import * as profiler from "@google-cloud/profiler";

if (process.env.NODE_ENV === "production") {
   profiler.start();
}

...

I just see this screen when I visit the profiler: enter image description here

I read here that it supports:

Supported environments:

  • Compute Engine
  • Google Kubernetes Engine (GKE)
  • App Engine flexible environment
  • App Engine standard environment
  • Outside of Google Cloud (For information on the additional configuration requirements, see Profiling applications running outside of Google Cloud.)

Do I need to do additional configuration to use Google Cloud Profiler on Google Cloud Run?

Dev01
  • 13,292
  • 19
  • 70
  • 124
  • 1
    Bump the [log-level](https://cloud.google.com/nodejs/docs/reference/profiler/latest#changing-log-level) and see what you get. Profiling does work with Cloud Run even though it's not documented. There are some limitations due to the Cloud Run runtime. Ensure the Service Account that you're using has suitable permissions see [roles](https://cloud.google.com/profiler/docs/iam#roles). I have it profiling several Golang services. – DazWilkin Jun 24 '22 at 03:45
  • Have you tried [these instructions](https://blog.truaro.dev/developer-tools-for-cloud-run/#cloud-profiler) adapting them to [node.js](https://cloud.google.com/profiler/docs/profiling-nodejs#gke)? As it says, profiling an application requires the installation of the Profiler Agent in the OCI image deployed on Cloud Run. Then, when running your Cloud Run service, you need to provide environment variables to complete the Profiler agent setup. – Osvaldo Jun 24 '22 at 21:37

0 Answers0