From f6d61c06cba0c7cfeba8239eee787deea3967a29 Mon Sep 17 00:00:00 2001 From: Rasmus Widing Date: Wed, 20 Aug 2025 12:05:31 +0300 Subject: [PATCH] Fix logging error in threading service Fixed TypeError when passing custom fields to Python logger by using the 'extra' parameter instead of direct keyword arguments. This resolves embedding creation failures during crawl operations. --- python/src/server/services/threading_service.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/src/server/services/threading_service.py b/python/src/server/services/threading_service.py index a79180c..9223d2e 100644 --- a/python/src/server/services/threading_service.py +++ b/python/src/server/services/threading_service.py @@ -474,7 +474,7 @@ class ThreadingService: self._running = True self._health_check_task = asyncio.create_task(self._health_check_loop()) - logfire_logger.info("Threading service started", config=self.config.__dict__) + logfire_logger.info("Threading service started", extra={"config": self.config.__dict__}) async def stop(self): """Stop the threading service""" @@ -510,7 +510,8 @@ class ThreadingService: finally: duration = time.time() - start_time logfire_logger.debug( - "Rate limited operation completed", duration=duration, tokens=estimated_tokens + "Rate limited operation completed", + extra={"duration": duration, "tokens": estimated_tokens} ) async def run_cpu_intensive(self, func: Callable, *args, **kwargs) -> Any: @@ -579,7 +580,7 @@ class ThreadingService: gc.collect() if metrics.cpu_percent > 95: - logfire_logger.warning("Critical CPU usage", cpu_percent=metrics.cpu_percent) + logfire_logger.warning("Critical CPU usage", extra={"cpu_percent": metrics.cpu_percent}) # Check for memory leaks (too many threads) if metrics.active_threads > self.config.max_workers * 3: @@ -592,7 +593,7 @@ class ThreadingService: await asyncio.sleep(self.config.health_check_interval) except Exception as e: - logfire_logger.error("Health check failed", error=str(e)) + logfire_logger.error("Health check failed", extra={"error": str(e)}) await asyncio.sleep(self.config.health_check_interval)