-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Feature
Copy link
Labels
bq[Component] This issue is related to Big Query integration[Component] This issue is related to Big Query integration
Description
Problem Statement
When deploying ADK-based services in production environments, there's no straightforward way to include deployment metadata (service version, environment, commit SHA, deployment ID, etc.) in BigQuery analytics events. This metadata is essential for:
- Debugging production issues - Correlating agent behavior with specific deployments
- A/B testing and rollouts - Comparing metrics across different service versions
- Environment filtering - Separating production vs staging vs development analytics
- Audit and compliance - Tracking which version of the service generated specific events
Current Workaround
Currently, users must manually inject these attributes into every event, which is:
- Error-prone (easy to forget)
- Repetitive (same metadata on every call)
- Not centralized (scattered across the codebase)
Proposed Solution
Add a default_attributes configuration option to BigQueryLoggerConfig that automatically merges static key-value pairs into every logged event's attributes field.
Example Usage
config = BigQueryLoggerConfig(
default_attributes={
"service_version": os.getenv("SERVICE_VERSION", "unknown"),
"environment": os.getenv("ENVIRONMENT", "development"),
"commit_sha": os.getenv("COMMIT_SHA", "unknown"),
"deployment_id": os.getenv("DEPLOYMENT_ID"),
}
)
plugin = BigQueryAgentAnalyticsPlugin(
project_id="my-project",
dataset_id="adk_analytics",
config=config,
)Behavior
- Default attributes are merged with event-specific attributes
- Event-specific attributes take precedence on key conflicts
- Fully backward compatible (
default_attributesdefaults toNone)
Use Case
We're building an AI concierge service using ADK and need to track which deployment version generated each analytics event. This allows us to:
- Query events by environment:
WHERE JSON_VALUE(attributes, '$.environment') = 'production' - Debug specific commits:
WHERE JSON_VALUE(attributes, '$.commit_sha') = 'abc123' - Compare version performance:
GROUP BY JSON_VALUE(attributes, '$.service_version')
Implementation
PR: #4207
Metadata
Metadata
Assignees
Labels
bq[Component] This issue is related to Big Query integration[Component] This issue is related to Big Query integration