diff --git a/indexer/services/ender/__tests__/handlers/order-fills/deleveraging-handler.test.ts b/indexer/services/ender/__tests__/handlers/order-fills/deleveraging-handler.test.ts index 8c06ba595b..2d93a8a683 100644 --- a/indexer/services/ender/__tests__/handlers/order-fills/deleveraging-handler.test.ts +++ b/indexer/services/ender/__tests__/handlers/order-fills/deleveraging-handler.test.ts @@ -1,4 +1,4 @@ -import { logger } from '@dydxprotocol-indexer/base'; +import { logger, stats } from '@dydxprotocol-indexer/base'; import { redis } from '@dydxprotocol-indexer/redis'; import { assetRefresher, @@ -73,6 +73,9 @@ describe('DeleveragingHandler', () => { beforeAll(async () => { await dbHelpers.migrate(); await createPostgresFunctions(); + jest.spyOn(stats, 'increment'); + jest.spyOn(stats, 'timing'); + jest.spyOn(stats, 'gauge'); }); beforeEach(async () => { @@ -315,6 +318,7 @@ describe('DeleveragingHandler', () => { producerSendMock, eventId, ), + expectTimingStats(), ]); }); @@ -345,3 +349,14 @@ describe('DeleveragingHandler', () => { ); } }); + +function expectTimingStats() { + expect(stats.timing).toHaveBeenCalledWith( + 'ender.handle_event.timing', + expect.any(Number), + { + className: 'DeleveragingHandler', + eventType: 'DeleveragingEvent', + }, + ); +} diff --git a/indexer/services/ender/__tests__/handlers/order-fills/liquidation-handler.test.ts b/indexer/services/ender/__tests__/handlers/order-fills/liquidation-handler.test.ts index 1b7f3ddb0f..0c468398eb 100644 --- a/indexer/services/ender/__tests__/handlers/order-fills/liquidation-handler.test.ts +++ b/indexer/services/ender/__tests__/handlers/order-fills/liquidation-handler.test.ts @@ -1,4 +1,4 @@ -import { logger } from '@dydxprotocol-indexer/base'; +import { logger, stats } from '@dydxprotocol-indexer/base'; import { IndexerTendermintBlock, IndexerTendermintEvent, Timestamp, LiquidationOrderV1, @@ -89,6 +89,9 @@ describe('LiquidationHandler', () => { beforeAll(async () => { await dbHelpers.migrate(); await createPostgresFunctions(); + jest.spyOn(stats, 'increment'); + jest.spyOn(stats, 'timing'); + jest.spyOn(stats, 'gauge'); }); beforeEach(async () => { @@ -976,6 +979,7 @@ describe('LiquidationHandler', () => { OrderTable.orderIdToUuid(makerOrderProto.orderId!), orderFillEvent.totalFilledMaker.toString(), ), + expectTimingStats(), ]); }); @@ -1196,3 +1200,14 @@ async function expectNoCandles() { const candles: CandleFromDatabase[] = await CandleTable.findAll({}, []); expect(candles.length).toEqual(0); } + +function expectTimingStats() { + expect(stats.timing).toHaveBeenCalledWith( + 'ender.handle_event.timing', + expect.any(Number), + { + className: 'LiquidationHandler', + eventType: 'LiquidationEvent', + }, + ); +} diff --git a/indexer/services/ender/src/handlers/order-fills/liquidation-handler.ts b/indexer/services/ender/src/handlers/order-fills/liquidation-handler.ts index 4b9b7efb99..dc45599bea 100644 --- a/indexer/services/ender/src/handlers/order-fills/liquidation-handler.ts +++ b/indexer/services/ender/src/handlers/order-fills/liquidation-handler.ts @@ -34,7 +34,7 @@ import { import { AbstractOrderFillHandler } from './abstract-order-fill-handler'; export class LiquidationHandler extends AbstractOrderFillHandler { - eventType: string = 'OrderFillEvent'; + eventType: string = 'LiquidationEvent'; /** * @returns the parallelizationIds for the this.event.liquidity order