0.7.27 +Refactor
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
/// Local pipeline diagnostics summary.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalPipelineDiagnosticSummaryDto {
|
||||
pub struct LocalPipelineDiagnosticSummaryDto {
|
||||
/// Total persisted chain transactions.
|
||||
pub transaction_count: i64,
|
||||
/// Total successful chain transactions.
|
||||
@@ -64,29 +64,37 @@ pub struct KbLocalPipelineDiagnosticSummaryDto {
|
||||
/// Total pairs without candle.
|
||||
pub pair_without_candle_count: i64,
|
||||
/// Diagnostics grouped by DEX.
|
||||
pub dex_summaries: std::vec::Vec<crate::KbLocalDexDiagnosticSummaryDto>,
|
||||
pub dex_summaries: std::vec::Vec<crate::LocalDexDiagnosticSummaryDto>,
|
||||
/// Diagnostics grouped by pair.
|
||||
pub pair_summaries: std::vec::Vec<crate::KbLocalPairDiagnosticSummaryDto>,
|
||||
pub pair_summaries: std::vec::Vec<crate::LocalPairDiagnosticSummaryDto>,
|
||||
/// Diagnostics grouped by decoded event kind.
|
||||
pub decoded_event_summaries: std::vec::Vec<crate::KbLocalDecodedEventDiagnosticSummaryDto>,
|
||||
pub decoded_event_summaries: std::vec::Vec<crate::LocalDecodedEventDiagnosticSummaryDto>,
|
||||
/// Missing trade events grouped by diagnostic reason.
|
||||
pub missing_trade_event_reason_summaries:
|
||||
std::vec::Vec<crate::LocalMissingTradeEventReasonSummaryDto>,
|
||||
/// Total pairs with only non-actionable missing trade events.
|
||||
pub non_actionable_pair_count: i64,
|
||||
/// Pair summaries for non-actionable missing trade events.
|
||||
pub non_actionable_pair_summaries:
|
||||
std::vec::Vec<crate::LocalNonActionablePairDiagnosticSummaryDto>,
|
||||
/// Samples of decoded trade candidates without linked trade event.
|
||||
pub missing_trade_event_samples:
|
||||
std::vec::Vec<crate::KbLocalMissingTradeEventDiagnosticSampleDto>,
|
||||
std::vec::Vec<crate::LocalMissingTradeEventDiagnosticSampleDto>,
|
||||
/// Samples of duplicated trade rows by decoded event id.
|
||||
pub duplicate_decoded_event_trade_samples:
|
||||
std::vec::Vec<crate::KbLocalDuplicateDecodedEventTradeDiagnosticSampleDto>,
|
||||
std::vec::Vec<crate::LocalDuplicateDecodedEventTradeDiagnosticSampleDto>,
|
||||
/// Samples of multi-trade signature/pair groups.
|
||||
pub multi_trade_signature_pair_samples:
|
||||
std::vec::Vec<crate::KbLocalMultiTradeSignaturePairDiagnosticSampleDto>,
|
||||
std::vec::Vec<crate::LocalMultiTradeSignaturePairDiagnosticSampleDto>,
|
||||
/// Samples of pairs without trade.
|
||||
pub pair_without_trade_samples: std::vec::Vec<crate::KbLocalPairGapDiagnosticSampleDto>,
|
||||
pub pair_without_trade_samples: std::vec::Vec<crate::LocalPairGapDiagnosticSampleDto>,
|
||||
/// Samples of pairs without candle.
|
||||
pub pair_without_candle_samples: std::vec::Vec<crate::KbLocalPairGapDiagnosticSampleDto>,
|
||||
pub pair_without_candle_samples: std::vec::Vec<crate::LocalPairGapDiagnosticSampleDto>,
|
||||
}
|
||||
|
||||
/// Local DEX diagnostics summary.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalDexDiagnosticSummaryDto {
|
||||
pub struct LocalDexDiagnosticSummaryDto {
|
||||
/// DEX code or protocol name.
|
||||
pub dex_code: std::string::String,
|
||||
/// Total known pools for this DEX.
|
||||
@@ -107,7 +115,7 @@ pub struct KbLocalDexDiagnosticSummaryDto {
|
||||
|
||||
/// Local pair diagnostics summary.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalPairDiagnosticSummaryDto {
|
||||
pub struct LocalPairDiagnosticSummaryDto {
|
||||
/// Pair id.
|
||||
pub pair_id: i64,
|
||||
/// Pool address.
|
||||
@@ -142,7 +150,7 @@ pub struct KbLocalPairDiagnosticSummaryDto {
|
||||
|
||||
/// Local decoded-event diagnostics summary.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalDecodedEventDiagnosticSummaryDto {
|
||||
pub struct LocalDecodedEventDiagnosticSummaryDto {
|
||||
/// Protocol name.
|
||||
pub protocol_name: std::string::String,
|
||||
/// Event kind.
|
||||
@@ -159,9 +167,65 @@ pub struct KbLocalDecodedEventDiagnosticSummaryDto {
|
||||
pub trade_event_count: i64,
|
||||
}
|
||||
|
||||
/// Missing trade event diagnostics grouped by reason.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct LocalMissingTradeEventReasonSummaryDto {
|
||||
/// Diagnostic reason.
|
||||
pub reason: std::string::String,
|
||||
/// Whether grouped source transactions failed.
|
||||
pub transaction_failed: bool,
|
||||
/// Whether grouped missing trade events are actionable.
|
||||
pub actionable: bool,
|
||||
/// Total missing trade events in this group.
|
||||
pub event_count: i64,
|
||||
/// Total events in this group with an explicit base amount payload.
|
||||
pub has_base_amount_payload_count: i64,
|
||||
/// Total events in this group with an explicit quote amount payload.
|
||||
pub has_quote_amount_payload_count: i64,
|
||||
/// Total events in this group with an explicit price payload.
|
||||
pub has_price_payload_count: i64,
|
||||
}
|
||||
|
||||
/// Local pair diagnostics for pairs whose missing trade events are non-actionable.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct LocalNonActionablePairDiagnosticSummaryDto {
|
||||
/// Pair id.
|
||||
pub pair_id: i64,
|
||||
/// Pool address.
|
||||
pub pool_address: std::string::String,
|
||||
/// DEX code.
|
||||
pub dex_code: std::string::String,
|
||||
/// Base token mint.
|
||||
pub base_mint: std::string::String,
|
||||
/// Base token symbol.
|
||||
pub base_symbol: std::option::Option<std::string::String>,
|
||||
/// Quote token mint.
|
||||
pub quote_mint: std::string::String,
|
||||
/// Quote token symbol.
|
||||
pub quote_symbol: std::option::Option<std::string::String>,
|
||||
/// Pair symbol.
|
||||
pub pair_symbol: std::option::Option<std::string::String>,
|
||||
/// Total decoded trade candidates attached to the pool.
|
||||
pub decoded_trade_candidate_count: i64,
|
||||
/// Total non-actionable missing trade events attached to the pair.
|
||||
pub non_actionable_missing_trade_event_count: i64,
|
||||
/// Total missing trade candidates caused by failed transactions.
|
||||
pub failed_transaction_candidate_count: i64,
|
||||
/// Total successful missing trade candidates without token mints.
|
||||
pub ok_transaction_without_token_mints_count: i64,
|
||||
/// Total successful missing trade candidates without amount payload.
|
||||
pub ok_transaction_without_amount_payload_count: i64,
|
||||
/// Distinct non-actionable diagnostic reasons seen for this pair.
|
||||
pub reason_summary: std::option::Option<std::string::String>,
|
||||
/// Total trade events attached to the pair.
|
||||
pub trade_event_count: i64,
|
||||
/// Total candle buckets attached to the pair.
|
||||
pub pair_candle_count: i64,
|
||||
}
|
||||
|
||||
/// Internal flat counter row for local diagnostics.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KbLocalPipelineDiagnosticCountersDto {
|
||||
pub struct LocalPipelineDiagnosticCountersDto {
|
||||
/// Total persisted chain transactions.
|
||||
pub transaction_count: i64,
|
||||
/// Total successful chain transactions.
|
||||
@@ -208,6 +272,8 @@ pub struct KbLocalPipelineDiagnosticCountersDto {
|
||||
pub pool_count: i64,
|
||||
/// Total known pairs.
|
||||
pub pair_count: i64,
|
||||
/// Total pairs with only non-actionable missing trade events.
|
||||
pub non_actionable_pair_count: i64,
|
||||
/// Total pairs without trade.
|
||||
pub pair_without_trade_count: i64,
|
||||
/// Total pairs without candle.
|
||||
@@ -216,7 +282,7 @@ pub struct KbLocalPipelineDiagnosticCountersDto {
|
||||
|
||||
/// SQL row for global local pipeline diagnostic counters.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalPipelineDiagnosticCountersRow {
|
||||
pub(crate) struct LocalPipelineDiagnosticCountersRow {
|
||||
pub(crate) transaction_count: i64,
|
||||
pub(crate) ok_transaction_count: i64,
|
||||
pub(crate) failed_transaction_count: i64,
|
||||
@@ -240,13 +306,14 @@ pub(crate) struct KbLocalPipelineDiagnosticCountersRow {
|
||||
pub(crate) token_metadata_missing_count: i64,
|
||||
pub(crate) pool_count: i64,
|
||||
pub(crate) pair_count: i64,
|
||||
pub(crate) non_actionable_pair_count: i64,
|
||||
pub(crate) pair_without_trade_count: i64,
|
||||
pub(crate) pair_without_candle_count: i64,
|
||||
}
|
||||
|
||||
/// SQL row for local DEX diagnostics.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalDexDiagnosticSummaryRow {
|
||||
pub(crate) struct LocalDexDiagnosticSummaryRow {
|
||||
pub(crate) dex_code: std::string::String,
|
||||
pub(crate) pool_count: i64,
|
||||
pub(crate) pair_count: i64,
|
||||
@@ -259,7 +326,7 @@ pub(crate) struct KbLocalDexDiagnosticSummaryRow {
|
||||
|
||||
/// SQL row for local pair diagnostics.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalPairDiagnosticSummaryRow {
|
||||
pub(crate) struct LocalPairDiagnosticSummaryRow {
|
||||
pub(crate) pair_id: i64,
|
||||
pub(crate) pool_address: std::string::String,
|
||||
pub(crate) dex_code: std::string::String,
|
||||
@@ -279,7 +346,7 @@ pub(crate) struct KbLocalPairDiagnosticSummaryRow {
|
||||
|
||||
/// SQL row for local decoded-event diagnostics.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalDecodedEventDiagnosticSummaryRow {
|
||||
pub(crate) struct LocalDecodedEventDiagnosticSummaryRow {
|
||||
pub(crate) protocol_name: std::string::String,
|
||||
pub(crate) event_kind: std::string::String,
|
||||
pub(crate) event_category: std::option::Option<std::string::String>,
|
||||
@@ -291,7 +358,7 @@ pub(crate) struct KbLocalDecodedEventDiagnosticSummaryRow {
|
||||
|
||||
/// Sample of a decoded trade candidate without linked trade event.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalMissingTradeEventDiagnosticSampleDto {
|
||||
pub struct LocalMissingTradeEventDiagnosticSampleDto {
|
||||
/// Decoded event id.
|
||||
pub decoded_event_id: i64,
|
||||
/// Chain transaction id.
|
||||
@@ -306,6 +373,14 @@ pub struct KbLocalMissingTradeEventDiagnosticSampleDto {
|
||||
pub pool_account: std::option::Option<std::string::String>,
|
||||
/// Whether the source transaction failed.
|
||||
pub transaction_failed: bool,
|
||||
/// Whether this missing trade event is actionable for validation.
|
||||
///
|
||||
/// A missing trade event is actionable only when the source transaction
|
||||
/// succeeded, the decoded event has a pool account and both token mints,
|
||||
/// and the pool is already attached to a known pair. Failed transactions
|
||||
/// and incomplete decoded hints remain visible as samples, but they should
|
||||
/// not block the non-regression profile.
|
||||
pub actionable: bool,
|
||||
/// Diagnostic reason explaining why no trade event was linked.
|
||||
pub reason: std::string::String,
|
||||
/// Whether payload has an explicit base amount.
|
||||
@@ -318,7 +393,7 @@ pub struct KbLocalMissingTradeEventDiagnosticSampleDto {
|
||||
|
||||
/// Sample of duplicated trade rows grouped by decoded event id.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalDuplicateDecodedEventTradeDiagnosticSampleDto {
|
||||
pub struct LocalDuplicateDecodedEventTradeDiagnosticSampleDto {
|
||||
/// Decoded event id.
|
||||
pub decoded_event_id: i64,
|
||||
/// Protocol name.
|
||||
@@ -337,7 +412,7 @@ pub struct KbLocalDuplicateDecodedEventTradeDiagnosticSampleDto {
|
||||
|
||||
/// Sample of multi-trade groups sharing the same signature and pair id.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalMultiTradeSignaturePairDiagnosticSampleDto {
|
||||
pub struct LocalMultiTradeSignaturePairDiagnosticSampleDto {
|
||||
/// Transaction signature.
|
||||
pub signature: std::string::String,
|
||||
/// Pair id.
|
||||
@@ -358,7 +433,7 @@ pub struct KbLocalMultiTradeSignaturePairDiagnosticSampleDto {
|
||||
|
||||
/// Sample of a pair gap.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbLocalPairGapDiagnosticSampleDto {
|
||||
pub struct LocalPairGapDiagnosticSampleDto {
|
||||
/// Pair id.
|
||||
pub pair_id: i64,
|
||||
/// Pool address.
|
||||
@@ -385,9 +460,42 @@ pub struct KbLocalPairGapDiagnosticSampleDto {
|
||||
pub pair_candle_count: i64,
|
||||
}
|
||||
|
||||
/// SQL row for missing trade event reason summaries.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct LocalMissingTradeEventReasonSummaryRow {
|
||||
pub(crate) reason: std::string::String,
|
||||
pub(crate) transaction_failed: i64,
|
||||
pub(crate) actionable: i64,
|
||||
pub(crate) event_count: i64,
|
||||
pub(crate) has_base_amount_payload_count: i64,
|
||||
pub(crate) has_quote_amount_payload_count: i64,
|
||||
pub(crate) has_price_payload_count: i64,
|
||||
}
|
||||
|
||||
/// SQL row for non-actionable pair diagnostic summaries.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct LocalNonActionablePairDiagnosticSummaryRow {
|
||||
pub(crate) pair_id: i64,
|
||||
pub(crate) pool_address: std::string::String,
|
||||
pub(crate) dex_code: std::string::String,
|
||||
pub(crate) base_mint: std::string::String,
|
||||
pub(crate) base_symbol: std::option::Option<std::string::String>,
|
||||
pub(crate) quote_mint: std::string::String,
|
||||
pub(crate) quote_symbol: std::option::Option<std::string::String>,
|
||||
pub(crate) pair_symbol: std::option::Option<std::string::String>,
|
||||
pub(crate) decoded_trade_candidate_count: i64,
|
||||
pub(crate) non_actionable_missing_trade_event_count: i64,
|
||||
pub(crate) failed_transaction_candidate_count: i64,
|
||||
pub(crate) ok_transaction_without_token_mints_count: i64,
|
||||
pub(crate) ok_transaction_without_amount_payload_count: i64,
|
||||
pub(crate) reason_summary: std::option::Option<std::string::String>,
|
||||
pub(crate) trade_event_count: i64,
|
||||
pub(crate) pair_candle_count: i64,
|
||||
}
|
||||
|
||||
/// SQL row for missing trade event samples.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalMissingTradeEventDiagnosticSampleRow {
|
||||
pub(crate) struct LocalMissingTradeEventDiagnosticSampleRow {
|
||||
pub(crate) decoded_event_id: i64,
|
||||
pub(crate) transaction_id: std::option::Option<i64>,
|
||||
pub(crate) signature: std::option::Option<std::string::String>,
|
||||
@@ -395,6 +503,7 @@ pub(crate) struct KbLocalMissingTradeEventDiagnosticSampleRow {
|
||||
pub(crate) event_kind: std::string::String,
|
||||
pub(crate) pool_account: std::option::Option<std::string::String>,
|
||||
pub(crate) transaction_failed: i64,
|
||||
pub(crate) actionable: i64,
|
||||
pub(crate) reason: std::string::String,
|
||||
pub(crate) has_base_amount_payload: i64,
|
||||
pub(crate) has_quote_amount_payload: i64,
|
||||
@@ -403,7 +512,7 @@ pub(crate) struct KbLocalMissingTradeEventDiagnosticSampleRow {
|
||||
|
||||
/// SQL row for duplicated decoded event trade samples.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalDuplicateDecodedEventTradeDiagnosticSampleRow {
|
||||
pub(crate) struct LocalDuplicateDecodedEventTradeDiagnosticSampleRow {
|
||||
pub(crate) decoded_event_id: i64,
|
||||
pub(crate) protocol_name: std::option::Option<std::string::String>,
|
||||
pub(crate) event_kind: std::option::Option<std::string::String>,
|
||||
@@ -415,7 +524,7 @@ pub(crate) struct KbLocalDuplicateDecodedEventTradeDiagnosticSampleRow {
|
||||
|
||||
/// SQL row for multi-trade signature/pair samples.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalMultiTradeSignaturePairDiagnosticSampleRow {
|
||||
pub(crate) struct LocalMultiTradeSignaturePairDiagnosticSampleRow {
|
||||
pub(crate) signature: std::string::String,
|
||||
pub(crate) pair_id: i64,
|
||||
pub(crate) pool_address: std::option::Option<std::string::String>,
|
||||
@@ -428,7 +537,7 @@ pub(crate) struct KbLocalMultiTradeSignaturePairDiagnosticSampleRow {
|
||||
|
||||
/// SQL row for pair gap samples.
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
pub(crate) struct KbLocalPairGapDiagnosticSampleRow {
|
||||
pub(crate) struct LocalPairGapDiagnosticSampleRow {
|
||||
pub(crate) pair_id: i64,
|
||||
pub(crate) pool_address: std::string::String,
|
||||
pub(crate) dex_code: std::string::String,
|
||||
|
||||
Reference in New Issue
Block a user