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

Rename & add some more tags to stats #1715

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
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
24 changes: 18 additions & 6 deletions indexer/services/roundtable/src/tasks/uncross-orderbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ async function uncrossOrderbook(
market: PerpetualMarketFromDatabase,
orderbookLevels: OrderbookLevels,
): Promise<void> {
console.log(`orderbookLevels: ${JSON.stringify(orderbookLevels)}`);
const ticker = market.ticker;

// Remove overlapping levels
Expand Down Expand Up @@ -92,7 +91,7 @@ async function uncrossOrderbook(
stats.increment(
`${config.SERVICE_NAME}.expected_uncross_orderbook_levels`,
removeBidLevels.length,
{ side: OrderSide.BUY },
{ side: OrderSide.BUY, clobPairId: market.clobPairId, ticker },
);
for (const bid of removeBidLevels) {
const deleted: boolean = await OrderbookLevelsCache.deleteStalePriceLevel({
Expand All @@ -119,17 +118,23 @@ async function uncrossOrderbook(
ticker,
});
} else {
stats.increment(`${config.SERVICE_NAME}.uncross_orderbook`, { side: OrderSide.BUY });
stats.increment(
`${config.SERVICE_NAME}.uncross_orderbook_succeed`,
{
side: OrderSide.BUY,
clobPairId: market.clobPairId,
ticker,
},
);
}
}

stats.increment(
`${config.SERVICE_NAME}.expected_uncross_orderbook_levels`,
removeAskLevels.length,
{ side: OrderSide.SELL },
{ side: OrderSide.SELL, clobPairId: market.clobPairId, ticker },
);
for (const ask of removeAskLevels) {
stats.increment(`${config.SERVICE_NAME}.uncross_orderbook`, { side: OrderSide.SELL });
const deleted: boolean = await OrderbookLevelsCache.deleteStalePriceLevel({
ticker,
side: OrderSide.SELL,
Expand All @@ -154,7 +159,14 @@ async function uncrossOrderbook(
ticker,
});
} else {
stats.increment(`${config.SERVICE_NAME}.uncross_orderbook`, { side: OrderSide.SELL });
stats.increment(
`${config.SERVICE_NAME}.uncross_orderbook_succeed`,
{
side: OrderSide.SELL,
clobPairId: market.clobPairId,
ticker,
},
);
}
}
}
Loading