This is an automated email from the ASF dual-hosted git repository.

snagel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nutch.git


The following commit(s) were added to refs/heads/master by this push:
     new 1d25cb8f0 NUTCH-3152 Job counters getGroup to use metrics constants
1d25cb8f0 is described below

commit 1d25cb8f0f7a97ca80661ea417a29a3644f00536
Author: Sebastian Nagel <[email protected]>
AuthorDate: Sun Feb 8 23:08:37 2026 +0100

    NUTCH-3152 Job counters getGroup to use metrics constants
---
 src/java/org/apache/nutch/crawl/Generator.java     | 11 +++++++----
 src/java/org/apache/nutch/indexer/IndexingJob.java | 13 +++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/java/org/apache/nutch/crawl/Generator.java 
b/src/java/org/apache/nutch/crawl/Generator.java
index 57bf7f476..102ce39b9 100644
--- a/src/java/org/apache/nutch/crawl/Generator.java
+++ b/src/java/org/apache/nutch/crawl/Generator.java
@@ -1018,10 +1018,13 @@ public class Generator extends NutchTool implements 
Tool {
     }
 
     LOG.info("Generator: number of items rejected during selection:");
-    for (Counter counter : job.getCounters().getGroup("Generator")) {
-      LOG.info("Generator: {}  {}",
-          String.format(Locale.ROOT, "%6d", counter.getValue()),
-          counter.getName());
+    for (Counter counter : job.getCounters()
+        .getGroup(NutchMetrics.GROUP_GENERATOR)) {
+      long counterValue = counter.getValue();
+      if (counterValue > 0) {
+        LOG.info("Generator: {}  {}",
+            String.format(Locale.ROOT, "%6d", counterValue), 
counter.getName());
+      }
     }
     if (!getConf().getBoolean(GENERATE_UPDATE_CRAWLDB, false)) {
       /*
diff --git a/src/java/org/apache/nutch/indexer/IndexingJob.java 
b/src/java/org/apache/nutch/indexer/IndexingJob.java
index fc2c44a06..224b4118e 100644
--- a/src/java/org/apache/nutch/indexer/IndexingJob.java
+++ b/src/java/org/apache/nutch/indexer/IndexingJob.java
@@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.lang3.time.StopWatch;
 import org.apache.nutch.metadata.Nutch;
+import org.apache.nutch.metrics.NutchMetrics;
 import org.apache.nutch.segment.SegmentChecker;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -155,10 +156,14 @@ public class IndexingJob extends NutchTool implements 
Tool {
         throw e;
       }
       LOG.info("Indexer: number of documents indexed, deleted, or skipped:");
-      for (Counter counter : job.getCounters().getGroup("IndexerStatus")) {
-        LOG.info("Indexer: {}  {}",
-            String.format(Locale.ROOT, "%6d", counter.getValue()),
-            counter.getName());
+      for (Counter counter : job.getCounters()
+          .getGroup(NutchMetrics.GROUP_INDEXER)) {
+        long counterValue = counter.getValue();
+        if (counterValue > 0) {
+          LOG.info("Indexer: {}  {}",
+              String.format(Locale.ROOT, "%6d", counterValue),
+              counter.getName());
+        }
       }
       stopWatch.stop();
       LOG.info("Indexer: finished, elapsed: {} ms", stopWatch.getTime(

Reply via email to