Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update price estimate categories #3256

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

bram-vdberg
Copy link

@bram-vdberg bram-vdberg commented Jan 29, 2025

Description

This PR updates the price estimate categories to return the error reason on a failing price estimate.

Changes

  • Add error reasons from PriceEstimationError to the result for increased visibility on price estimation error reasons
  • Updated unit tests to include new labels

How to test

Copy link

github-actions bot commented Jan 29, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@bram-vdberg
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@bram-vdberg bram-vdberg marked this pull request as ready for review January 29, 2025 17:11
@bram-vdberg bram-vdberg requested a review from a team as a code owner January 29, 2025 17:11
@squadgazzz
Copy link
Contributor

What is the main purpose of this PR? Do you want a better observation on Grafana panels? I think this PR doesn't change anything else.

@bram-vdberg
Copy link
Author

What is the main purpose of this PR? Do you want a better observation on Grafana panels? I think this PR doesn't change anything else.

Yes, we're setting up a Grafana dashboard for the quoting competition. Hopefully this will help us to visualize the failing quotes a bit better. I think we also want to show the driver errors, but I'll do that in a follow up PR.

} else {
"failure"
match estimate {
Ok(_) | Err(PriceEstimationError::NoLiquidity) => "success",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the intention of this PR is to expose a helpful dashboard for solver about their quoting performance I think it makes more sense to have a separate label for NoLiquidity and adjust grafana queries that currently use success to use success|no_liqudity going forward.

Comment on lines +50 to +51
Err(PriceEstimationError::EstimatorInternal(_)) => "estimator_internal_error",
Err(PriceEstimationError::ProtocolInternal(_)) => "protocol_internal_error",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 errors should be adjusted in a follow up PR to contain specific error conditions and not a catch all error like anyhow::Error so that we can match on them here and plot more helpful data.

let _ = instrumented.estimate(queries[0].clone()).await;
let _ = instrumented.estimate(queries[1].clone()).await;
for i in 0..7 {
let query = if i % 2 == 0 { &queries[0] } else { &queries[1] };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternating between the sell and the buy order query seems odd and leads to clunky code. I think we could also just have 1 query we use for all these cases instead of alternating between 2.

crates/shared/src/price_estimation/instrumented.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants