langsmith_rust/tracing/
context.rs1use uuid::Uuid;
2
3#[derive(Debug, Clone)]
5pub struct TraceContext {
6 pub trace_id: Uuid,
7 pub parent_run_id: Option<Uuid>,
8 pub dotted_order: Option<String>,
9 pub thread_id: Option<String>,
10 pub session_name: Option<String>,
11}
12
13impl TraceContext {
14 pub fn new(trace_id: Uuid) -> Self {
15 Self {
16 trace_id,
17 parent_run_id: None,
18 dotted_order: None,
19 thread_id: None,
20 session_name: None,
21 }
22 }
23
24 pub fn with_parent(mut self, parent_run_id: Uuid) -> Self {
25 self.parent_run_id = Some(parent_run_id);
26 self
27 }
28
29 pub fn with_dotted_order(mut self, dotted_order: String) -> Self {
30 self.dotted_order = Some(dotted_order);
31 self
32 }
33
34 pub fn with_thread_id(mut self, thread_id: String) -> Self {
35 self.thread_id = Some(thread_id);
36 self
37 }
38
39 pub fn with_session_name(mut self, session_name: String) -> Self {
40 self.session_name = Some(session_name);
41 self
42 }
43}
44