feat: add client-side trace upload with prefix analysis#12
Open
stmatengss wants to merge 1 commit into
Open
Conversation
Add a Trace Analyzer card to the web calculator that lets users upload JSONL trace files and get instant analysis without a Python backend: - Trace statistics: request count, time span, request rate, token distributions (avg/min/max/median/p95), unique block count - Prefix sharing analysis via trie: content upper bound hit rate, shared prefix length distribution histogram, sharing percentage - Auto-suggested heuristic parameters derived from trace data (concurrent_agents, shared_prefix_tokens, avg_new_tokens_per_turn, avg_turns_per_session, private_window_tokens) - "Apply to Calculator" button to populate the heuristic form fields - Drag-and-drop file upload zone with progress feedback Co-Authored-By: Claude Opus 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
.jsonltrace files directly in the browser and get instant prefix sharing analysis without requiring the Python CLIFeatures
Trace Statistics
Prefix Sharing Analysis
hash_idsarraysAuto-Suggest Parameters
concurrent_agentsestimated from request rate and session lengthshared_prefix_tokens= median shared prefix length * block_sizeavg_new_tokens_per_turn= median unique (non-shared) tokens per requestavg_turns_per_sessionestimated via timestamp gap clusteringprivate_window_tokens= p95 request length * block_sizeUI
Test plan
node tests/validate_js_parity.mjspasses all 178 checks (no regression to existing calculator logic)new Function()parsing🤖 Generated with Claude Code