@@ -214,7 +214,7 @@ def update_progress() -> None:
214214 progress = (self .completed_topics / self .total_topics ) * 100
215215 logging .info ("Progress: %d of %d (%.1f%%) topics completed" , self .completed_topics , self .total_topics , progress )
216216
217- def analyze_topic_worker (topic_name : str , topic_info : Dict ) -> Dict :
217+ def analyze_topic_worker (topic_name : str , topic_info : Dict , start_time_epoch : int ) -> Dict :
218218 """Worker function to analyze a single topic.
219219
220220 Args:
@@ -239,7 +239,7 @@ def analyze_topic_worker(topic_name: str, topic_info: Dict) -> Dict:
239239 # Use sample records approach
240240
241241 # Calculate the ISO 8601 formatted start timestamp of the rolling window
242- rolling_start = topic_info [ 'utc_now' ] - timedelta (days = topic_info ['sampling_days_based_on_retention_days' ])
242+ rolling_start = start_time_epoch - timedelta (days = topic_info ['sampling_days_based_on_retention_days' ])
243243 iso_start_time = datetime .fromisoformat (rolling_start .strftime ('%Y-%m-%dT%H:%M:%S+00:00' ))
244244 start_time_epoch_ms = int (rolling_start .timestamp () * 1000 )
245245
@@ -260,7 +260,7 @@ def analyze_topic_worker(topic_name: str, topic_info: Dict) -> Dict:
260260
261261 else :
262262 # Use Metrics API approach
263- result = thread_analyzer .analyze_topic_with_metrics (metrics_config , topic_name , topic_info )
263+ result = thread_analyzer .analyze_topic_with_metrics (metrics_config , topic_name , topic_info , start_time_epoch )
264264
265265 return result
266266
@@ -282,7 +282,7 @@ def analyze_topic_worker(topic_name: str, topic_info: Dict) -> Dict:
282282 with ThreadPoolExecutor (max_workers = max_workers_per_cluster ) as executor :
283283 # Submit all tasks
284284 future_to_topic = {
285- executor .submit (analyze_topic_worker , topic_name , topic_info ): topic_name
285+ executor .submit (analyze_topic_worker , topic_name , topic_info , analysis_start_time_epoch ): topic_name
286286 for topic_name , topic_info in topics_to_analyze .items ()
287287 }
288288
@@ -308,7 +308,7 @@ def analyze_topic_worker(topic_name: str, topic_info: Dict) -> Dict:
308308 update_progress ()
309309
310310 except Exception as e :
311- logging .error ( "Error processing topic %s: %s" , topic_name , e )
311+ logging .warning ( "Failed processing topic %s, because of %s" , topic_name , e )
312312 update_progress ()
313313
314314 # Calculate summary statistics
0 commit comments