feat: Add frontend observability probes#12
Draft
jiejuncai-ly wants to merge 2 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更概述
这个 PR 在前端加入可开关的观测事件采集,把浏览器端的输入音频、远端播放音频、房间连接和后端输出 marker 统一成前端可发布的数据包,供 LexVoice 后端按同一 session/room 维度关联分析。
主要改动
1. 前端观测协议与音频活动检测
lib/observability.ts,定义前端观测事件、LiveKit data packet 发布和后端 marker 解析。lib/frontend-audio-observer.ts,检测音频活动起止、尾帧和媒体轨道播放状态。2. LiveKit 会话链路接入
hooks/useBrowserSourceClient.ts、hooks/useRoom.ts和components/app/app.tsx中发布浏览器输入、房间连接和远端播放观测事件。components/livekit/remote-audio-playback-observer.tsx,观察 agent 远端音频播放情况。3. 前端边界与测试覆盖
影响说明
OBSERVABILITY_ENABLED控制;关闭时不会发布前端观测事件。Verification
pnpm test✅ passed: 92 tests passedpnpm lint✅ passed: eslint completed with exit 0git diff --check origin/lex-main..HEAD✅ passed: no output