def _RPCCategory(rpcstatsproto):
 category = ''
 if (not rpcstatsproto.has_datastore_details()):
  return category
 servicecallname = rpcstatsproto.service_call_name()
 if (servicecallname == 'datastore_v3.Put'):
  category = entity.EntityListKind(rpcstatsproto.datastore_details().keys_written_list())
 elif (servicecallname == 'datastore_v3.Get'):
  category = entity.EntityListKind(rpcstatsproto.datastore_details().keys_read_list())
 elif (servicecallname == 'datastore_v3.Next'):
  category = entity.EntityListKind(rpcstatsproto.datastore_details().keys_read_list())
 elif (servicecallname == 'datastore_v3.RunQuery'):
  if rpcstatsproto.datastore_details().has_query_kind():
   kind = rpcstatsproto.datastore_details().query_kind()
  else:
   kind = 'NoKind'
  if rpcstatsproto.datastore_details().has_query_ancestor():
   ancestor = '_ANC'
  else:
   ancestor = ''
  category = ('%s%s' % (kind, ancestor))
 return category

def _RPCCategory ( rpcstatsproto ) : category = '' if ( not rpcstatsproto . has_datastore_details ( ) ) : return category servicecallname = rpcstatsproto . service_call_name ( ) if ( servicecallname == 'datastore_v3.Put' ) : category = entity . EntityListKind ( rpcstatsproto . datastore_details ( ) . keys_written_list ( ) ) elif ( servicecallname == 'datastore_v3.Get' ) : category = entity . EntityListKind ( rpcstatsproto . datastore_details ( ) . keys_read_list ( ) ) elif ( servicecallname == 'datastore_v3.Next' ) : category = entity . EntityListKind ( rpcstatsproto . datastore_details ( ) . keys_read_list ( ) ) elif ( servicecallname == 'datastore_v3.RunQuery' ) : if rpcstatsproto . datastore_details ( ) . has_query_kind ( ) : kind = rpcstatsproto . datastore_details ( ) . query_kind ( ) else : kind = 'NoKind' if rpcstatsproto . datastore_details ( ) . has_query_ancestor ( ) : ancestor = '_ANC' else : ancestor = '' category = ( '%s%s' % ( kind , ancestor ) ) return category
categorize datastore rpcs by entity kind and other information .