feat: OpenTelemetry integration#1427
Conversation
…for improved mobile and desktop interactions
…nd DocumentTabContent
…d document upload popups
|
@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ion for enhanced telemetry
…update observability resource attributes
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR integrates OpenTelemetry distributed tracing and metrics into the SurfSense backend to enable production observability. It adds comprehensive instrumentation across the entire application stack, including traces for LLM calls, tool invocations, database queries, ETL pipelines, knowledge-base searches, and chat requests, while also collecting custom metrics for token usage, request durations, error rates, and system resource utilization. The integration includes auto-instrumentation for FastAPI, SQLAlchemy, Redis, HTTPX, Celery, and Psycopg, with a new Grafana LGTM stack container for local development. A few frontend UI fixes are also included for context menus and button styling.
⏱️ Estimated Review Time: 1-3 hours
💡 Review Order Suggestion
surfsense_backend/pyproject.tomlsurfsense_backend/.env.exampledocker/docker-compose.dev.ymlsurfsense_backend/app/observability/__init__.pysurfsense_backend/app/observability/bootstrap.pysurfsense_backend/app/observability/metrics.pysurfsense_backend/app/observability/otel.pysurfsense_backend/main.pysurfsense_backend/app/app.pysurfsense_backend/app/celery_app.pysurfsense_backend/app/tasks/celery_tasks/__init__.pysurfsense_backend/app/agents/new_chat/middleware/otel_span.pysurfsense_backend/app/utils/perf.pysurfsense_backend/app/retriever/chunks_hybrid_search.pysurfsense_backend/app/retriever/documents_hybrid_search.pysurfsense_backend/app/indexing_pipeline/indexing_pipeline_service.pysurfsense_backend/app/etl_pipeline/etl_pipeline_service.pysurfsense_backend/app/tasks/chat/stream_new_chat.pysurfsense_backend/app/agents/multi_agent_chat/middleware/main_agent/checkpointed_subagent_middleware/task_tool.pysurfsense_backend/app/agents/multi_agent_chat/middleware/shared/permissions/ask/request.pysurfsense_backend/app/agents/new_chat/middleware/compaction.pysurfsense_backend/app/agents/new_chat/middleware/doom_loop.pysurfsense_backend/app/agents/new_chat/middleware/permission.pysurfsense_backend/app/routes/search_source_connectors_routes.pysurfsense_backend/app/tasks/celery_tasks/connector_tasks.pysurfsense_backend/app/tasks/celery_tasks/document_tasks.pysurfsense_backend/tests/unit/observability/test_otel.pysurfsense_backend/tests/unit/observability/test_retriever_otel.pysurfsense_backend/tests/unit/agents/new_chat/test_otel_span.pysurfsense_web/app/(home)/login/GoogleLoginButton.tsxsurfsense_web/components/assistant-ui/connector-popup.tsxsurfsense_web/components/assistant-ui/document-upload-popup.tsxsurfsense_web/components/layout/ui/icon-rail/SearchSpaceAvatar.tsxsurfsense_web/components/layout/ui/tabs/DocumentTabContent.tsxsurfsense_web/components/ui/button.tsxsurfsense_web/app/(home)/login/GoogleLoginButton.tsxsurfsense_web/components/assistant-ui/connector-popup.tsxsurfsense_web/components/assistant-ui/document-upload-popup.tsxsurfsense_web/components/layout/ui/icon-rail/SearchSpaceAvatar.tsxsurfsense_web/components/layout/ui/tabs/DocumentTabContent.tsxsurfsense_web/components/ui/button.tsx