Skip to content

Commit

Permalink
Add more channel stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Inkvi committed Mar 21, 2024
1 parent 3c9bf9c commit bd7b0d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ async function openIbcChannel<name extends Virtual.EventNames<config>>(event: Vi
state: state,
}
})
await updateStats(context.db.Stat, StatName.OpenIBCChannel)
}

ponder.on("DispatcherSim:OpenIbcChannel", async ({event, context}) => {
Expand Down Expand Up @@ -135,7 +136,7 @@ async function connectIbcChannel<name extends Virtual.EventNames<config>>(event:
counterpartyPortId = channel.channel.counterparty.portId;
}
} catch (e) {
logger.info('Skipping packet for channel: ', channelId);
logger.error('Skipping packet for channel: ', channelId);
}

// update earliest INIT state record that have incomplete id
Expand Down Expand Up @@ -175,6 +176,7 @@ async function connectIbcChannel<name extends Virtual.EventNames<config>>(event:
}
})
}
await updateStats(context.db.Stat, StatName.ConnectIbcChannel)
}

ponder.on("DispatcherSim:ConnectIbcChannel", async ({event, context}) => {
Expand Down Expand Up @@ -206,6 +208,7 @@ async function closeIbcChannel<name extends Virtual.EventNames<config>>(event: V
from: event.transaction.from.toString(),
},
});
await updateStats(context.db.Stat, StatName.CloseIBCChannel)
}

ponder.on("DispatcherSim:CloseIbcChannel", async ({event, context}) => {
Expand Down Expand Up @@ -484,6 +487,7 @@ async function timeout<name extends Virtual.EventNames<config>>(event: Virtual.E
from: event.transaction.from.toString(),
},
});
await updateStats(context.db.Stat, StatName.Timeout)
}

ponder.on("DispatcherSim:Timeout", async ({event, context}) => {
Expand Down Expand Up @@ -519,6 +523,8 @@ async function writeTimeoutPacket<name extends Virtual.EventNames<config>>(event
from: event.transaction.from.toString(),
},
});

await updateStats(context.db.Stat, StatName.WriteTimeoutPacket)
}

ponder.on("DispatcherSim:WriteTimeoutPacket", async ({event, context}) => {
Expand Down
2 changes: 2 additions & 0 deletions src/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export enum StatName {
RecvPackets = 'RecvPackets',
AckPackets = 'AckPackets',
WriteAckPacket = 'WriteAckPacket',
WriteTimeoutPacket = 'WriteTimeoutPacket',
Timeout = 'Timeout',
OpenIBCChannel = 'OpenIBCChannel',
CloseIBCChannel = 'CloseIBCChannel',
ConnectIbcChannel = 'ConnectIbcChannel',
Expand Down

0 comments on commit bd7b0d2

Please sign in to comment.