gcp:datastore - 使用 Python API 获取整体状态 __Stat_Total__

gcp:datastore - get overall status __Stat_Total__ using Python API

我想获取仪表板应用程序的总体数据存储统计信息。我浏览了文档,没有关于如何使用数据存储获取统计信息的教程。以某种方式获取状态详细信息有 GQL Query
SELECT * FROM __Stat_Total__ 显示
builtin_index_bytes, builtin_index_count, bytes, composite_index_bytes, composite_index_count, count, entity_bytes, timestamp.
我想通过 Python API 客户端显示所有这些详细信息。

我尝试了几个没有成功的例子。

def get_summary_statistics(self):
        #[START getting the Summary Statistics]
        stats = self.client.query(kind= self.kind_name)
        overall_stats = stats.__Stat_Total__ ()

        return overall_stats

如何获取所有数据存储统计信息?

Cloud Datastore NDB administration documentation 包含一些关于 __Stat_Total__ 和其他统计实体的信息,以及一个查询数据存储区统计信息的小示例脚本:

from google.appengine.ext.ndb import stats

global_stat = stats.GlobalStat.query().get()
print 'Total bytes stored: %d' % global_stat.bytes
print 'Total entities stored: %d' % global_stat.count