_NonPersistentStatistics
Hierarchy
- Statistics
- _NonPersistentStatistics
Index
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
__init__
Parameters
optionalkeyword-onlypersistence_enabled: bool = False
optionalkeyword-onlypersist_state_kvs_name: str = 'default'
optionalkeyword-onlypersist_state_key: str | None = None
optionalkeyword-onlykey_value_store: KeyValueStore | None = None
optionalkeyword-onlylog_message: str = 'Statistics'
optionalkeyword-onlyperiodic_message_logger: Logger | None = None
optionalkeyword-onlylog_interval: timedelta = timedelta(minutes=1)
keyword-onlystate_model: type[TStatisticsState]
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
replace_state_model
Create near copy of the
Statistics
with replacedstate_model
.Parameters
state_model: type[TNewStatisticsState]
Returns Statistics[TNewStatisticsState]
reset
Reset the statistics to their defaults and remove any persistent state.
Returns None
with_default_state
Convenience constructor for creating a
Statistics
with default state modelStatisticsState
.Parameters
optionalkeyword-onlypersistence_enabled: bool = False
optionalkeyword-onlypersist_state_kvs_name: str = 'default'
optionalkeyword-onlypersist_state_key: str | None = None
optionalkeyword-onlykey_value_store: KeyValueStore | None = None
optionalkeyword-onlylog_message: str = 'Statistics'
optionalkeyword-onlyperiodic_message_logger: Logger | None = None
optionalkeyword-onlylog_interval: timedelta = timedelta(minutes=1)
Returns Statistics[StatisticsState]
Properties
active
Indicate whether the context is active.
Statistics compliant object that is not supposed to do anything when entering/exiting context.
To be used in sub crawlers.