This commit is contained in:
2026-05-13 11:17:53 +02:00
parent 69385094ff
commit 24d21818cf
23 changed files with 736 additions and 65 deletions

View File

@@ -65,14 +65,46 @@ pub struct LocalPipelineDiagnosticSummaryDto {
pub pool_count: i64,
/// Total known pairs.
pub pair_count: i64,
/// Stable explanation for legacy pair gap counters.
///
/// `pair_without_trade_count` and `pair_without_candle_count` are blocking
/// actionable gap counters, not literal catalog-wide counters.
pub pair_gap_counter_semantics: std::string::String,
/// Total pairs without any persisted trade event, including catalog-only and partial DEX pairs.
pub literal_pair_without_trade_count: i64,
/// Total pairs without any persisted candle, including catalog-only and partial DEX pairs.
pub literal_pair_without_candle_count: i64,
/// Total pairs that have at least one persisted trade event.
pub trade_materialized_pair_count: i64,
/// Total pairs that have at least one persisted candle bucket.
pub candle_materialized_pair_count: i64,
/// Total pairs with at least one successful decoded trade candidate.
pub actionable_pair_count: i64,
/// Total distinct candle timeframes currently materialized.
pub candle_bucket_timeframe_count: i64,
/// Whether candle rows are bucketed aggregates rather than one row per trade.
pub candles_are_bucketed: bool,
/// Total pairs without trade event among actionable successful trade candidates.
pub blocking_pair_without_trade_count: i64,
/// Total pairs without candle among actionable successful candle candidates.
pub blocking_pair_without_candle_count: i64,
/// Total pairs without trade event.
///
/// Legacy alias kept for compatibility. It has the same semantics as
/// `blocking_pair_without_trade_count`.
pub pair_without_trade_count: i64,
/// Total pairs without candle.
///
/// Legacy alias kept for compatibility. It has the same semantics as
/// `blocking_pair_without_candle_count`.
pub pair_without_candle_count: i64,
/// Diagnostics grouped by DEX.
pub dex_summaries: std::vec::Vec<crate::LocalDexDiagnosticSummaryDto>,
/// Diagnostics grouped by pair.
pub pair_summaries: std::vec::Vec<crate::LocalPairDiagnosticSummaryDto>,
/// Diagnostics grouped by pair materialization/actionability class.
pub pair_actionability_summaries:
std::vec::Vec<crate::LocalPairActionabilityDiagnosticSummaryDto>,
/// Diagnostics grouped by decoded event kind.
pub decoded_event_summaries: std::vec::Vec<crate::LocalDecodedEventDiagnosticSummaryDto>,
/// Diagnostics grouped by decoded event category, lifecycle kind and actionability.
@@ -157,6 +189,27 @@ pub struct LocalPairDiagnosticSummaryDto {
pub last_price_quote_per_base: std::option::Option<f64>,
}
/// Local pair diagnostics grouped by materialization/actionability class.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct LocalPairActionabilityDiagnosticSummaryDto {
/// Pair actionability or materialization class.
pub pair_actionability: std::string::String,
/// Total pairs in this class.
pub pair_count: i64,
/// Total decoded events attached to pairs in this class.
pub decoded_event_count: i64,
/// Total decoded trade candidates attached to pairs in this class.
pub decoded_trade_candidate_count: i64,
/// Total decoded trade candidates on successful transactions attached to pairs in this class.
pub actionable_trade_candidate_count: i64,
/// Total decoded trade candidates on failed transactions attached to pairs in this class.
pub failed_trade_candidate_count: i64,
/// Total persisted trade events attached to pairs in this class.
pub trade_event_count: i64,
/// Total persisted candle buckets attached to pairs in this class.
pub pair_candle_count: i64,
}
/// Local decoded-event diagnostics summary.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct LocalDecodedEventDiagnosticSummaryDto {
@@ -314,8 +367,24 @@ pub struct LocalPipelineDiagnosticCountersDto {
pub pool_count: i64,
/// Total known pairs.
pub pair_count: i64,
/// Total pairs without any persisted trade event, including catalog-only and partial DEX pairs.
pub literal_pair_without_trade_count: i64,
/// Total pairs without any persisted candle, including catalog-only and partial DEX pairs.
pub literal_pair_without_candle_count: i64,
/// Total pairs that have at least one persisted trade event.
pub trade_materialized_pair_count: i64,
/// Total pairs that have at least one persisted candle bucket.
pub candle_materialized_pair_count: i64,
/// Total pairs with at least one successful decoded trade candidate.
pub actionable_pair_count: i64,
/// Total distinct candle timeframes currently materialized.
pub candle_bucket_timeframe_count: i64,
/// Total pairs with only non-actionable missing trade events.
pub non_actionable_pair_count: i64,
/// Total pairs without trade among actionable successful trade candidates.
pub blocking_pair_without_trade_count: i64,
/// Total pairs without candle among actionable successful candle candidates.
pub blocking_pair_without_candle_count: i64,
/// Total pairs without trade.
pub pair_without_trade_count: i64,
/// Total pairs without candle.
@@ -351,7 +420,15 @@ pub(crate) struct LocalPipelineDiagnosticCountersRow {
pub(crate) token_metadata_missing_count: i64,
pub(crate) pool_count: i64,
pub(crate) pair_count: i64,
pub(crate) literal_pair_without_trade_count: i64,
pub(crate) literal_pair_without_candle_count: i64,
pub(crate) trade_materialized_pair_count: i64,
pub(crate) candle_materialized_pair_count: i64,
pub(crate) actionable_pair_count: i64,
pub(crate) candle_bucket_timeframe_count: i64,
pub(crate) non_actionable_pair_count: i64,
pub(crate) blocking_pair_without_trade_count: i64,
pub(crate) blocking_pair_without_candle_count: i64,
pub(crate) pair_without_trade_count: i64,
pub(crate) pair_without_candle_count: i64,
}
@@ -389,6 +466,19 @@ pub(crate) struct LocalPairDiagnosticSummaryRow {
pub(crate) last_price_quote_per_base: std::option::Option<f64>,
}
/// SQL row for local pair actionability diagnostics.
#[derive(Debug, Clone, sqlx::FromRow)]
pub(crate) struct LocalPairActionabilityDiagnosticSummaryRow {
pub(crate) pair_actionability: std::string::String,
pub(crate) pair_count: i64,
pub(crate) decoded_event_count: i64,
pub(crate) decoded_trade_candidate_count: i64,
pub(crate) actionable_trade_candidate_count: i64,
pub(crate) failed_trade_candidate_count: i64,
pub(crate) trade_event_count: i64,
pub(crate) pair_candle_count: i64,
}
/// SQL row for local decoded-event diagnostics.
#[derive(Debug, Clone, sqlx::FromRow)]
pub(crate) struct LocalDecodedEventDiagnosticSummaryRow {