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    ) -> 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_touched = levels_touched,
23                    orders_consumed = orders_consumed
24        )
25    }
26    pub fn modify_span(
27        order_id: String,
28        filled: bool,
29        reason: &'static str,
30        modify_reason: &'static str,
31        intermediate_error : &'static str,
32        order_type: &'static str,
33        is_buy_side: bool,
34        levels_touched: u32,
35        orders_consumed: u32,
36    ) -> Span {
37        info_span!("modify", order_id = %order_id,
38                    filled = %filled,
39                    reason = %reason,
40                    modify_reason = %modify_reason,
41                    intermediate_error = %intermediate_error,
42                    order_type = %order_type ,
43                    is_buy_side = %is_buy_side,
44                    levels_touched = %levels_touched,
45                    orders_consumed = %orders_consumed
46        )
47    }
48
49    pub fn cancel_span(
50        order_id: Uuid,
51        success_status: bool,
52        reason: &'static str,
53    ) -> Span{
54        info_span!("cancel", order_id = %order_id,
55                    success_status = %success_status,
56                    reason = %reason,
57        )
58    }
59}