Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2737 Generator: count and log reason of rejections during selection - count rejections by `generate.max.count` * number of hosts (resp. domains) affected * number of URLs skipped total (for all hosts)

Sebastian Nagel35da06fe37b7
diff --git a/src/java/org/apache/nutch/crawl/Generator.java b/src/java/org/apache/nutch/crawl/Generator.java
index a18dad4ae..7b5397ce8 100644
--- a/src/java/org/apache/nutch/crawl/Generator.java
+++ b/src/java/org/apache/nutch/crawl/Generator.java
@@ -502,12 +502,17 @@ public class Generator extends NutchTool implements Tool {
hostCount[0]++;
hostCount[1] = 1;
} else {
- if (hostCount[1] == maxCount && LOG.isInfoEnabled()) {
+ if (hostCount[1] == maxCount) {
+ context
+ .getCounter("Generator", "HOSTS_AFFECTED_PER_HOST_OVERFLOW")
+ .increment(1);
LOG.info(
"Host or domain {} has more than {} URLs for all {} segments. Additional URLs won't be included in the fetchlist.",
hostordomain, maxCount, maxNumSegments);
}
// skip this entry
+ context.getCounter("Generator", "URLS_SKIPPED_PER_HOST_OVERFLOW")
+ .increment(1);
continue;
}
}