Statistics
Index
Constructors
__init__
Parameters
keyword-onlyevent_manager: EventManager | None = None
keyword-onlypersistence_enabled: bool = False
keyword-onlypersist_state_kvs_name: str = 'default'
keyword-onlypersist_state_key: str | None = None
keyword-onlykey_value_store: KeyValueStore | None = None
keyword-onlylog_message: str = 'Statistics'
keyword-onlyperiodic_message_logger: Logger | None = None
keyword-onlylog_interval: timedelta = timedelta(minutes=1)
keyword-onlystate_model: type[TStatisticsState] = cast(Any, StatisticsState)
Returns None
Methods
__aenter__
Subscribe to events and start collecting statistics.
Returns Self
__aexit__
Stop collecting statistics.
Parameters
exc_type: type[BaseException] | None
exc_value: BaseException | None
exc_traceback: TracebackType | None
Returns None
calculate
Calculate the current statistics.
Returns FinalStatistics
record_request_processing_failure
Mark a request as failed.
Parameters
request_id_or_key: str
Returns None
record_request_processing_finish
Mark a request as finished.
Parameters
request_id_or_key: str
Returns None
record_request_processing_start
Mark a request as started.
Parameters
request_id_or_key: str
Returns None
register_status_code
Increment the number of times a status code has been received.
Parameters
code: int
Returns None
reset
Reset the statistics to their defaults and remove any persistent state.
Returns None
An interface to collecting and logging runtime statistics for requests.
All information is saved to the key value store so that it persists between migrations, abortions and resurrections.