Skip to main content

clob_engine/order_book/
tracing.rs

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