Skip to content

Commit

Permalink
[Trivial] Record mempool submission metrics in driver (#2127)
Browse files Browse the repository at this point in the history
# Description
Needed to replace this
[alert](https://cowservices.slack.com/archives/C036ZGSCJNP/p1701783487316099)

Note, that this doesn't include information about the solver that is
submitting the solution. I don't think this is necessarily required, so
I didn't add it.
  • Loading branch information
fleupold authored Dec 7, 2023
1 parent 4f2bc3e commit 4ef426b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/driver/src/infra/observe/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pub struct Metrics {
/// The results of the quoting process.
#[metric(labels("solver", "result"))]
pub quotes: prometheus::IntCounterVec,
/// The results of the mempool submission.
#[metric(labels("mempool", "result"))]
pub mempool_submission: prometheus::IntCounterVec,
}

/// Setup the metrics registry.
Expand Down
9 changes: 9 additions & 0 deletions crates/driver/src/infra/observe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,15 @@ pub fn mempool_executed(
);
}
}
let result = match res {
Ok(_) => "Success",
Err(mempools::Error::Revert(_) | mempools::Error::SimulationRevert) => "Revert",
Err(mempools::Error::Other(_)) => "Other",
};
metrics::get()
.mempool_submission
.with_label_values(&[&mempool.to_string(), result])
.inc();
}

/// Observe that an invalid DTO was received.
Expand Down

0 comments on commit 4ef426b

Please sign in to comment.