v0.1.0-pre.061
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-pipeline/src/decode_replay.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Common contextual instruction decode and optional materialization pipeline.
|
||||
|
||||
@@ -168,8 +168,10 @@ pub struct DecodeProcessorSummary {
|
||||
pub ignored: u64,
|
||||
/// Number recognized but unsupported.
|
||||
pub unsupported: u64,
|
||||
/// Number failing decode, validation or persistence.
|
||||
/// Number returning an explicit decoder failure outcome.
|
||||
pub failed: u64,
|
||||
/// Number interrupted by orchestration, storage or other processing errors.
|
||||
pub processing_errors: u64,
|
||||
/// Number of materialized outputs committed.
|
||||
pub materialized_outputs: u64,
|
||||
/// Number of materializer policy refusals committed to the ledger.
|
||||
@@ -193,8 +195,10 @@ pub struct DecodeReplaySummary {
|
||||
pub unmatched: u64,
|
||||
/// Number never decoded because cancellation was already requested.
|
||||
pub not_started: u64,
|
||||
/// Number of input-level failures.
|
||||
/// Number of inputs returning an explicit decoder failure outcome.
|
||||
pub failed_inputs: u64,
|
||||
/// Number of inputs interrupted by orchestration, storage or other processing errors.
|
||||
pub processing_error_inputs: u64,
|
||||
/// Whether cooperative cancellation was observed.
|
||||
pub cancelled: bool,
|
||||
/// Per-decoder counters ordered by name and version.
|
||||
@@ -213,7 +217,8 @@ struct DecodeItemOutcome {
|
||||
program_id: std::string::String,
|
||||
started: bool,
|
||||
unmatched: bool,
|
||||
failed: bool,
|
||||
decode_failed: bool,
|
||||
processing_error: bool,
|
||||
cancelled: bool,
|
||||
processors: std::vec::Vec<crate::DecodeProcessorSummary>,
|
||||
}
|
||||
@@ -455,7 +460,7 @@ where
|
||||
let mut settled = 0_u64;
|
||||
while let std::option::Option::Some(outcome) = stream.next().await {
|
||||
settled += 1;
|
||||
let level = if outcome.failed {
|
||||
let level = if outcome.decode_failed || outcome.processing_error {
|
||||
crate::DecodeReplayProgressLevel::Error
|
||||
} else if outcome.cancelled {
|
||||
crate::DecodeReplayProgressLevel::Warning
|
||||
@@ -465,13 +470,14 @@ where
|
||||
observer.on_progress(&crate::DecodeReplayProgressEvent::new(
|
||||
level,
|
||||
format!(
|
||||
"decode replay input terminal signature={} slot={} instruction_path={} program_id={} unmatched={} failed={} cancelled={} processors={:?}",
|
||||
"decode replay input terminal signature={} slot={} instruction_path={} program_id={} unmatched={} decode_failed={} processing_error={} cancelled={} processors={:?}",
|
||||
outcome.signature,
|
||||
outcome.slot,
|
||||
outcome.instruction_path,
|
||||
outcome.program_id,
|
||||
outcome.unmatched,
|
||||
outcome.failed,
|
||||
outcome.decode_failed,
|
||||
outcome.processing_error,
|
||||
outcome.cancelled,
|
||||
outcome.processors
|
||||
),
|
||||
@@ -489,6 +495,7 @@ where
|
||||
unmatched: 0,
|
||||
not_started: 0,
|
||||
failed_inputs: 0,
|
||||
processing_error_inputs: 0,
|
||||
cancelled: observer.is_cancelled(),
|
||||
processors: std::vec::Vec::new(),
|
||||
started_at,
|
||||
@@ -502,9 +509,12 @@ where
|
||||
if outcome.unmatched {
|
||||
summary.unmatched += 1;
|
||||
}
|
||||
if outcome.failed {
|
||||
if outcome.decode_failed {
|
||||
summary.failed_inputs += 1;
|
||||
}
|
||||
if outcome.processing_error {
|
||||
summary.processing_error_inputs += 1;
|
||||
}
|
||||
if outcome.cancelled && !outcome.started {
|
||||
summary.not_started += 1;
|
||||
}
|
||||
@@ -518,12 +528,12 @@ where
|
||||
.cmp(&right.processor_name)
|
||||
.then(left.processor_version.cmp(&right.processor_version));
|
||||
});
|
||||
if summary.unmatched > 0 || summary.failed_inputs > 0 {
|
||||
tracing::error!(target: crate::TRACING_TARGET, action = "execute_campaign", campaign_id = %summary.campaign_id, selected = summary.selected, started = summary.started, completed = summary.completed, unmatched = summary.unmatched, not_started = summary.not_started, failed_inputs = summary.failed_inputs, cancelled = summary.cancelled, processors = ?summary.processors, started_at = %summary.started_at, finished_at = %summary.finished_at, "contextual decode replay completed with failures");
|
||||
if summary.unmatched > 0 || summary.failed_inputs > 0 || summary.processing_error_inputs > 0 {
|
||||
tracing::error!(target: crate::TRACING_TARGET, action = "execute_campaign", campaign_id = %summary.campaign_id, selected = summary.selected, started = summary.started, completed = summary.completed, unmatched = summary.unmatched, not_started = summary.not_started, failed_inputs = summary.failed_inputs, processing_error_inputs = summary.processing_error_inputs, cancelled = summary.cancelled, processors = ?summary.processors, started_at = %summary.started_at, finished_at = %summary.finished_at, "contextual decode replay completed with failures");
|
||||
} else if summary.cancelled {
|
||||
tracing::warn!(target: crate::TRACING_TARGET, action = "execute_campaign", campaign_id = %summary.campaign_id, selected = summary.selected, started = summary.started, completed = summary.completed, unmatched = summary.unmatched, not_started = summary.not_started, failed_inputs = summary.failed_inputs, cancelled = summary.cancelled, processors = ?summary.processors, started_at = %summary.started_at, finished_at = %summary.finished_at, "contextual decode replay cancelled");
|
||||
tracing::warn!(target: crate::TRACING_TARGET, action = "execute_campaign", campaign_id = %summary.campaign_id, selected = summary.selected, started = summary.started, completed = summary.completed, unmatched = summary.unmatched, not_started = summary.not_started, failed_inputs = summary.failed_inputs, processing_error_inputs = summary.processing_error_inputs, cancelled = summary.cancelled, processors = ?summary.processors, started_at = %summary.started_at, finished_at = %summary.finished_at, "contextual decode replay cancelled");
|
||||
} else {
|
||||
tracing::info!(target: crate::TRACING_TARGET, action = "execute_campaign", campaign_id = %summary.campaign_id, selected = summary.selected, started = summary.started, completed = summary.completed, unmatched = summary.unmatched, not_started = summary.not_started, failed_inputs = summary.failed_inputs, cancelled = summary.cancelled, processors = ?summary.processors, started_at = %summary.started_at, finished_at = %summary.finished_at, "contextual decode replay completed");
|
||||
tracing::info!(target: crate::TRACING_TARGET, action = "execute_campaign", campaign_id = %summary.campaign_id, selected = summary.selected, started = summary.started, completed = summary.completed, unmatched = summary.unmatched, not_started = summary.not_started, failed_inputs = summary.failed_inputs, processing_error_inputs = summary.processing_error_inputs, cancelled = summary.cancelled, processors = ?summary.processors, started_at = %summary.started_at, finished_at = %summary.finished_at, "contextual decode replay completed");
|
||||
}
|
||||
return std::result::Result::Ok(summary);
|
||||
}
|
||||
@@ -551,7 +561,8 @@ where
|
||||
program_id: input.program_id.clone(),
|
||||
started: false,
|
||||
unmatched: false,
|
||||
failed: false,
|
||||
decode_failed: false,
|
||||
processing_error: false,
|
||||
cancelled: true,
|
||||
processors: std::vec::Vec::new(),
|
||||
};
|
||||
@@ -566,7 +577,8 @@ where
|
||||
program_id: input.program_id.clone(),
|
||||
started: true,
|
||||
unmatched: true,
|
||||
failed: false,
|
||||
decode_failed: false,
|
||||
processing_error: false,
|
||||
cancelled: false,
|
||||
processors: std::vec::Vec::new(),
|
||||
};
|
||||
@@ -583,7 +595,8 @@ where
|
||||
.collect::<std::vec::Vec<_>>();
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "dispatch_input", campaign_id = %campaign_id, signature = %input.signature, slot = input.slot, instruction_path = %input.instruction_path, program_id = %input.program_id, dispatch_policy = ?request.dispatch_policy, selected_decoders = ?selected_decoder_identities, "dispatch contextual decode replay input");
|
||||
let mut processors = std::vec::Vec::new();
|
||||
let mut failed = false;
|
||||
let mut decode_failed = false;
|
||||
let mut processing_error = false;
|
||||
for ranked_decoder in selected {
|
||||
if observer.is_cancelled() {
|
||||
break;
|
||||
@@ -607,12 +620,12 @@ where
|
||||
std::result::Result::Ok(value) => {
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "invoke_decoder", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, program_id = %input.program_id, processor_name = %value.processor_name, processor_version = %value.processor_version, summary = ?value, "contextual instruction decoder completed");
|
||||
if value.failed > 0 {
|
||||
failed = true;
|
||||
decode_failed = true;
|
||||
}
|
||||
processors.push(value);
|
||||
},
|
||||
std::result::Result::Err(error) => {
|
||||
failed = true;
|
||||
processing_error = true;
|
||||
processors.push(crate::DecodeProcessorSummary {
|
||||
processor_name: ranked_decoder.identity.name.clone(),
|
||||
processor_version: ranked_decoder.identity.version.clone(),
|
||||
@@ -621,7 +634,8 @@ where
|
||||
decoded: 0,
|
||||
ignored: 0,
|
||||
unsupported: 0,
|
||||
failed: 1,
|
||||
failed: 0,
|
||||
processing_errors: 1,
|
||||
materialized_outputs: 0,
|
||||
materialization_refused: 0,
|
||||
});
|
||||
@@ -642,7 +656,7 @@ where
|
||||
}
|
||||
}
|
||||
let cancelled = observer.is_cancelled();
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "complete_input", campaign_id = %campaign_id, signature = %input.signature, slot = input.slot, instruction_path = %input.instruction_path, program_id = %input.program_id, failed, cancelled, processors = ?processors, "contextual decode replay input completed");
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "complete_input", campaign_id = %campaign_id, signature = %input.signature, slot = input.slot, instruction_path = %input.instruction_path, program_id = %input.program_id, decode_failed, processing_error, cancelled, processors = ?processors, "contextual decode replay input completed");
|
||||
return DecodeItemOutcome {
|
||||
signature: input.signature.clone(),
|
||||
slot: input.slot,
|
||||
@@ -650,7 +664,8 @@ where
|
||||
program_id: input.program_id.clone(),
|
||||
started: true,
|
||||
unmatched: false,
|
||||
failed,
|
||||
decode_failed,
|
||||
processing_error,
|
||||
cancelled,
|
||||
processors,
|
||||
};
|
||||
@@ -709,6 +724,7 @@ where
|
||||
ignored: 0,
|
||||
unsupported: 0,
|
||||
failed: 0,
|
||||
processing_errors: 0,
|
||||
materialized_outputs: 0,
|
||||
materialization_refused: 0,
|
||||
};
|
||||
@@ -1326,6 +1342,7 @@ fn merge_processor_summary(
|
||||
summary.ignored += value.ignored;
|
||||
summary.unsupported += value.unsupported;
|
||||
summary.failed += value.failed;
|
||||
summary.processing_errors += value.processing_errors;
|
||||
summary.materialized_outputs += value.materialized_outputs;
|
||||
summary.materialization_refused += value.materialization_refused;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user