Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/autopilot/src/domain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ pub struct Metrics {
/// Tracks settlements that couldn't be matched to the database solutions.
#[metric(labels("solver_address"))]
pub inconsistent_settlements: prometheus::IntCounterVec,

/// Tracks trades whose surplus, fee or fee breakdown calculation failed
/// and fell back to zeroed values.
#[metric(labels("kind"))]
pub settlement_math_errors: prometheus::IntCounterVec,
Comment thread
squadgazzz marked this conversation as resolved.
}

impl Metrics {
Expand Down
12 changes: 12 additions & 0 deletions crates/autopilot/src/domain/settlement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ impl Settlement {
trade = %trade.uid(),
"possible incomplete surplus calculation",
);
Metrics::get()
.settlement_math_errors
.with_label_values(&["surplus"])
.inc();
num::zero()
});
surplus = surplus + trade_surplus;
Expand All @@ -118,6 +122,10 @@ impl Settlement {
trade = %trade.uid(),
"possible incomplete fee calculation",
);
Metrics::get()
.settlement_math_errors
.with_label_values(&["fee"])
.inc();
num::zero()
});
fee = fee + trade_fee;
Expand All @@ -128,6 +136,10 @@ impl Settlement {
trade = %trade.uid(),
"possible incomplete fee breakdown calculation",
);
Metrics::get()
.settlement_math_errors
.with_label_values(&["fee_breakdown"])
.inc();
trade::FeeBreakdown {
total: eth::Asset {
token: trade.sell_token(),
Expand Down
Loading