Skip to main content

spire_core/crawler/
stats.rs

1use std::time::Duration;
2
3/// Totals of a [`Crawler::run`](crate::crawler::Crawler::run), live while it runs
4/// through [`Crawler::stats`](crate::crawler::Crawler::stats).
5#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
6#[non_exhaustive]
7pub struct Stats {
8    /// Requests handled, counting every attempt.
9    pub requests: usize,
10    /// Requests that finished with [`Outcome::Continue`] or
11    /// [`Outcome::Stop`].
12    ///
13    /// [`Outcome::Continue`]: crate::worker::Outcome::Continue
14    /// [`Outcome::Stop`]: crate::worker::Outcome::Stop
15    pub succeeded: usize,
16    /// Requests that failed for good: not retryable, out of retries, or
17    /// refused a retry by the frontier.
18    pub failed: usize,
19    /// Requests the frontier accepted for another attempt.
20    pub retried: usize,
21    /// Requests not crawled on purpose: disallowed by robots.txt or with an
22    /// aborted tag.
23    pub skipped: usize,
24    /// Requests still in flight when the shutdown grace period ended.
25    pub cancelled: usize,
26    /// Requests the server answered `304 Not Modified`: unchanged since the
27    /// crawl last saw them, see `Revalidate`.
28    pub unchanged: usize,
29    /// Wall-clock time of the run.
30    pub elapsed: Duration,
31}