Statistics
Index
Properties
errorTracker
An error tracker for final retry errors.
errorTrackerRetry
An error tracker for retry errors prior to the final retry.
readonlyid
Statistic instance id.
readonlyrequestRetryHistogram
Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on
state
Current statistic state used for doing calculations on Statistics.calculate calls
Methods
calculate
Calculate the current statistics
Returns { crawlerRuntimeMillis: number; requestAvgFailedDurationMillis: number; requestAvgFinishedDurationMillis: number; requestTotalDurationMillis: number; requestsFailedPerMinute: number; requestsFinishedPerMinute: number; requestsTotal: number }
crawlerRuntimeMillis: number
requestAvgFailedDurationMillis: number
requestAvgFinishedDurationMillis: number
requestTotalDurationMillis: number
requestsFailedPerMinute: number
requestsFinishedPerMinute: number
requestsTotal: number
persistState
Persist internal state to the key value store
Returns Promise<void>
registerStatusCode
Increments the status code counter.
Parameters
code: number
Returns void
reset
Set the current statistic instance to pristine values
Returns void
startCapturing
Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals
Returns Promise<void>
stopCapturing
Stops logging and remove event listeners, then persist
Returns Promise<void>
toJSON
Make this class serializable when called with
JSON.stringify(statsInstance)
directly or throughkeyValueStore.setValue('KEY', statsInstance)
Returns StatisticPersistedState
The statistics class provides an interface to collecting and logging run statistics for requests.
All statistic information is saved on key value store under the key
SDK_CRAWLER_STATISTICS_*
, persists between migrations and abort/resurrect