From d3600bfb7365554ace27d08d3a46c690f120f64a Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sat, 4 Jun 2022 23:38:12 +0100 Subject: [PATCH] Add metric for new enqueued URLs --- quickpeep_raker/src/raking/rakemetrics.rs | 6 ++++++ quickpeep_raker/src/raking/task.rs | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/quickpeep_raker/src/raking/rakemetrics.rs b/quickpeep_raker/src/raking/rakemetrics.rs index cd94c3e..3976b8f 100644 --- a/quickpeep_raker/src/raking/rakemetrics.rs +++ b/quickpeep_raker/src/raking/rakemetrics.rs @@ -18,4 +18,10 @@ pub fn describe_raking_metrics() { Unit::Bytes, "Number of content bytes raked." ); + + describe_counter!( + "qprake_queue_new_url", + Unit::Count, + "Number of new URLs enqueued" + ); } diff --git a/quickpeep_raker/src/raking/task.rs b/quickpeep_raker/src/raking/task.rs index f711277..6a36c2e 100644 --- a/quickpeep_raker/src/raking/task.rs +++ b/quickpeep_raker/src/raking/task.rs @@ -10,6 +10,7 @@ use chrono::Utc; use cylon::Cylon; use log::{error, warn}; use lru::LruCache; +use metrics::increment_counter; use quickpeep_structs::rake_entries::{ IconEntry, RakedPageEntry, RakedReference, RakedReferrerEntry, ReferenceKind, }; @@ -537,11 +538,14 @@ impl EventProcessor<'_> { .map(|record: AllowedDomainRecord| record.applies_to_url(&ref_url)) .unwrap_or(false); if allowed { - txn.enqueue_url( + let is_fresh = txn.enqueue_url( &reference.target, reference.last_mod, reference.kind.into(), )?; + if is_fresh { + increment_counter!("qprake_queue_new_url"); + } continue; }