docs/en/integrations/databaseinsights/tools/databaseinsights-get-advanced-aggregated-wait-event-stats.md
The databaseinsights-get-advanced-aggregated-wait-event-stats tool retrieves aggregated wait event metrics (IO, Lock, CPU contention) to help diagnose database performance bottlenecks.
{{< compatible-sources >}}
databaseinsights.waitEventStats.fetch on the target location/project, which is granted by:
roles/databaseinsights.viewer)roles/monitoring.viewer)parent (String, Required)Project and location in the format projects/{project_id}/locations/{location}.
full_resource_name (String, Required)The full resource identifier for the database instance (e.g., //alloydb.googleapis.com/projects/{project_id}/locations/{location}/clusters/{cluster_id}/instances/{instance_id}).
start_time (String, Optional)Beginning of the time interval in RFC3339 format.
end_time (String, Optional)End of the time interval in RFC3339 format.
database (String, Optional)Filter wait event stats to a specific database.
username (String, Optional)Filter wait event stats to a specific database user.
query_id (String, Optional)Breakdown wait events for a specific query hash.
page_size (Integer, Optional)Maximum number of results to return (Default: 20).
page_token (String, Optional)Token for fetching subsequent pages of results.
view (String, Optional)Aggregation level (WAIT_CLASS or WAIT_EVENT). Defaults to WAIT_CLASS.
YAML Configuration:
kind: tool
name: get_aggregated_wait_event_stats
type: databaseinsights-get-advanced-aggregated-wait-event-stats
source: database-insights-source
Sample CLI Invocation:
./toolbox invoke get_advanced_aggregated_wait_event_stats \
--prebuilt alloydb-postgres-observability \
'{"parent":"projects/PROJECT_ID/locations/REGION","full_resource_name":"//alloydb.googleapis.com/projects/PROJECT_ID/locations/REGION/clusters/CLUSTER_ID/instances/INSTANCE_ID","view":"WAIT_CLASS","page_size":10}'
Returns a structured JSON object containing results (wait event categories and metrics) and metadata (schema columns):
{
"results": [],
"metadata": {
"fields": [
{"name": "wait_class", "type": "STRING"},
{"name": "sum(time_spent)", "type": "DOUBLE"},
{"name": "avg(time_spent)", "type": "DOUBLE"},
{"name": "sum(count)", "type": "DOUBLE"}
]
}
}
| field | type | required | description |
|---|---|---|---|
| type | string | true | Must be "databaseinsights-get-advanced-aggregated-wait-event-stats". |
| source | string | true | Name of the source the tool should execute on. |
| description | string | false | Optional description override. |