Repository: topoteretes/cognee
File: cognee/api/health.py (Python)

Code before:
    async def check_embedding_service(self) -> ComponentHealth:
        """Check embedding service health (non-critical)."""
        start_time = time.time()
        try:
            from cognee.infrastructure.databases.vector.embeddings.get_embedding_engine import (
                get_embedding_engine,
            )

            # Test actual embedding generation with minimal text
            engine = get_embedding_engine()
            await engine.embed_text("test")

            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.HEALTHY,
                provider="configured",
                response_time_ms=response_time,
                details="Embedding generation working",
            )
        except Exception as e:
            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.DEGRADED,
                provider="unknown",
                response_time_ms=response_time,
                details=f"Embedding test failed: {str(e)}",
            )

    async def get_health_status(self, detailed: bool = False) -> HealthResponse:
        """Get comprehensive health status."""
        components = {}

        # Critical services
        critical_checks = [
            ("relational_db", self.check_relational_db()),
            ("vector_db", self.check_vector_db()),
            ("graph_db", self.check_graph_db()),
            ("file_storage", self.check_file_storage()),
            ("llm_provider", self.check_llm_provider()),
            ("embedding_service", self.check_embedding_service()),
        ]

        # Non-critical services (only for detailed checks)
        non_critical_checks = []

        # Run critical checks
        critical_results = await asyncio.gather(
            *[check for _, check in critical_checks], return_exceptions=True
        )

        for (name, _), result in zip(critical_checks, critical_results):

Review comment (bug):
```suggestion
            response_time = int((time.time() - start_time) * 1000)
            logger.error(f"Embedding service health check failed: {str(e)}", exc_info=True)
            return ComponentHealth(
```

Code after:
                response_time_ms=response_time,
                details=f"API check failed: {str(e)}",
            )

    async def check_embedding_service(self) -> ComponentHealth:
        """Check embedding service health (non-critical)."""
        start_time = time.time()
        try:
            from cognee.infrastructure.databases.vector.embeddings.get_embedding_engine import (
                get_embedding_engine,
            )

            # Test actual embedding generation with minimal text
            engine = get_embedding_engine()
            await engine.embed_text("test")

            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.HEALTHY,
                provider="configured",
                response_time_ms=response_time,
                details="Embedding generation working",
            )
        except Exception as e:
            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.DEGRADED,
                provider="unknown",
                response_time_ms=response_time,
                details=f"Embedding test failed: {str(e)}",
            )

    async def get_health_status(self, detailed: bool = False) -> HealthResponse:
        """Get comprehensive health status."""
        components = {}

        # Critical services
        critical_components = [
            "relational_db",
            "vector_db",
            "graph_db",
            "file_storage",
            "llm_provider",
            "embedding_service",
        ]

        critical_checks = [
            ("relational_db", self.check_relational_db()),
            ("vector_db", self.check_vector_db()),
            ("graph_db", self.check_graph_db()),
            ("file_storage", self.check_file_storage()),