Statistics
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 SDKCRAWLER_STATISTICS*, persists between migrations and abort/resurrect
Properties
state
Type: StatisticState
Current statistic state used for doing calculations on Statistics.calculate()
calls
id
Type: number
Statistic instance id
requestRetryHistogram
Type: Array<number>
Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on
statistics.reset()
Set the current statistic instance to pristine values
statistics.calculate()
Calculate the current statistics
statistics.startCapturing()
Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals
statistics.stopCapturing()
Stops logging and remove event listeners, then persist
statistics.persistState()
Persist internal state to the key value store
statistics.toJSON()
Make this class serializable when called with JSON.stringify(statsInstance)
directly or through keyValueStore.setValue('KEY', statsInstance)
Returns:
StatisticPersistedState
| StatisticState