xud icon indicating copy to clipboard operation
xud copied to clipboard

streamOrders - missing timestamp

Open offerm opened this issue 7 years ago • 9 comments

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.

offerm avatar Nov 18 '18 21:11 offerm

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

rsercano avatar Jan 07 '19 12:01 rsercano

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.

sangaman avatar Jan 08 '19 12:01 sangaman

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

rsercano avatar Jan 08 '19 13:01 rsercano

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.

reliveyy avatar Feb 26 '19 13:02 reliveyy

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.

kilrau avatar Feb 26 '19 15:02 kilrau

@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 avatar Feb 27 '19 07:02 sangaman

@sangaman

Message Temporal Field
Order executed_at
OrderRemoval removed_at
SwapSuccess success_time
SwapFailure fail_time

reliveyy avatar Mar 15 '19 10:03 reliveyy

I think that looks good but we can use complete_time instead of success_time since we already track a field with that name.

sangaman avatar Mar 16 '19 12:03 sangaman

moving to post-1.0.0

kilrau avatar May 08 '19 15:05 kilrau