-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(plugins): forward **kwargs to _log_event in all BigQuery plugin callbacks #4436
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
base: main
Are you sure you want to change the base?
fix(plugins): forward **kwargs to _log_event in all BigQuery plugin callbacks #4436
Conversation
…allbacks Only model callbacks (before_model_callback, after_model_callback) were passing **kwargs through to _log_event(), while all other callbacks silently dropped them. This meant custom attributes like `customer_id` passed via **kwargs were only logged for model events, not for agent, tool, run, or user message events. Updated the following callbacks to forward **kwargs to _log_event(): - on_user_message_callback - before_agent_callback / after_agent_callback - on_model_error_callback - before_tool_callback / after_tool_callback - on_tool_error_callback - before_run_callback / after_run_callback This ensures custom metadata is consistently serialized into the BigQuery `attributes` JSON field for all event types. Fixes google#4330
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @anmolg1997, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a logging inconsistency within the BigQuery agent analytics plugin. Previously, custom attributes passed as keyword arguments were only captured for model-related events, leading to incomplete data for other critical event types. The changes ensure that all specified callbacks now correctly propagate these custom attributes to the underlying logging mechanism, providing a more comprehensive and consistent data capture for all tracked events. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Response from ADK Triaging Agent Hello @anmolg1997, thank you for your contribution! Before we can merge this PR, you'll need to sign the Contributor License Agreement (CLA). It seems the Once the CLA is signed, we can proceed with the review. Thanks! |
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.
Code Review
This pull request addresses an inconsistency in the BigQuery plugin callbacks by ensuring that **kwargs are forwarded to the _log_event method. This fixes a bug where custom attributes were being dropped for several event types. The changes are consistently applied across all relevant callbacks, aligning them with the existing pattern in the file. The docstring updates also improve clarity. The changes are correct and well-implemented.
2ce0268 to
bb39cb3
Compare
|
I have signed the CLA - @googlebot please verify. |
bb39cb3 to
9678094
Compare
Link to Issue or Description of Change
**kwargsto_log_eventfor all callbacks (not just model callbacks) #4330Problem:
In
BigQueryAgentAnalyticsPlugin,before_model_callbackandafter_model_callbackcorrectly forward**kwargsto_log_event(), but every other callback (before_agent_callback,after_agent_callback,before_tool_callback,after_tool_callback,on_tool_error_callback,on_model_error_callback,on_user_message_callback,before_run_callback,after_run_callback) silently drops them. If you pass custom attributes likecustomer_id=...they only end up in the BigQueryattributescolumn for model events — everything else loses them.Solution:
Added
**kwargsto the_log_event()call in all 9 affected callbacks._log_eventalready accepts**kwargsso no signature changes needed, just forwarding what's already being received.Testing Plan
Unit Tests: