feat(import): enrich Claude Code import with git/PR metadata and new metrics#6
Open
jmelloy wants to merge 2 commits into
Open
feat(import): enrich Claude Code import with git/PR metadata and new metrics#6jmelloy wants to merge 2 commits into
jmelloy wants to merge 2 commits into
Conversation
…metrics - Capture gitBranch and attach as git_branch attribute to all metrics and logs - Parse pr-link entries (prNumber, prRepository, prUrl) and emit claude_code.pull_request.count metrics; attach PR info to log attributes - Derive repository dimension from prRepository or cwd for all metrics - Emit claude_code.lines_of_code.count from Edit/Write/MultiEdit tool calls, with file_type and file_path attributes for breakdown by filetype - Emit claude_code.session.count (one per JSONL file) - Emit claude_code.commit.count from Bash tool calls containing git commit - Emit claude_code.active_time.total from system/turn_duration entries (one data point per turn, consistent with OTLP telemetry) - Add tests covering all new metrics and helper functions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… PR dedup - TestClaudeParserMultiEdit: verifies MultiEdit tool calls aggregate lines added/removed across all edits in the batch - TestClaudeParserSessionMetric: verifies exactly one session metric per file and that duplicate pr-link entries emit only one PR metric Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
gitBranch,cwd, andpr-linkentries, then attachesgit_branch,repository,pr_number,pr_urlattributes to all emitted metrics and transcript logs.claude_code.session.count(once per file),claude_code.pull_request.count(frompr-linkentries),claude_code.commit.count(fromgit commitBash tool calls),claude_code.active_time.total(fromsystem/turn_durationentries), andclaude_code.lines_of_code.countbroken down by file path and type (fromEdit,Write,MultiEdittool calls).MultiEditline counting,session.countemission,pr-linkdeduplication, and thesystem/turn_durationactive-time path.Motivation
Previously the Claude Code JSONL importer only produced token/cost metrics and transcript logs. This left the imported data significantly less rich than live OTLP telemetry, making historical imports look sparse in the dashboard. This change closes that gap so imported sessions are indistinguishable from live sessions in the metrics views.
Test plan
cd backend && go test -v ./internal/importer/...passescollectSessionMeta)🤖 Generated with Claude Code