feat(adk): pass telemetry attributes through toolbox-adk#720
feat(adk): pass telemetry attributes through toolbox-adk#720AjmeraParth132 wants to merge 3 commits into
Conversation
|
/gcbrun |
41cada5 to
ced41bb
Compare
|
/gcbrun |
2baed48 to
c69e841
Compare
|
/gcbrun |
anubhav756
left a comment
There was a problem hiding this comment.
As discussed let's add documentation to the docsite repo following this. I'm also thinking if we can optionally add some integration tests as well?
| attributes, | ||
| ) | ||
| resolved = context_getter(tool_context) | ||
| else: |
There was a problem hiding this comment.
optional: Is it by any chance still possible to pass a function with default arguments?
def get_telemetry(ctx: ToolContext, default_model: str = "gemini-3.5-flash") -> TelemetryAttributes:
return TelemetryAttributes(llm_model=default_model, ...)If so then len(sig.parameters) will be 2 and it falls through calling attributes() with 0 arguments and may complain about missing 1 required positional argument (ctx).
If it makes sense then should we also determine whether the function can accept 1 positional argument by checking parameter kinds and required parameters, or by inspecting positional parameters?
| telemetry_attributes: Optional[ | ||
| Union[ | ||
| TelemetryAttributes, | ||
| Callable[[], TelemetryAttributes], |
There was a problem hiding this comment.
optional: Curious what if the callable wants to resolve a None for user id for instance? Do we handle an empty string for that in this object or do we want to support Optional[TelemetryAttributes] as a return type of the callable? I'm fine with the former.
|
/gcbrun |
84265e7 to
fecb875
Compare
|
/gcbrun |
fecb875 to
611a197
Compare
twishabansal
left a comment
There was a problem hiding this comment.
Approving to unblock multi approvers CI check
Background
toolbox-corenow supportsTelemetryAttributesand sends them through MCP_metafor extended telemetry / SQLCommenter (#632, #634).toolbox-adkdid not expose that flow, so ADK users could not attach model, user ID, or agent ID metadata when invoking Toolbox tools throughToolboxToolset.This PR adds ADK pass-through support for telemetry attributes.
Changes
telemetry_attributestoToolboxToolset.telemetry_attributesinto each wrappedToolboxTool.telemetry_attributessupport toToolboxTool.TelemetryAttributesand sync/async callbacks.ToolContext, matching the existing auth token getterpattern from feat(adk): Support
ToolContextforauth_token_gettersintoolbox-adk#579.add_telemetry_attributes(...).leak between invocations.
bind_params(...)returns a new ADK wrapper.Related
ToolContextcallback pattern from feat(adk): SupportToolContextforauth_token_gettersintoolbox-adk#579.