feat: Add BigQuery Agent Analytics Plugin#738
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a BigQuery Agent Analytics plugin for the ADK, featuring an asynchronous batch processor that uses Apache Arrow for efficient event logging. The implementation includes comprehensive callbacks for tracking agent, model, and tool interactions, along with configurable truncation logic for large payloads. Feedback suggests optimizing the flush mechanism to reduce goroutine churn, addressing a potential schema mismatch where nulls could be appended to a non-nullable timestamp field, and adding safeguards against infinite recursion in the JSON truncation utility.
Review: BigQuery Agent Analytics Plugin — Go PortThorough review against the Python reference implementation on HighH1. Missing sensitive key redaction (security) The Python version redacts H2. No circular reference detection The Python version tracks H3. Race condition on
H4. Mutex held during retry sleeps
MediumM1. Event type names don't match Python
If both SDKs write to the same BQ table, queries, dashboards, and the Python-side M2. Missing event types The Python version logs M3.
M4.
M5. Unbounded goroutine creation in if len(b.queue) == b.config.BatchSize {
go b.flush()
}
M6. Shutdown flush loop has no timeout check for len(b.queue) > 0 {
b.blockingFlush(shutdownCtx)
}If LowL1.
L2. The schema includes L3.
L4.
L5.
L6. Unrelated dependency bumps
Summary
The overall structure is solid — the batch processor, config, schema, and plugin lifecycle are well-designed. The main gaps are security (H1), concurrency safety (H3/H4), and cross-language schema parity (M1/M2). |
|
Review finding: Medium: plugin initialization swallows table-setup failures and can return a "working" plugin that will only fail later at write time. In Recommended fix: distinguish |
The
|
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
No Go version of the ADK BigQuery Agent Analytics Plugin
Solution:
Port the BigQuery Agent Analytics plugin available in Python and Java to Go ADK.
Testing Plan
Tests are included for the main plugin module bigquery_agent_analytics_plugin.go as well as for the batch_processor.go library and json_formatter.go utility.
Unit Tests:
The tests inject fake HTTP and GRPC clients which mock interactions with BigQuery API.
Manual End-to-End (E2E) Tests:
Usage example
Checklist
Additional context