feat(mapper): added framework detection for traces from CloudWatch#164
Merged
poshinchen merged 1 commit intostrands-agents:mainfrom Mar 20, 2026
Merged
Conversation
afarntrog
reviewed
Mar 17, 2026
Contributor
|
I would like to see a real world successful run - can just be pasted in the comments here |
afarntrog
reviewed
Mar 17, 2026
e62d5c9 to
14047a7
Compare
14047a7 to
125907d
Compare
125907d to
c3ad181
Compare
c3ad181 to
2f34e9c
Compare
afarntrog
reviewed
Mar 20, 2026
Contributor
afarntrog
left a comment
There was a problem hiding this comment.
Since this is lots of parsing logic I would like to see some robust test that pass in JSON files of what we would expect to get from a log insights query and pass that through this parsing logic etc. We should have a bunch of these for different cases.
In addition, more for later, I would like to see integration tests that run through a real scenario so that we can detect early on if something in our parsing logic is broken/needs updating.
afarntrog
approved these changes
Mar 20, 2026
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.
Description
Users could have non-Strands traces in CloudWatch (via the collector). Our current CloudWatchProvider is using CloudWatchSessionMapper which only works for Strands.
Since we're going to have the mapper which is "framework / convention specific", we will deprecate CloudWatchSessionMapper and route the traces / spans to the correct mapper via
detect_otel_mappermethod.What has been changed
aws/spanslog group for span hierarchy (spanId → parentSpanId), enriching event records that previously had parent_span_id: None for all spans.This is a best-effort enrichment — failure falls back gracefully.
role == "unknown"with raw string contentinput_strin parsed body (skipstool_call_with_contextduplicates)kwargs.name == "LangGraph"live/Traceloop behavior.
_trace_tools_mapreplaced with localtrace_toolsdict. Added per-call caches (_span_messages_cache, _adot_body_cache) reset each map_to_session()call.
for non-empty text.
Tested
TestMapperAutoDetection— verifies auto-detection for Strands, LangChain (OpenLLMetry), OpenInference scopes, explicit mapper override, and default None mapperTestScopePreservation— verifies CloudWatchLogsParser preserves scope.name for LangChain (OpenLLMetry), OpenInference, Strands, spans with events, and synthetic spansTestSpanConversionandTestSessionBuildingupdated to use pytest fixtures (deprecation warning compat)Related Issues
#91
Documentation PR
N/A
Type of Change
Bug fix
Breaking change
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.