feat(traces): compare two AgentCore traces from the CLI#1831
Open
OrenAshkenazy wants to merge 10 commits into
Open
feat(traces): compare two AgentCore traces from the CLI#1831OrenAshkenazy wants to merge 10 commits into
OrenAshkenazy wants to merge 10 commits into
Conversation
…pare Fetch application spans from the endpoint-specific runtime log group, detected per trace via aws.endpoint.name; validate trace ownership against the runtime resource ID; report missing application spans as unavailable rather than zero; de-duplicate token fields independently; extend comparability warnings to all token fields and zero-baseline changes.
Classify tool/LLM spans via traceloop.span.kind (LangGraph) and openinference.span.kind in addition to GenAI attributes, with a .tool name-suffix fallback; scope ownership validation, endpoint detection, and metrics to spans matching the runtime via aws.agent.id/cloud.resource_id so distributed traces with multiple runtimes are handled correctly; merge duplicate span records field by field, preferring defined runtime-log values.
Nanosecond-to-ms conversion leaked sub-microsecond floats and float-arithmetic noise into the --json contract, so two otherwise-equal runs could diff in CI. Round latency (ms) and percentage fields to one decimal at the output boundary; token and call-count fields stay integers.
Query gen_ai.request.model / gen_ai.response.model and report the distinct set of models used in each trace (preferring the response model). Surface them in the table and JSON, and warn when baseline and candidate used different models — a strong signal the traces are not directly comparable.
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
Problem
AgentCore traces can contain runtime, model, and tool spans across the shared
aws/spanslog group and endpoint-specific application log groups. CloudWatchdoes not currently provide a practical way to compare two invocations side by side, and its
trace view may show the invocation as one span containing many events.
Diagnosing a latency regression therefore requires manually exporting both
traces, correlating endpoint log groups, de-duplicating spans, and calculating
latency and token differences.
Solution
Adds
agentcore traces compareto compare two AgentCore runtime traces using CloudWatch telemetry.The command reports:
It supports traces from named runtime endpoints and validates the selected runtime.
Example