Skip to content

Commit 629c390

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Make BigQueryAgentAnalyticsPlugin state per-invocation
This change introduces per-invocation instances of BatchProcessor and TraceManager, managed by ConcurrentHashMaps keyed by invocation ID. This ensures that analytics and tracing data are isolated for each concurrent invocation. BatchProcessors and TraceManagers are created lazily on the first event for a given invocation and are cleaned up when the invocation completes. PiperOrigin-RevId: 900233194
1 parent f4cd1b7 commit 629c390

5 files changed

Lines changed: 420 additions & 150 deletions

File tree

core/src/main/java/com/google/adk/plugins/agentanalytics/BatchProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ private void populateVector(FieldVector vector, int index, Object value) {
249249

250250
@Override
251251
public void close() {
252-
if (this.queue != null && !this.queue.isEmpty()) {
252+
while (this.queue != null && !this.queue.isEmpty()) {
253253
this.flush();
254254
}
255255
if (this.allocator != null) {

0 commit comments

Comments
 (0)