-
Notifications
You must be signed in to change notification settings - Fork 133
Add Strands tools and agents instrumentation. #1563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
f20911e
Add baseline instrumentation.
umaannamalai c382f72
Add tool and agent instrumentation.
umaannamalai 78b57bb
Add tests file.
umaannamalai 6c6b40d
Cleanup instrumentation.
umaannamalai cdc2295
Cleanup.
umaannamalai c074175
[MegaLinter] Apply linters fixes
umaannamalai 1d9fc03
Strands Mock Model (#1551)
TimPansino e1cbba0
Add baseline instrumentation.
umaannamalai 5cf6c37
Add tool and agent instrumentation.
umaannamalai 1dfaf55
Add tests file.
umaannamalai df369a7
Cleanup instrumentation.
umaannamalai 69e1c88
Cleanup.
umaannamalai a5a3133
Handle additional args in mock model.
umaannamalai 9503558
Merge branch 'feat-strands-agents' of github.com:newrelic/newrelic-py…
umaannamalai e2ad09d
Add test to force exception and exercise _handle_tool_streaming_compl…
umaannamalai 4213bd3
Strands Mock Model (#1551)
TimPansino 520bd9a
Add baseline instrumentation.
umaannamalai 0bfe25d
Add tool and agent instrumentation.
umaannamalai b757886
Add tests file.
umaannamalai 4667155
Cleanup instrumentation.
umaannamalai cec6515
Cleanup.
umaannamalai bc841df
Handle additional args in mock model.
umaannamalai 78c7bd6
Strands Mock Model (#1551)
TimPansino 3863fdf
Add baseline instrumentation.
umaannamalai 30ab602
Add tool and agent instrumentation.
umaannamalai b4a6578
Cleanup.
umaannamalai 2b8107e
[MegaLinter] Apply linters fixes
umaannamalai 5527059
Add test to force exception and exercise _handle_tool_streaming_compl…
umaannamalai 21906b3
Merge branch 'feat-strands-agents' of github.com:newrelic/newrelic-py…
umaannamalai 57757d8
Merge branch 'develop-strands' into feat-strands-agents
umaannamalai 43bc792
Implement strands context passing instrumentation.
TimPansino 79ada63
Address review feedback.
umaannamalai 80e9d3d
[MegaLinter] Apply linters fixes
umaannamalai 36d4af2
Remove test_simple.py file.
umaannamalai 260c2bc
Merge branch 'feat-strands-agents' of github.com:newrelic/newrelic-py…
umaannamalai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Copyright 2010 New Relic, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| def _get_llm_metadata(transaction): | ||
| # Grab LLM-related custom attributes off of the transaction to store as metadata on LLM events | ||
| custom_attrs_dict = transaction._custom_params | ||
| llm_metadata_dict = {key: value for key, value in custom_attrs_dict.items() if key.startswith("llm.")} | ||
| llm_context_attrs = getattr(transaction, "_llm_context_attrs", None) | ||
| if llm_context_attrs: | ||
| llm_metadata_dict.update(llm_context_attrs) | ||
|
|
||
| return llm_metadata_dict |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless of wether there is a wrapper or not shouldn't we still set the parent to the current trace if there is a current trace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea here was that the if we had an async wrapper, then the trace context management would happen directly in the wrapper (ex: https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/async_wrapper.py#L25). This has been the same approach we take for other trace types such as ExternalTraces and FunctionTraces