Skip to content

feat(langfuse): tracing, tests, coverage and deps update#9

Merged
GishB merged 8 commits into
developfrom
features/langfuse-tests
Apr 30, 2026
Merged

feat(langfuse): tracing, tests, coverage and deps update#9
GishB merged 8 commits into
developfrom
features/langfuse-tests

Conversation

@GishB
Copy link
Copy Markdown
Owner

@GishB GishB commented Apr 30, 2026

Includes:\n- Langfuse tracing with nested Redis/Chroma spans inside LangGraph nodes\n- Unit-test coverage for all src/modules integrations\n- pytest-cov, coverage.xml\n- Docker compose updates\n- Evals and deps update

GishB added 8 commits April 15, 2026 01:36
Observability:
- Added current_span ContextVar to track active LangGraph node span.
- Wrapped all agent nodes (base, core, loop) with manual Langfuse spans;
  LLM callbacks are now scoped to the node span via CallbackHandler(stateful_client=span).
- Updated RedisAdapter and ChromaAdapter to nest their spans under current_span
  instead of attaching directly to the root trace.
- Removed global CallbackHandler from /chat router to avoid duplicate spans.

Tests:
- Added tests/service/api/v1/test_router.py covering /test_invoke (success & 424)
  and /chat (success & rate-limit).
- Added tests/agents/profkom_consultant/nodes/test_base.py for
  update_user_history_context (append, trim, 1:1 sync).

Fixes:
- Fixed history trim bug: model_answers now uses [-HISTORY_LIMIT:] instead of
  [-trim_count:], keeping Q&A lists synchronized.

Deps:
- Added pytest, pytest-asyncio, httpx to dev dependencies.
- Added pytest-cov to dev dependencies.
- Generated coverage.xml from current test suite (7 tests, all passing).
Added pytest suites covering:
- redis_ext: RedisAdapter (save/get/spans/health) + UserRateLimiter (incr/remain/reset/ttl/health)
- chroma_ext: ChromaAdapter (init/query/filter/rerank/RAG), MyEmbeddingFunction (retry/batch/call),
  BM25Reranker (fit/rerank), data_reader (chunk/signature/topic), db_writer (sync/orphan cleanup)
- postgres_ext: PostgresClient (pool lifecycle, conn loop, checkpointer, stats, close, health)
- langfuse_ext: LangfuseClient (init, client/handler creation, health_check, on_startup)

Fixes:
- Fixed f-string bug in PostgresClient.get_pool_stats that raised ValueError at runtime.

Coverage:
- Regenerated coverage.xml from full suite (102 tests passing).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant