Skip to main content

clob_engine/order_book/
tracing.rs

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