Google ADK Tool Instrumentation#1768
Conversation
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop-google-adk #1768 +/- ##
=====================================================
Coverage ? 81.37%
=====================================================
Files ? 216
Lines ? 26516
Branches ? 4180
=====================================================
Hits ? 21577
Misses ? 3538
Partials ? 1401 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| if settings.ai_monitoring.record_content.enabled: | ||
| tool_event_dict["input"] = str(tool_input) if tool_input else None | ||
| tool_event_dict["output"] = str(tool_output) if tool_output is not None else None |
There was a problem hiding this comment.
Can this be shortened to remove the is not None?
| transaction=transaction, | ||
| linking_metadata=linking_metadata, | ||
| ) | ||
| tool_event_dict["duration"] = ft.duration * 1000 |
There was a problem hiding this comment.
If we hit an error in _construct_base_tool_event_dict(), then tool_event_dict will be an empty dict. Recording the duration alone in an empty dict that doesn't have the tool name, ID, or any other info may not be useful. We may want to verify that tool_event_dict came back non-empty before adding the duration to it.
| except Exception: | ||
| _logger.warning(TOOL_EXTRACTOR_FAILURE_LOG_MESSAGE, exc_info=True) | ||
|
|
||
| func_name = callable_name(wrapped) |
There was a problem hiding this comment.
In our agent spec, it's not a requirement that we include the full callable name in the function trace name. Since this one is pretty long, I'm wondering if we're better off just using the name of the wrapped function. The goal with using the full name was more so to disambiguate the function name so the customer is clear what function was wrapped.
|
|
||
| ft = FunctionTrace(name=function_trace_name, group="Llm/tool/GoogleADK") | ||
| ft.__enter__() | ||
| ft._add_agent_attribute("subcomponent", json.dumps(agentic_subcomponent_data)) |
There was a problem hiding this comment.
Going forward, we will ideally only want to send the subcomponent attr if we have a local tool executing. Is there a way in the ADK repo to distinguish between remote and local tools and executions vs invocations?

Overview