Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ece59cb
feat(claude): per-turn independent traces + STEP = LLM reasoning cycle
fangxiu-wf Apr 24, 2026
e9453f3
init
fangxiu-wf Apr 27, 2026
1b3ad16
fix(claude): regenerate package-lock.json to resolve from npm registry
fangxiu-wf Apr 27, 2026
5c9192b
feat(claude): add multimodal image support using BlobPart/UriPart
fangxiu-wf Apr 27, 2026
4bd8be6
feat(claude): add config file support, JSONL logging, and fix two bugs
fangxiu-wf Apr 28, 2026
3041b1c
feat(claude): support log-only mode + configurable log filename forma…
fangxiu-wf Apr 30, 2026
81c8c49
feat(claude): migrate JSONL log fields to event_t schema
fangxiu-wf May 1, 2026
ba1bc97
docs(claude): update README JSONL log section for event_t schema
fangxiu-wf May 1, 2026
8f5c00f
fix(claude): remove agent.name from event logs, keep agent.type as "c…
fangxiu-wf May 5, 2026
12f5a1d
fix(claude): harden setup-alias.sh and add npm uninstall to uninstall.sh
fangxiu-wf May 5, 2026
4323159
fix(claude): eliminate PATH dependency with wrapper script for hook e…
fangxiu-wf May 6, 2026
e8fbf31
fix(claude): add matcher field to hook config for Cursor IDE compatib…
fangxiu-wf May 6, 2026
83e85d6
fix(claude): compute true incremental delta for input.messages_delta
fangxiu-wf May 6, 2026
cc02b07
fix(claude): skip processing when called by Cursor IDE
fangxiu-wf May 6, 2026
1e37417
feat(claude): transcript-based tracing, alias env var cleanup, and OO…
fangxiu-wf May 8, 2026
e8c2a81
feat(claude): add --no-alias option to install command
fangxiu-wf May 8, 2026
57a3723
fix(claude): update tests for delta input_messages, removed agent.nam…
fangxiu-wf May 8, 2026
361b8b6
chore(claude): bump version to 0.2.0-beta, update CHANGELOG and README
fangxiu-wf May 8, 2026
245a1b3
chore(claude): sync package-lock.json version to 0.2.0-beta
fangxiu-wf May 8, 2026
ee3b021
fix(claude): hook-entry.sh relative path resolution and shell profile…
fangxiu-wf May 11, 2026
83961c0
fix(claude): incremental transcript parsing and PostToolUse drop orde…
fangxiu-wf May 12, 2026
b79a1c5
feat(claude): add fixed gen_ai.agent.system=claude resource attribute
fangxiu-wf May 14, 2026
9e80247
fix(claude): input_token undercounting, anchor steal, span_id missing…
fangxiu-wf May 20, 2026
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Both plugins follow the [OpenTelemetry GenAI semantic conventions](https://opent
**One-line install (with OTLP backend):**

```bash
curl -fsSL https://arms-apm-cn-hangzhou-pre.oss-cn-hangzhou.aliyuncs.com/agenttrack/remote-install.sh | bash -s -- \
curl -fsSL https://arms-apm-cn-hangzhou-pre.oss-cn-hangzhou.aliyuncs.com/opentelemetry-instrumentation-claude/remote-install.sh | bash -s -- \
--endpoint "https://your-otlp-endpoint:4318" \
--service-name "my-claude-agent"
```
Expand Down
40 changes: 34 additions & 6 deletions opentelemetry-instrumentation-claude/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,46 @@
All notable changes to this project will be documented in this file.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]
## [0.2.0-beta] - 2026-05-08

### Added
- Jest test suite: hooks, state, telemetry, intercept parsers, and cli command unit tests
- `cli.js` and `intercept.js` now included in coverage reporting
- **Per-turn independent traces**: each conversation turn produces an independent trace (new traceId); all turns share `gen_ai.session.id`
- **STEP = LLM reasoning cycle**: STEP spans now map to one `llm_call` + resulting tool calls, matching ARMS semantic conventions
- **Transcript-based tracing**: `transcript.js` parses Claude Code native transcript JSONL for LLM call data, replacing reliance on `intercept.js` HTTP interception; works with all Claude Code versions
- **Config file support**: `~/.claude/otel-config.json` with priority: config file > env var > default
- **JSONL log collection**: chain hash incremental validation, daily file rotation, event_t schema (`llm.request`/`llm.response`/`tool.call`/`tool.result`)
- **Log-only mode**: skip OTel Trace export when only JSONL logging is needed (for ai-agent-collector integration)
- **Configurable log filename format**: `"default"` (`claude-code.jsonl.YYYYMMDD`) or `"hook"` (`claude-code-YYYY-MM-DD.jsonl`)
- **Multimodal image support**: `BlobPart` (base64) and `UriPart` (URL) across Anthropic, OpenAI Chat, and OpenAI Responses protocols
- **Message converter module**: Anthropic/OpenAI/Responses protocol conversion to ARMS semantic format
- **`--no-alias` install option**: skip shell alias setup for managed installations (pilot)
- **Cursor IDE compatibility**: `matcher` field on hook entries; auto-skip when called by Cursor
- **Hook wrapper script**: `hook-entry.sh` with built-in Node discovery (nvm, homebrew, volta, fnm fallbacks), eliminating PATH dependency
- Jest test suite: hooks, state, telemetry, intercept parsers, cli commands, transcript, message-converter

### Fixed
- `process.ppid` ≠ claude PID bug: `resolveClaudePid()` now walks the process tree
(`/proc` on Linux, `ps` on macOS) to correctly locate `proxy_events_<pid>.jsonl`
- **O(N²) OOM in transcript parsing**: store `input_messages` as delta instead of cumulative copies (35MB transcript: memory from >4GB to ~98MB)
- **`-p` mode missing LLM/STEP spans**: remove `setImmediate` race in `intercept.js`
- **`OTEL_RESOURCE_ATTRIBUTES` not fully parsed** into OTel Resource
- **`input.messages_delta` was cumulative**: now computes true incremental delta via slice-based diff
- **Orphaned `pre_tool_use` events**: produce TOOL spans with `tool.orphaned=true` instead of silently dropping
- **Duplicate trace generation**: events cleared after successful export in `cmdStop()`
- `process.ppid` ≠ claude PID bug: `resolveClaudePid()` walks the process tree
- `readProxyEvents` with unknown PID no longer deletes files (safe fallback)
- `tool_use_id` fallback aligned between `cmdPreToolUse` and `cmdPostToolUse` (both use `null`)
- `detectLang()` no longer spawns subprocesses (`defaults read`, PowerShell); uses env vars only
- `detectLang()` no longer spawns subprocesses; uses env vars only
- `setup-alias.sh`: add file writability check, handle `cat >>` failure gracefully
- `uninstall.sh`: add `npm uninstall -g` step for global package cleanup
- `package-lock.json` regenerated to resolve from npm registry (fix `link: true` issue)
- Remove `agent.name` from event logs, keep `agent.type` as `"claude-code"`
- Test isolation: mock `otel-config.json` reads to prevent local config interference

### Changed
- **Alias env var cleanup**: GenAI SDK env vars (Group A) moved from alias to `bin/otel-claude-hook` entry point; `NODE_OPTIONS` + `intercept.js` removed from alias
- `setup-alias.sh`: add `--minimal` mode (cleanup only, no alias write) for pilot installations
- Auto-upgrade legacy alias blocks containing `intercept.js` references
- `gen_ai.session.id` set on ALL spans (ENTRY, AGENT, STEP, LLM, TOOL), not just ENTRY
- JSONL log fields migrated from `gen_ai.*` to event_t dotted namespace

### Performance
- Hook subprocess startup latency reduced by removing synchronous OS calls in `detectLang()`
Expand Down
Loading
Loading