fix: populate diagramContentHash in chunked ingestion pipeline
ChunkAccumulator now injects DiagramStore and looks up the content hash when converting to MergedExecution. Without this, the detail page had no diagram hash, so the overlay couldn't find the route diagram. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -107,10 +107,12 @@ public class StorageBeanConfig {
|
|||||||
@ConditionalOnProperty(name = "cameleer.storage.executions", havingValue = "clickhouse", matchIfMissing = true)
|
@ConditionalOnProperty(name = "cameleer.storage.executions", havingValue = "clickhouse", matchIfMissing = true)
|
||||||
public ChunkAccumulator chunkAccumulator(
|
public ChunkAccumulator chunkAccumulator(
|
||||||
WriteBuffer<MergedExecution> executionBuffer,
|
WriteBuffer<MergedExecution> executionBuffer,
|
||||||
WriteBuffer<ChunkAccumulator.ProcessorBatch> processorBatchBuffer) {
|
WriteBuffer<ChunkAccumulator.ProcessorBatch> processorBatchBuffer,
|
||||||
|
DiagramStore diagramStore) {
|
||||||
return new ChunkAccumulator(
|
return new ChunkAccumulator(
|
||||||
executionBuffer::offer,
|
executionBuffer::offer,
|
||||||
processorBatchBuffer::offer,
|
processorBatchBuffer::offer,
|
||||||
|
diagramStore,
|
||||||
java.time.Duration.ofMinutes(5));
|
java.time.Duration.ofMinutes(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.cameleer3.server.core.ingestion;
|
|||||||
|
|
||||||
import com.cameleer3.common.model.ExecutionChunk;
|
import com.cameleer3.common.model.ExecutionChunk;
|
||||||
import com.cameleer3.common.model.FlatProcessorRecord;
|
import com.cameleer3.common.model.FlatProcessorRecord;
|
||||||
|
import com.cameleer3.server.core.storage.DiagramStore;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -29,14 +30,17 @@ public class ChunkAccumulator {
|
|||||||
|
|
||||||
private final Consumer<MergedExecution> executionSink;
|
private final Consumer<MergedExecution> executionSink;
|
||||||
private final Consumer<ProcessorBatch> processorSink;
|
private final Consumer<ProcessorBatch> processorSink;
|
||||||
|
private final DiagramStore diagramStore;
|
||||||
private final Duration staleThreshold;
|
private final Duration staleThreshold;
|
||||||
private final ConcurrentHashMap<String, PendingExchange> pending = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, PendingExchange> pending = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public ChunkAccumulator(Consumer<MergedExecution> executionSink,
|
public ChunkAccumulator(Consumer<MergedExecution> executionSink,
|
||||||
Consumer<ProcessorBatch> processorSink,
|
Consumer<ProcessorBatch> processorSink,
|
||||||
|
DiagramStore diagramStore,
|
||||||
Duration staleThreshold) {
|
Duration staleThreshold) {
|
||||||
this.executionSink = executionSink;
|
this.executionSink = executionSink;
|
||||||
this.processorSink = processorSink;
|
this.processorSink = processorSink;
|
||||||
|
this.diagramStore = diagramStore;
|
||||||
this.staleThreshold = staleThreshold;
|
this.staleThreshold = staleThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +142,15 @@ public class ChunkAccumulator {
|
|||||||
|
|
||||||
// ---- Conversion to MergedExecution ----
|
// ---- Conversion to MergedExecution ----
|
||||||
|
|
||||||
private static MergedExecution toMergedExecution(ExecutionChunk envelope) {
|
private MergedExecution toMergedExecution(ExecutionChunk envelope) {
|
||||||
|
String diagramHash = "";
|
||||||
|
try {
|
||||||
|
diagramHash = diagramStore
|
||||||
|
.findContentHashForRoute(envelope.getRouteId(), envelope.getAgentId())
|
||||||
|
.orElse("");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.debug("Could not resolve diagram hash for route={}", envelope.getRouteId());
|
||||||
|
}
|
||||||
return new MergedExecution(
|
return new MergedExecution(
|
||||||
DEFAULT_TENANT,
|
DEFAULT_TENANT,
|
||||||
1L,
|
1L,
|
||||||
@@ -158,7 +170,7 @@ public class ChunkAccumulator {
|
|||||||
envelope.getErrorCategory(),
|
envelope.getErrorCategory(),
|
||||||
envelope.getRootCauseType(),
|
envelope.getRootCauseType(),
|
||||||
envelope.getRootCauseMessage(),
|
envelope.getRootCauseMessage(),
|
||||||
"", // diagramContentHash — server-side lookup, not in chunk
|
diagramHash,
|
||||||
envelope.getEngineLevel(),
|
envelope.getEngineLevel(),
|
||||||
"", // inputBody — on processor records now
|
"", // inputBody — on processor records now
|
||||||
"", // outputBody
|
"", // outputBody
|
||||||
|
|||||||
Reference in New Issue
Block a user