Skip to main content

_NonPersistentStatistics

Statistics compliant object that is not supposed to do anything when entering/exiting context.

To be used in sub crawlers.

Hierarchy

Index

Methods

__aenter__

  • async __aenter__(): Self

__aexit__

  • async __aexit__(exc_type, exc_value, exc_traceback): None
  • Stop collecting statistics.


    Parameters

    • exc_type: type[BaseException] | None
    • exc_value: BaseException | None
    • exc_traceback: TracebackType | None

    Returns None

__init__

  • __init__(*, persistence_enabled, persist_state_kvs_name, persist_state_key, key_value_store, log_message, periodic_message_logger, log_interval, state_model): None
  • 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

record_request_processing_failure

  • record_request_processing_failure(request_id_or_key): None

record_request_processing_finish

  • record_request_processing_finish(request_id_or_key): None

record_request_processing_start

  • record_request_processing_start(request_id_or_key): None

register_status_code

  • register_status_code(code): None

replace_state_model

reset

  • async reset(): None
  • Reset the statistics to their defaults and remove any persistent state.


    Returns None

with_default_state

  • with_default_state(*, persistence_enabled, persist_state_kvs_name, persist_state_key, key_value_store, log_message, periodic_message_logger, log_interval): Statistics[StatisticsState]
  • Convenience constructor for creating a Statistics with default state model StatisticsState.


    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

active: bool

Indicate whether the context is active.