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

Fix metrics and observations in autopilot runloop #3039

Merged
merged 6 commits into from
Oct 8, 2024
Merged

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented Oct 4, 2024

Description

This PR addresses several smaller issues related to metrics in the autopilot run loop and refactors functions in preparation for #2996 (comment).

Changes

  • Self::is_solution_fair is now checked for every solution, not just for the global winner (fixing an oversight in PR #2996)
  • Updated the "matched but unsettled" metric to include all winners, not just the global winner (fixing another oversight from PR #2996).
  • Reorganized logs and order status updates to facilitate extracting common functionality between shadow and main competitions (to be addressed in follow-up work).

Next step: refactor competition function from shadow and main runloop to be exactly the same and unify the Participant struct (currently both modes have their own version).

How to test

Existing e2e tests

@sunce86 sunce86 added bug Something isn't working E:6.2 Time to Happy Moo See https://github.com/cowprotocol/pm/issues/77 for details labels Oct 4, 2024
@sunce86 sunce86 self-assigned this Oct 4, 2024
@sunce86 sunce86 requested a review from a team as a code owner October 4, 2024 11:30
@sunce86 sunce86 changed the title Fix metrics and observations in autopilot runloop [ON HOLD] Fix metrics and observations in autopilot runloop Oct 4, 2024
@sunce86 sunce86 changed the title [ON HOLD] Fix metrics and observations in autopilot runloop Fix metrics and observations in autopilot runloop Oct 4, 2024
Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Looks good overall. Just 2 nits.

// Report orders that were part of a non-winning solution candidate
// but only if they were part of the auction (filter out jit orders)
non_winning_orders.retain(|uid| auction_uids.contains(uid));
super::Metrics::matched_unsettled(&winner.driver, non_winning_orders);
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 we prepare for having multiple winners I'm not sure if recording the global winner still makes sense here. Ultimately it's not the global winner's responsibility to settle all possible orders.

I'm even not sure if this information is so helpful in the single winner setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wondered the same, so ended up leaving it this way as having the list of non-winning orders might still be useful to observe, although the driver itself is not that important anymore I guess. I think we can reevaluate after some time and probably remove it if not needed.

crates/autopilot/src/run_loop.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

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

LGTM

@sunce86 sunce86 enabled auto-merge (squash) October 8, 2024 07:51
@sunce86 sunce86 merged commit b020020 into main Oct 8, 2024
11 checks passed
@sunce86 sunce86 deleted the autopilot-refactor-1 branch October 8, 2024 07:52
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working E:6.2 Time to Happy Moo See https://github.com/cowprotocol/pm/issues/77 for details
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants