mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-27 16:04:21 +00:00
feat(telemetry): payload v2 with feature usage counters and instance heartbeat
Per-query events now carry event_type='query' and a features JSON object: - tool_calls by source (native/plugin/mcp/skill) via ToolManager - tool_call_rounds, kb usage (count/engine plugins/retrieved entries) via local-agent - sandbox execs/errors via BoxService - activated_skills and bound mcp_servers snapshots New instance_heartbeat event (startup + daily) reports anonymous instance profile: deploy platform, database/vdb kind, box backend/availability, adapter type names, and resource counts. Respects space.disable_telemetry. All collection helpers are defensive and never break the pipeline. Verified: ruff, 37 telemetry unit tests (13 new), 504 box/provider/pipeline tests.
This commit is contained in:
@@ -68,10 +68,21 @@ class TelemetryManager:
|
||||
'edition',
|
||||
'error',
|
||||
'timestamp',
|
||||
'event_type',
|
||||
):
|
||||
if sfield not in sanitized:
|
||||
continue
|
||||
v = sanitized.get(sfield)
|
||||
sanitized[sfield] = '' if v is None else str(v)
|
||||
|
||||
# event_type defaults to 'query' for backward compatibility
|
||||
if not sanitized.get('event_type'):
|
||||
sanitized['event_type'] = 'query'
|
||||
|
||||
# features must be a JSON object
|
||||
if 'features' in sanitized and not isinstance(sanitized['features'], dict):
|
||||
sanitized['features'] = {}
|
||||
|
||||
if 'duration_ms' in sanitized:
|
||||
try:
|
||||
sanitized['duration_ms'] = (
|
||||
|
||||
Reference in New Issue
Block a user