Reputation: 47
I am trying to get the list of models in decreasing order of most frequently read models. This is what I have tried so far.This client query set gives the details of models and their attributes/properties, with these model related details : Entity count, Built-in index count, Built-in index size, Data size, Composite index size, Composite index count. But there is no detail about read frequencies
from google.cloud import datastore
import math
def run_quickstart():
# [START datastore_quickstart]
# Imports the Google Cloud client library
client = datastore.Client()
query = client.query(kind='__Stat_Kind__')
detail_list = []
items = list(query.fetch())
for results in items:
results = results.viewitems()
detail_list.append(results)
print detail_list
if __name__ == '__main__':
run_quickstart()
Does GAE Cloud Datastore provide any such information of database read frequencies?
Upvotes: 2
Views: 49
Reputation: 39834
No, no datastore read frequency stats are being (presently at least) maintained. Check the Datastore Statistics article to see the complete list of stats available.
A similar question was posted not long ago for the write stats: GAE Cloud Datastore: Get most frequently written models. Similarly to that answer you could build a scheme to keep read stats yourself. You might find the PreGet hook (and/or its friends) handy.
For my app I built a datastore access tracking scheme which could be used to gather such stats as well (but it only covers direct entity lookups, not those read through query results). See Are ndb cached read ops still counted as datastore read ops for billing purposes?
Upvotes: 2