From e398d9213eff2b5f23988135de197567f5386d99 Mon Sep 17 00:00:00 2001 From: Keith Massey Date: Thu, 10 Nov 2022 16:39:56 -0600 Subject: [PATCH] Improving logging to troubelshoot pipeline metrics problem (#91439) --- .../main/java/org/elasticsearch/ingest/CompoundProcessor.java | 4 ++-- .../java/org/elasticsearch/ingest/ConditionalProcessor.java | 2 +- .../src/main/java/org/elasticsearch/ingest/IngestService.java | 2 +- server/src/main/java/org/elasticsearch/ingest/Pipeline.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/ingest/CompoundProcessor.java b/server/src/main/java/org/elasticsearch/ingest/CompoundProcessor.java index fa5fe425c7eb6..b8cdc98405781 100644 --- a/server/src/main/java/org/elasticsearch/ingest/CompoundProcessor.java +++ b/server/src/main/java/org/elasticsearch/ingest/CompoundProcessor.java @@ -213,7 +213,7 @@ void innerExecute(int currentProcessor, IngestDocument ingestDocument, final BiC try { finalProcessor.execute(ingestDocument, (result, e) -> { if (listenerHasBeenCalled.getAndSet(true)) { - logger.warn("A listener was unexpectedly called more than once", new RuntimeException()); + logger.warn("A listener was unexpectedly called more than once", new RuntimeException(e)); assert false : "A listener was unexpectedly called more than once"; } else { long ingestTimeInNanos = relativeTimeProvider.getAsLong() - startTimeInNanos; @@ -233,7 +233,7 @@ void innerExecute(int currentProcessor, IngestDocument ingestDocument, final BiC } catch (Exception e) { long ingestTimeInNanos = relativeTimeProvider.getAsLong() - startTimeInNanos; if (postIngestHasBeenCalled.get()) { - logger.warn("Preventing postIngest from being called more than once", new RuntimeException()); + logger.warn("Preventing postIngest from being called more than once", e); assert false : "Attempt to call postIngest more than once"; } else { finalMetric.postIngest(ingestTimeInNanos); diff --git a/server/src/main/java/org/elasticsearch/ingest/ConditionalProcessor.java b/server/src/main/java/org/elasticsearch/ingest/ConditionalProcessor.java index 858fe5e675b36..597307d433d6f 100644 --- a/server/src/main/java/org/elasticsearch/ingest/ConditionalProcessor.java +++ b/server/src/main/java/org/elasticsearch/ingest/ConditionalProcessor.java @@ -135,7 +135,7 @@ public void execute(IngestDocument ingestDocument, BiConsumer { if (listenerHasBeenCalled.getAndSet(true)) { - logger.warn("A listener was unexpectedly called more than once", new RuntimeException()); + logger.warn("A listener was unexpectedly called more than once", new RuntimeException(e)); assert false : "A listener was unexpectedly called more than once"; } else { long ingestTimeInNanos = relativeTimeProvider.getAsLong() - startTimeInNanos; diff --git a/server/src/main/java/org/elasticsearch/ingest/IngestService.java b/server/src/main/java/org/elasticsearch/ingest/IngestService.java index b58594edd26ac..206c167ed877e 100644 --- a/server/src/main/java/org/elasticsearch/ingest/IngestService.java +++ b/server/src/main/java/org/elasticsearch/ingest/IngestService.java @@ -894,7 +894,7 @@ private void innerExecute( final AtomicBoolean listenerHasBeenCalled = new AtomicBoolean(false); ingestDocument.executePipeline(pipeline, (result, e) -> { if (listenerHasBeenCalled.getAndSet(true)) { - logger.warn("A listener was unexpectedly called more than once", new RuntimeException()); + logger.warn("A listener was unexpectedly called more than once", new RuntimeException(e)); assert false : "A listener was unexpectedly called more than once"; } else { long ingestTimeInNanos = System.nanoTime() - startTimeInNanos; diff --git a/server/src/main/java/org/elasticsearch/ingest/Pipeline.java b/server/src/main/java/org/elasticsearch/ingest/Pipeline.java index 8061e7a90aee9..1053361000d96 100644 --- a/server/src/main/java/org/elasticsearch/ingest/Pipeline.java +++ b/server/src/main/java/org/elasticsearch/ingest/Pipeline.java @@ -128,7 +128,7 @@ public void execute(IngestDocument ingestDocument, BiConsumer { if (listenerHasBeenCalled.getAndSet(true)) { - logger.warn("A listener was unexpectedly called more than once", new RuntimeException()); + logger.warn("A listener was unexpectedly called more than once", new RuntimeException(e)); assert false : "A listener was unexpectedly called more than once"; } else { long ingestTimeInNanos = relativeTimeProvider.getAsLong() - startTimeInNanos;