Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/config/startup_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
("COHERE_API_KEY", "Cohere API key for reranking", "Search reranking disabled"),
("VOYAGE_API_KEY", "Voyage AI key for code embeddings", "Using OpenAI embeddings"),
("SENTRY_DSN", "Sentry DSN for error tracking", "Error tracking disabled"),
("SENTRY_SEND_PII", "Send user emails to Sentry", "PII disabled (privacy safe)"),
("SENTRY_INCLUDE_LOCAL_VARS", "Include local vars in Sentry traces", "Local vars excluded"),
("REDIS_HOST", "Redis host for caching", "Using default localhost"),
]

Expand Down
3 changes: 1 addition & 2 deletions backend/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
from services.cache import CacheService
from services.dependency_analyzer import DependencyAnalyzer
from services.style_analyzer import StyleAnalyzer
from services.performance_metrics import PerformanceMetrics
from services.dna_extractor import DNAExtractor
from services.rate_limiter import RateLimiter, APIKeyManager
from services.supabase_service import get_supabase_service
from services.input_validator import InputValidator, CostController
from services.user_limits import init_user_limits_service, get_user_limits_service
from services.repo_validator import get_repo_validator
from services.observability import metrics

# Service instances (singleton pattern)
indexer = OptimizedCodeIndexer()
Expand All @@ -24,7 +24,6 @@
dependency_analyzer = DependencyAnalyzer()
style_analyzer = StyleAnalyzer()
dna_extractor = DNAExtractor()
metrics = PerformanceMetrics()

# Rate limiting and API key management
rate_limiter = RateLimiter(redis_client=cache.redis if cache.redis else None)
Expand Down
4 changes: 2 additions & 2 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os

# Initialize Sentry FIRST (before other imports to catch all errors)
from services.sentry import init_sentry
from services.observability import init_sentry
init_sentry()

# Import API config (single source of truth for versioning)
Expand Down Expand Up @@ -146,7 +146,7 @@ async def generic_exception_handler(request: Request, exc: Exception):
Catch-all handler for unhandled exceptions.
Captures to Sentry and returns 500.
"""
from services.sentry import capture_http_exception
from services.observability import capture_http_exception
capture_http_exception(request, exc, 500)

return JSONResponse(
Expand Down
4 changes: 2 additions & 2 deletions backend/middleware/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ def _authenticate(token: str) -> AuthContext:
ctx = _validate_jwt(token)
if ctx:
# Set Sentry user context for error tracking
from services.sentry import set_user_context
from services.observability import set_user_context
set_user_context(user_id=ctx.user_id, email=ctx.email)
return ctx

# Try API key
ctx = _validate_api_key(token)
if ctx:
# Set Sentry user context for error tracking
from services.sentry import set_user_context
from services.observability import set_user_context
set_user_context(user_id=ctx.user_id or ctx.api_key_name)
return ctx

Expand Down
Loading