![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | http_method |
def | http_path |
def | http_query |
def | record_custom_event |
def | record_datastore_details |
def | record_put_details |
def | record_delete_details |
def | record_commit_details |
def | record_get_details |
def | record_query_details |
def | record_allocate_ids_details |
def | record_xmpp_details |
def | record_channel_details |
def | record_mail_details |
def | record_rpc_request |
def | record_rpc_response |
def | record_http_status |
def | save |
def | get_both_protos_encoded |
def | add_full_info_to_proto |
def | get_full_proto |
def | get_summary_proto_encoded |
def | get_summary_proto |
def | get_rpcstats |
def | get_total_api_mcycles |
def | dump |
def | get_call_stack |
def | init_sys_path_entries |
def | get_frame_summary |
Public Attributes | |
env | |
start_timestamp | |
http_status | |
end_timestamp | |
traces | |
pending | |
overhead | |
Static Public Attributes | |
sys_path_entries = None | |
In-memory state for the current request. An instance is created soon after the request is received, and set as the Recorder for the current request in the RequestLocalRecorderProxy in the global variable 'recorder_proxy'. It collects information about the request and about individual RPCs made during the request, until just before the response is sent out, when the recorded information is saved to memcache by calling the save() method.
def google.appengine.ext.appstats.recording.Recorder.__init__ | ( | self, | |
env | |||
) |
Constructor. Args: env: A dict giving the CGI or WSGI environment.
def google.appengine.ext.appstats.recording.Recorder.add_full_info_to_proto | ( | self, | |
proto | |||
) |
Update a protobuf representing with additional data.
def google.appengine.ext.appstats.recording.Recorder.dump | ( | self, | |
level = None |
|||
) |
Log the recorded data, for debugging. This logs messages using logging.info(). The amount of data logged is controlled by the level argument, which defaults to config.DUMP_LEVEL; if < 0 (the default) nothing is logged.
def google.appengine.ext.appstats.recording.Recorder.get_both_protos_encoded | ( | self | ) |
Return a string representing all recorded info an encoded protobuf. This constructs the full proto and calls its .Encode() method; if the resulting string is too large, it tries a number of increasingly aggressive strategies for chopping the data down.
def google.appengine.ext.appstats.recording.Recorder.get_call_stack | ( | self, | |
trace | |||
) |
Extract the current call stack. The stack is limited to at most config.MAX_STACK frames; frames recognized by config.RE_STACK_SKIP are skipped; a frame recognized by config.RE_STACK_BOTTOM terminates the stack search. Args: trace: An IndividualRpcStatsProto instance that will be updated.
def google.appengine.ext.appstats.recording.Recorder.get_frame_summary | ( | self, | |
frame, | |||
trace | |||
) |
Return a frame summary. Args: frame: A Python stack frame object. trace: An IndividualRpcStatsProto instance that will be updated. Returns: False if this stack frame matches config.RE_STACK_BOTTOM. True otherwise.
def google.appengine.ext.appstats.recording.Recorder.get_full_proto | ( | self | ) |
Return the full protobuf, wrapped in a StatsProto.
def google.appengine.ext.appstats.recording.Recorder.get_rpcstats | ( | self | ) |
Compute RPC statistics (how often each RPC endpoint is called). Returns: A dict mapping 'service.call' keys to an array of objects giving call counts (int), call costs (int), and billed ops (dict from op to pb).
def google.appengine.ext.appstats.recording.Recorder.get_summary_proto | ( | self | ) |
Return a protobuf representing a summary of this recorder.
def google.appengine.ext.appstats.recording.Recorder.get_summary_proto_encoded | ( | self | ) |
Return a string representing a summary an encoded protobuf. This calls self.get_summary_proto() and calls the .Encode() method of the resulting object.
def google.appengine.ext.appstats.recording.Recorder.get_total_api_mcycles | ( | self | ) |
Compute the total amount of API time for all RPCs. Deprecated. This value is no longer meaningful. Returns: An integer expressing megacycles.
def google.appengine.ext.appstats.recording.Recorder.http_method | ( | self | ) |
Return the request method, e.g. 'GET' or 'POST'.
def google.appengine.ext.appstats.recording.Recorder.http_path | ( | self | ) |
Return the request path, e.g. '/' or '/foo/bar', excluding the query.
def google.appengine.ext.appstats.recording.Recorder.http_query | ( | self | ) |
Return the query string, if any, with '?' prefix. If there is no query string, an empty string is returned (i.e. not '?').
def google.appengine.ext.appstats.recording.Recorder.init_sys_path_entries | ( | cls | ) |
Initialize the class variable path_entries. The variable will hold a list of (i, entry) tuples where entry == sys.path[i], sorted from shortest to longest entry.
def google.appengine.ext.appstats.recording.Recorder.record_allocate_ids_details | ( | self, | |
trace | |||
) |
Records cost information for the AllocateIds RPC. Args: trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_channel_details | ( | self, | |
call, | |||
trace | |||
) |
Records information relating to channel RPCs. Args: call: The call name, e.g. 'CreateChannel'. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_commit_details | ( | self, | |
response, | |||
trace | |||
) |
Records cost information for the Commit RPC. Args: response: The response protocol message of the Commit RPC call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_custom_event | ( | self, | |
label, | |||
data = None |
|||
) |
Record a custom event. Args: label: A string to use as event label; a 'custom.' prefix will be added. data: Optional value to record. This can be anything; the value will be formatted using format_value() before it is recorded.
def google.appengine.ext.appstats.recording.Recorder.record_datastore_details | ( | self, | |
call, | |||
request, | |||
response, | |||
trace | |||
) |
Records additional information relating to datastore RPCs. Parses requests and responses of datastore related RPCs, and records the primary keys of entities that are put into the datastore or fetched from the datastore. Non-datastore RPCs are ignored. Keys are recorded in the form of Reference protos. Currently the information is logged for the following calls: Get, Put, RunQuery and Next. The code may be extended in the future to cover more RPC calls. In addition to the entity keys, useful information specific to each call is recorded. E.g., for queries, the entity kind and cursor information is recorded; For gets, a flag indicating if the requested entity key is present or not is recorded. Also collects RPC costs. Args: call: The call name, e.g. 'Get'. request: The request protocol message corresponding to the call. response: The response protocol message corresponding to the call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_delete_details | ( | self, | |
response, | |||
trace | |||
) |
Records cost information for the Delete RPC. Args: response: The response protocol message of the Delete RPC call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_get_details | ( | self, | |
request, | |||
response, | |||
trace | |||
) |
Records additional get details based on config options. Details include: Keys of entities requested, whether or not the requested key was successfully fetched, and cost information for the Get RPC. Args: request: The request protocol message of the Get RPC call. response: The response protocol message of the Get RPC call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_http_status | ( | self, | |
status | |||
) |
Record the HTTP status code and the end time of the HTTP request.
def google.appengine.ext.appstats.recording.Recorder.record_mail_details | ( | self, | |
call, | |||
request, | |||
trace | |||
) |
Records information relating to mail RPCs. Args: call: The call name, e.g. 'Send'. request: The request protocol message corresponding to the call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_put_details | ( | self, | |
response, | |||
trace | |||
) |
Records additional put details based on config options. Details include: Keys of entities written and cost information for the Put RPC. Args: response: The response protocol message of the Put RPC call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_query_details | ( | self, | |
call, | |||
request, | |||
response, | |||
trace | |||
) |
Records additional query details based on config options. Details include: Keys of entities fetched by a datastore query and cost information. Information is recorded for both the RunQuery and Next calls. For RunQuery calls, we record the entity kind and ancestor (if applicable) and cursor information (which can help correlate the RunQuery with a subsequent Next call). For Next calls, we record cursor information of the Request (which helps associate this call with the previous RunQuery/Next call), and the Response (which helps associate this call with the subsequent Next call). For key only queries, entity keys are not recorded since entities are not actually fetched. In the future, we might want to record the entities but also record a flag indicating whether this is a key only query. Args: call: The call name, e.g. 'RunQuery' or 'Next' request: The request protocol message of the RPC call. response: The response protocol message of the RPC call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.record_rpc_request | ( | self, | |
service, | |||
call, | |||
request, | |||
response, | |||
rpc | |||
) |
Record the request of an RPC call. Args: service: The service name, e.g. 'memcache'. call: The call name, e.g. 'Get'. request: The request object. response: The response object (ignored). rpc: The RPC object; may be None.
def google.appengine.ext.appstats.recording.Recorder.record_rpc_response | ( | self, | |
service, | |||
call, | |||
request, | |||
response, | |||
rpc | |||
) |
Record the response of an RPC call. Args: service: The service name, e.g. 'memcache'. call: The call name, e.g. 'Get'. request: The request object. response: The response object (ignored). rpc: The RPC object; may be None. This first tries to match the request with an unmatched request trace. If no matching request trace is found, this is logged as a new trace.
def google.appengine.ext.appstats.recording.Recorder.record_xmpp_details | ( | self, | |
call, | |||
request, | |||
trace | |||
) |
Records information relating to xmpp RPCs. Args: call: The call name, e.g. 'SendMessage'. request: The request protocol message corresponding to the call. trace: IndividualStatsProto where information must be recorded.
def google.appengine.ext.appstats.recording.Recorder.save | ( | self | ) |
Save the recorded data to memcache and log some info. This wraps the _save() method, which does the actual work; this function just logs the total time it took and some other statistics.