Skip to content

feat: added perf logs and removed managed google connectors#845

Merged
MODSetter merged 2 commits intomainfrom
dev
Feb 28, 2026
Merged

feat: added perf logs and removed managed google connectors#845
MODSetter merged 2 commits intomainfrom
dev

Conversation

@MODSetter
Copy link
Owner

@MODSetter MODSetter commented Feb 28, 2026

Description

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR introduces a centralized performance monitoring system for the SurfSense backend by creating a new perf.py utility module and instrumenting critical paths with timing logs. A new RequestPerfMiddleware tracks all HTTP request durations and logs slow requests exceeding a configurable threshold (default 2000ms) with system snapshots. Performance logging has been added throughout the application including knowledge base search, LLM router operations, indexing pipeline, retriever services, and connector service operations. Additionally, the PR comments out managed Google connectors (Drive, Gmail, Calendar) from the web frontend connector popup, making them unavailable for quick OAuth connection.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/utils/perf.py
2 surfsense_backend/app/app.py
3 surfsense_backend/app/tasks/chat/stream_new_chat.py
4 surfsense_backend/app/agents/new_chat/chat_deepagent.py
5 surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
6 surfsense_backend/app/services/llm_router_service.py
7 surfsense_backend/app/services/connector_service.py
8 surfsense_backend/app/indexing_pipeline/indexing_pipeline_service.py
9 surfsense_backend/app/retriever/chunks_hybrid_search.py
10 surfsense_backend/app/retriever/documents_hybrid_search.py
11 surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts
⚠️ Inconsistent Changes Detected
File Path Warning
surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts Removal/commenting out of managed Google connectors (Drive, Gmail, Calendar) appears unrelated to the performance logging improvements that comprise the rest of this PR

Need help? Join our Discord

Analyze latest changes

…king across services

- Introduced RequestPerfMiddleware to log request performance metrics, including slow request thresholds.
- Updated various services and retrievers to utilize the new performance logging utility for better tracking of execution times.
- Enhanced existing methods with detailed performance logs for operations such as embedding, searching, and indexing.
- Removed deprecated logging setup in stream_new_chat and replaced it with the new performance logger.
@vercel
Copy link

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
surf-sense-frontend Building Building Preview, Comment Feb 28, 2026 0:34am

Request Review

@MODSetter MODSetter merged commit 11a38a2 into main Feb 28, 2026
3 of 6 checks passed
Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on f1f100b..a43956b

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (10)

surfsense_backend/app/agents/new_chat/chat_deepagent.py
surfsense_backend/app/app.py
surfsense_backend/app/indexing_pipeline/indexing_pipeline_service.py
surfsense_backend/app/retriever/chunks_hybrid_search.py
surfsense_backend/app/retriever/documents_hybrid_search.py
surfsense_backend/app/services/connector_service.py
surfsense_backend/app/services/llm_router_service.py
surfsense_backend/app/tasks/chat/stream_new_chat.py
surfsense_backend/app/utils/perf.py
surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts

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