streamOrders - missing timestamp
CLI streamorders is missing the timestamp for each event. Best if the time stamp will be the event timestamp and not the stream's data timestamp. It would be great if we have a similar time stamp as the log so we can easily find the event in the log. Time stamp should include milliseconds.
This seems easy to implement, so in short you actually want to see createdAt field of Order per row as formatted with same way of log's timestamp; implemented in #775 ? @offerm
We'd also need to add a timestamp field to the swap result and internal match. I'm not sure if that would necessarily match the log timestamp precisely but we can probably get pretty close.
Oh I see, I thought @offerm wanted to match only with the log time which is equal to createdAt property, will think about it once more
cli/commands/streamorders.ts subscribes to Order, OrderRemoval and SwapSuccess messages. Order have a field called created_at. OrderRemoval and SwapSuccess don't have any temporal fields. IMO these three messages act like events. I see the Order is the main domain object in xud and when Order changes its status xud will emit some events. These events should have a temporal field to indicate the event's creation time. The simple implementation is add a temporal field to these three messages. But a better approach is create a BaseEvent message and distinguish the Order and OrderEvent I think.
Summary: Each event needs a timestamp (milliseconds). It should be based on the actual swap failure/order removal and NOT at the time the event was fired. @sangaman will help you out.
@reliveyy I think we are interested in the completeTime which will be available on all internal SwapSuccess objects. It's currently not on the SwapSuccess rpc message, so we should add it there, and then update the cli output to output the time in the same format as we use for internal logging like 27/02/2019 02:28:50.059.
We don't currently track exact timestamps for when swaps fail or for when internal matches are executed. I figure we can can add a failTime to the SwapFailure internal type and rpc message and set this value as the current time whenever we emit the swap.failed event from Swaps.failDeal(). Likewise we can add an optional executedAt property to the Order internal type and rpc message and assign this a value when it is matched.
For the remaining order event, I think we can just output the time of the event itself. We don't want to use the createdAt property because that tracks when the order was actually created, not necessarily when it entered the order book.
Let me know if you have any more questions.
@sangaman
| Message | Temporal Field |
|---|---|
| Order | executed_at |
| OrderRemoval | removed_at |
| SwapSuccess | success_time |
| SwapFailure | fail_time |
I think that looks good but we can use complete_time instead of success_time since we already track a field with that name.
moving to post-1.0.0