Skip to main content

clob_engine/order_book/
tracing.rs

1use tracing::{Span, info_span};
2use uuid::Uuid;
3use tracing::field::Empty;
4
5pub struct Tracing {}
6
7impl Tracing {
8    pub fn match_order_span(
9        order_id: String,
10        filled: Empty,
11        reason: Empty,
12        order_type: &'static str,
13        is_buy_side: bool,
14        levels_touched: Empty,
15        orders_consumed: Empty,
16        actual_time : Empty
17    ) -> Span {
18        info_span!("match_order", order_id = %order_id,
19                    filled = filled,
20                    reason = reason,
21                    order_type = %order_type ,
22                    is_buy_side = %is_buy_side,
23                    levels_touched = levels_touched,
24                    orders_consumed = orders_consumed,
25                    actual_time = actual_time
26        )
27    }
28    pub fn modify_span(
29        order_id: String,
30        filled: bool,
31        reason: &'static str,
32        modify_reason: &'static str,
33        intermediate_error : &'static str,
34        order_type: &'static str,
35        is_buy_side: bool,
36        levels_touched: u32,
37        orders_consumed: u32,
38    ) -> Span {
39        info_span!("modify", order_id = %order_id,
40                    filled = %filled,
41                    reason = %reason,
42                    modify_reason = %modify_reason,
43                    intermediate_error = %intermediate_error,
44                    order_type = %order_type ,
45                    is_buy_side = %is_buy_side,
46                    levels_touched = %levels_touched,
47                    orders_consumed = %orders_consumed
48        )
49    }
50
51    pub fn cancel_span(
52        order_id: Uuid,
53        success_status: bool,
54        reason: &'static str,
55    ) -> Span{
56        info_span!("cancel", order_id = %order_id,
57                    success_status = %success_status,
58                    reason = %reason,
59        )
60    }
61}