Skip to content

feat(grok-build): coding agent observability#171

Open
fangxiu-wf wants to merge 1 commit into
mainfrom
fangxiu-wf/grok-build-observability
Open

feat(grok-build): coding agent observability#171
fangxiu-wf wants to merge 1 commit into
mainfrom
fangxiu-wf/grok-build-observability

Conversation

@fangxiu-wf

Copy link
Copy Markdown
Collaborator

Summary

grok-build (Grok CLI) coding agent 可观测接入。Hook processor 解析 grok transcript turns 生成 5 层 span 树(ENTRY → AGENT → STEP → LLM/TOOL),注入 ARMS GenAI 语义属性。

重建说明:原 PR #159 因 GitHub 不允许修改 PR creator 字段(原 creator = rangemer333-cell),已关闭,由 fangxiu-wf 重建本 PR。commit author 已是 fangxiu-wf。本 PR 已合并原 #158 / #160 / #161 的全部净增量(squash 成单 commit 960403b,base=main)。

Core Changes

  • grok-build-log-input:tail grok transcript 日志
  • hook-processor + transcript-parser + state:解析 → 5 层 span 树
  • AgentSpanEnrichingHandler:注入 gen_ai.agent.* + gen_ai.data_source.id + acs.* resource attrs + cache_creation tokens
  • F1/F3a:token usage 对齐 + system_instructions 数组形状
  • F2/F4/F6/F8:tool pairing / finish_reason / result 结构对齐 semconv
  • R2 Step C:AGENT span 聚合字段(子 LLM span token 累加、cache_creation_read、cache_read)

Files Changed

52 files / +6796 / -377

Validation

  • 单测:grok-build hook 41/41 + flusher 104/104 PASS
  • E2E:3 场景(长会话 / 异常路径 / 并发 session)全 PASS
  • validate-trace:真实 grok 0.2.101 (5bc4b5dfad) CLI 触发,0 ERROR

Known Non-blocking

  • 长会话场景 STEP 数 < 20 阈值(grok 把 Read/Grep 批量合并为单 turn),数据质量 PASS
  • OTLP flusher ECONNREFUSED 4318(本地 OTEL collector 未起),otlp-debug dump 用于校验,非本轮回归

Adds grok-build (Grok CLI) coding agent observability — hook processor
parses grok transcript turns into a 5-level span tree (ENTRY -> AGENT ->
STEP -> LLM/TOOL) and emits ARMS GenAI semantic attributes.

Core changes:
- src/inputs/grok-build-log/grok-build-log-input.ts: transcript tailing input
- assets/hooks/grok-build-{hook-processor.mjs, transcript-parser.mjs, state.mjs}
  + grok-build-loongsuite-pilot-hook.sh launcher
- agents.d/grok-build.json: agent registration
- flusher/otlp-trace: AgentSpanEnrichingHandler injects gen_ai.agent.* +
  gen_ai.data_source.id + acs.* resource attrs + cache_creation tokens
- F1/F3a: token usage alignment + system_instructions array shape
- F2/F4/F6/F8: tool pairing / finish_reason / result structure alignment
  with semconv
- R2 Step C: AGENT span aggregation fields (input/output token sums,
  cache_creation_read, cache_read across child LLM spans)

Tests: grok-build hook 41/41 + flusher 104/104 unit PASS.
E2E: 3 scenarios (long conversation / error path / concurrent sessions)
all PASS; validate-trace 0 ERROR on real grok 0.2.101 (5bc4b5dfad) CLI.

Known non-blocking:
- STEP count for long-conversation < 20 threshold (grok batches Read/Grep
  into single turns); data quality PASS.
- OTLP flusher ECONNREFUSED 4318 (local OTEL collector not started);
  otlp-debug dump used for validation; non-regression vs prior rounds.

Co-Authored-By: fangxiu-wf <fangxiu.wf@alibaba-inc.com>
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