Search code examples
google-cloud-platformgoogle-cloud-functionscloudserverless-frameworkstackdriver

Google Cloud Function memory consumption logging


I need to export a CSV with the information about:

  • Function name
  • Timestamp
  • Execution duration
  • Memory consumption
  • Memory limit

To do that, I assumed I could just export function logs and I'm able to access execution logs through Stackdriver.

However, I'm not able to find any information within those logs on memory consumption (something that AWS and Azure do by default).

How can I access this information? Is there maybe any other approach to it?

I'm fine with doing some manual work to do this, I just cannot find any place where it shows how much memory was used by the execution.


Solution

  • It's not possible to have this information. It's not logged.

    However, you can have inputs from stackdriver, with a request like that

    https://monitoring.googleapis.com/v3/projects/<PROJECT_ID>/timeSeries?filter=metric.type+%3D+%22cloudfunctions.googleapis.com%2Ffunction%2Fuser_memory_bytes%22&interval.endTime=2019-09-02T14%3A30%3A00Z&interval.startTime=2019-09-02T10%3A30%3A00Z
    

    However it's not per request, it's per time slot. Not really match your wish. It's not possible to do more.