@@ -160,12 +160,12 @@ def calculate_metrics(df, fault_time, sla=None):
160160
161161def parse_process_log (log_dir , process_name ):
162162 process_ready_pattern = {
163- "Frontend" : re .compile (r"added model (?P<model_name>.*?) " ),
163+ "Frontend" : re .compile (r"added model" ),
164164 "VllmDecodeWorker" : re .compile (
165- r"main.init: VllmWorker for (?P<model_name>.*?) has been initialized"
165+ r"VllmWorker for (?P<model_name>.*?) has been initialized"
166166 ),
167167 "VllmPrefillWorker" : re .compile (
168- r"main.setup_vllm_engine: VllmWorker for (?P<model_name>.*?) has been initialized"
168+ r"VllmWorker for (?P<model_name>.*?) has been initialized"
169169 ),
170170 }
171171 if not os .path .isdir (log_dir ):
@@ -183,27 +183,45 @@ def parse_process_log(log_dir, process_name):
183183
184184 with open (os .path .join (log_dir , entry ), "r" ) as f :
185185 for line in f :
186- clean_line = re .sub (
187- r"\x1b\[.*?m" , "" , line .strip ()
188- ) # Remove ANSI codes
189- if not clean_line :
190- continue
191-
192- parts = clean_line .split ()
193- if len (parts ) < 2 :
186+ line = line .strip ()
187+ if not line :
194188 continue
195189
190+ # Try to parse as JSONL first
196191 try :
197- # Parse timestamp (remove 'Z' for naive datetime)
198- timestamp = datetime .fromisoformat (parts [0 ].replace ("Z" , "" ))
199- except ValueError :
200- continue
192+ json_data = json .loads (line )
193+ # Extract timestamp and message from JSON format
194+ if "time" in json_data :
195+ timestamp = datetime .fromisoformat (
196+ json_data ["time" ].replace ("Z" , "" )
197+ )
198+ log_message = json_data .get ("message" , "" )
199+ else :
200+ continue
201+ except (json .JSONDecodeError , ValueError , KeyError ):
202+ # Fall back to readable format parsing
203+ clean_line = re .sub (
204+ r"\x1b\[.*?m" , "" , line
205+ ) # Remove ANSI codes
206+ if not clean_line :
207+ continue
208+
209+ parts = clean_line .split ()
210+ if len (parts ) < 2 :
211+ continue
212+
213+ try :
214+ # Parse timestamp (remove 'Z' for naive datetime)
215+ timestamp = datetime .fromisoformat (
216+ parts [0 ].replace ("Z" , "" )
217+ )
218+ except ValueError :
219+ continue
201220
221+ log_message = " " .join (parts [1 :])
202222 if not process_start_time :
203223 process_start_time = timestamp
204224
205- log_message = " " .join (parts [1 :])
206-
207225 relative_time = (timestamp - process_start_time ).total_seconds ()
208226
209227 # Check for process start lines
0 commit comments