Google app engine python 3.7 | Google应用程序引擎的运行时实用程序API替代方案
我正在将我现有的py 2.7回购迁移到目前正在谷歌应用程序引擎上工作的py 3.7 我发现在项目中广泛使用的库(运行时实用程序API)Google app engine python 3.7 | Google应用程序引擎的运行时实用程序API替代方案,google-app-engine,python-3.7,Google App Engine,Python 3.7,我正在将我现有的py 2.7回购迁移到目前正在谷歌应用程序引擎上工作的py 3.7 我发现在项目中广泛使用的库(运行时实用程序API) from google.appengine.api.runtime import runtime import logging logging.info(runtime.memory_usage()) 这将输出内存使用统计信息,其中数字以MB表示。例如: current: 464.0859375 average1m: 464 average10m: 379.
from google.appengine.api.runtime import runtime
import logging
logging.info(runtime.memory_usage())
这将输出内存使用统计信息,其中数字以MB表示。例如:
current: 464.0859375
average1m: 464
average10m: 379.575
我试图找到与Python3.7兼容的替代库,但没有从GAE中找到。谁能帮我一下吗。
谷歌方面是否有我不知道的替代品?不幸的是,
Google.appengine.api.runtime.runtime
模块从1.8.1版开始
我也找不到任何类似或等效的Python3官方应用程序引擎API
作为替代方案,您可以尝试仅在代码中实现这些功能。例如,看看的答案,它与如何使用Python获取RAM和CPU统计数据有关。其中一些包括使用
您也可以考虑使用A,它可以将页面上列出的度量类型的数据发送给StAcKDever;例如CPU(负载、使用率等)、磁盘(使用的字节数、io_时间等)和其他指标。
以下内容获得的内存使用率值与仪表板显示的值完全相同:def current():
vm = psutil.virtual_memory()
return (vm.active + vm.inactive + vm.buffers) / 1024 ** 2
如果希望将转换成本降至最低,则可以将以下内容放入新模块中,并导入,而不是Google原始界面:
import psutil
class MemoryUsage:
def __init__(self):
pass
@staticmethod
def current():
vm = psutil.virtual_memory()
return (vm.active + vm.inactive + vm.buffers) / 1024 ** 2
def memory_usage():
return MemoryUsage()