mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-26 23:51:14 +02:00
feat(backend): integrate PostHog analytics for enhanced observability
- Added PostHog configuration options to .env.example files for both Docker and Surfsense backend. - Introduced PostHog dependency in pyproject.toml. - Implemented analytics middleware to capture various events across the application, including user authentication, automation runs, and API requests. - Enhanced existing routes and services to emit analytics events, providing insights into user interactions and system performance. - Ensured graceful shutdown of analytics clients in worker processes and application lifecycles.
This commit is contained in:
parent
ca4f231577
commit
dbedf0cfa5
47 changed files with 1618 additions and 513 deletions
|
|
@ -37,7 +37,11 @@ class SurfSenseClient:
|
|||
self._fallback_api_key = fallback_api_key
|
||||
self._http = httpx.AsyncClient(
|
||||
base_url=api_base,
|
||||
headers={"Accept": "application/json"},
|
||||
# ``X-SurfSense-Client`` lets the backend distinguish PAT traffic
|
||||
# originating from this MCP server vs. raw PAT scripts, so
|
||||
# "documents added via MCP" / "searches via MCP" are queryable.
|
||||
# Server-to-server, so no CORS implications.
|
||||
headers={"Accept": "application/json", "X-SurfSense-Client": "mcp"},
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue