Search code examples
google-app-enginepython-3.7

Runtime Utilities API alternative for python 3.7 | Google App Engine


I'm migrating my py 2.7 existing repo to py 3.7 currently working on Google App Engine.

I found that a runtime library (Runtime Utilities API) which is extensively used in the project.

from google.appengine.api.runtime import runtime
import logging

logging.info(runtime.memory_usage())

This will output memory usage statistics, where the numbers are expressed in MB. For example:

current: 464.0859375
average1m: 464
average10m: 379.575

I'm trying to find its alternative library compatible with python 3.7 but don't found any from GAE. Can somebody please help with this. Is there any replacement from the Google side which I'm not aware of?


Solution

  • Unfortunately, the google.appengine.api.runtime.runtime module is deprecated since the version 1.8.1.

    I also couldn't find any similar or equivalent official App Engine API for Python3.

    As an alternative, you can try to implement these feature merely within your code. For instance, look at the answers of this question, which is relate on how to Get RAM & CPU stats with Python. Some of them include the use of the psutil library.

    You can also consider to use a StackDriver Agent, that can transmit data for the metric types listed on this page to Stackdriver; such as CPU (load, usage, etc), Disk (bytes used, io_time, etc) and other metrics.