@@ -35,7 +35,7 @@ impl TraceStore {
35
35
}
36
36
37
37
pub fn export ( & self , start_ts : i64 , end_ts : i64 , filter : & ExportFilters ) -> anyhow:: Result < Vec < u8 > > {
38
- info ! ( "Exporting objs with filters: {filter:?}" ) ;
38
+ info ! ( "Exporting objs between {start_ts} and {end_ts} with filters: {filter:?}" ) ;
39
39
40
40
// First, we collect all the events in our trace that match our configured filters. This
41
41
// will return an index of objects that we collected, and we set the keep_deleted flag =
@@ -48,7 +48,7 @@ impl TraceStore {
48
48
let lifecycle_data = self . pod_owners . filter ( start_ts, end_ts, & index) ;
49
49
let data = rmp_serde:: to_vec_named ( & ( & self . config , & events, & index, & lifecycle_data) ) ?;
50
50
51
- info ! ( "Exported {} events. " , events. len( ) ) ;
51
+ info ! ( "Exported {} events" , events. len( ) ) ;
52
52
Ok ( data)
53
53
}
54
54
@@ -63,16 +63,23 @@ impl TraceStore {
63
63
HashMap < String , PodLifecyclesMap > ,
64
64
) = rmp_serde:: from_slice ( & data) ?;
65
65
66
+ let trace_start_ts = events
67
+ . front ( )
68
+ . unwrap_or ( & TraceEvent { ts : UtcClock . now_ts ( ) , ..Default :: default ( ) } )
69
+ . ts ;
70
+ let mut trace_end_ts = events
71
+ . back ( )
72
+ . unwrap_or ( & TraceEvent { ts : UtcClock . now_ts ( ) , ..Default :: default ( ) } )
73
+ . ts ;
66
74
if let Some ( trace_duration_str) = maybe_duration {
67
- let trace_start_ts = events
68
- . front ( )
69
- . unwrap_or ( & TraceEvent { ts : UtcClock . now_ts ( ) , ..Default :: default ( ) } )
70
- . ts ;
71
- let trace_end_ts = duration_to_ts_from ( trace_start_ts, trace_duration_str) ?;
75
+ trace_end_ts = duration_to_ts_from ( trace_start_ts, trace_duration_str) ?;
72
76
events. retain ( |evt| evt. ts < trace_end_ts) ;
77
+
78
+ // Add an empty event to the very end to make sure the driver doesn't shut down early
73
79
events. push_back ( TraceEvent { ts : trace_end_ts, ..Default :: default ( ) } ) ;
74
80
}
75
81
82
+ info ! ( "Imported {} events between {trace_start_ts} and {trace_end_ts}" , events. len( ) ) ;
76
83
Ok ( TraceStore {
77
84
config,
78
85
events,
0 commit comments