Stay organized with collectionsSave and categorize content based on your preferences.
This page describes how to use Cloud Monitoring and Spanner audit
logs to monitor and analyze Spanner Data Boost usage.
Cloud Monitoring provides the ability to track total usage over time and to
break down that usage by user. Spanner audit logs allow more
flexible usage analysis, including providing metrics by user or by
BigQuery job ID.
Use Cloud Monitoring to track Data Boost usage
Follow these steps to track overall Data Boost usage:
IfMetrics Exploreris shown in the navigation menu, select it.
Otherwise, clickResources, and then selectMetrics Explorer.
At the top of the page, select a time interval.
In theMetricdrop-down list, in theFilter by resource or metric
namefield, enterspannerand pressEnterto narrow the search.
In theMetriclist, selectCloud Spanner Instance > Instance >
Processing unit second, and then clickApply.
This creates a line chart of aggregate Data Boost usage across
all Spanner instances.
To view usage for a particular instance, follow these steps:
Use theFilterfield to add filters, such as the instance ID.
Click+to add other attributes.
To view a breakdown of usage by all instances, follow these steps:
Clear any filters by clicking theXicon next to the filter
fields.
In theAggregationoperator drop-down list, selectSum, and then
select byinstance_id.
To break down usage by principal, in theAggregationoperator drop-down,
selectSum, and then select bycredential_id.
Use audit logs to analyze Data Boost usage
Spanner audit logs allow more flexible analysis of
Data Boost usage. In addition to the ability to break down usage
over time by instance or principal as with Cloud Monitoring,
Spanner audit logs, if enabled and available, allow breaking down
usage over time by database or BigQuery job ID.
To show usage by user and database over the past 7 days, run the following
query. To change the timespan for which usage is shown, modify thetimestampexpression in theWHEREclause.
SELECTSUM(CAST(JSON_VALUE(labels.data_boost_usage)ASINT64))ASusage,REGEXP_EXTRACT(proto_payload.audit_log.resource_name,'projects/[^/]+/instances/[^/]+/databases/[^/]+')ASdatabase,proto_payload.audit_log.authentication_info.principal_emailASprincipal_email,IFNULL(JSON_VALUE(labels.data_boost_workload_id),'not from BQ')ASjob_idFROM`PROJECT_NAME.global._Default._AllLogs`WHEREtimestamp>TIMESTAMP_SUB(CURRENT_TIMESTAMP(),INTERVAL7DAY)ANDresource.type='spanner_instance'ANDoperation.lastISNULLANDJSON_VALUE(labels.data_boost_usage)!=''GROUPBYdatabase,principal_email,job_id;
ReplacePROJECT_NAMEwith your project name.
The following example shows usage by BigQuery job ID.
View usage by BigQuery SQL text
To view Data Boost usage for multiple BigQuery jobs
aggregated by the SQL text of those jobs, follow these steps:
Go to the Logs Explorer in the Google Cloud console.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Monitor Data Boost usage\n\n\u003cbr /\u003e\n\nThis page describes how to use Cloud Monitoring and Spanner audit\nlogs to monitor and analyze Spanner Data Boost usage.\n\nCloud Monitoring provides the ability to track total usage over time and to\nbreak down that usage by user. Spanner audit logs allow more\nflexible usage analysis, including providing metrics by user or by\nBigQuery job ID.\n\nUse Cloud Monitoring to track Data Boost usage\n----------------------------------------------\n\nFollow these steps to track overall Data Boost usage:\n\n1. In the Google Cloud console, go to **Monitoring** . \n [Go to Monitoring](https://console.cloud.google.com/monitoring)\n2. If **Metrics Explorer** is shown in the navigation menu, select it. Otherwise, click **Resources** , and then select **Metrics Explorer**.\n3. At the top of the page, select a time interval.\n4. In the **Metric** drop-down list, in the **Filter by resource or metric\n name** field, enter `spanner` and press `Enter` to narrow the search.\n5. In the **Metric** list, select **Cloud Spanner Instance \\\u003e Instance \\\u003e\n Processing unit second** , and then click **Apply**.\n\n This creates a line chart of aggregate Data Boost usage across\n all Spanner instances.\n6. To view usage for a particular instance, follow these steps:\n\n 1. Use the **Filter** field to add filters, such as the instance ID.\n 2. Click **+** to add other attributes.\n7. To view a breakdown of usage by all instances, follow these steps:\n\n 1. Clear any filters by clicking the **X** icon next to the filter fields.\n 2. In the **Aggregation** operator drop-down list, select **Sum** , and then select by **instance_id**.\n8. To break down usage by principal, in the **Aggregation** operator drop-down,\n select **Sum** , and then select by **credential_id**.\n\nUse audit logs to analyze Data Boost usage\n------------------------------------------\n\nSpanner audit logs allow more flexible analysis of\nData Boost usage. In addition to the ability to break down usage\nover time by instance or principal as with Cloud Monitoring,\nSpanner audit logs, if enabled and available, allow breaking down\nusage over time by database or BigQuery job ID.\n\nEnabling audit logs can incur extra charges. For information about\nLogging pricing, see\n[Google Cloud Observability pricing: Cloud Logging](https://cloud.google.com/stackdriver/pricing#logging-costs).\n\n### Enable Data Boost usage audit logs\n\nYou must enable data access audit logs for Spanner before you can\ncollect usage data for Data Boost. To do so, follow these steps:\n\n1. Follow the instructions in [Configure Data Access audit logs with the Google Cloud console](/logging/docs/audit/configure-data-access#config-console).\n2. Enable the **Data Read** log type for the **Spanner API** service.\n3. To obtain Data Boost usage by BigQuery job SQL text, ensure that that the audit logs for BigQuery are enabled as well.\n\n### View usage by principal\n\nTo query the audit logs to view Data Boost usage by user, follow\nthese steps:\n\n1. Go to the Logs Explorer in the Google Cloud console.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs)\n2. In the navigation menu, click **Log Analytics**.\n\n3. To show usage by user and database over the past 7 days, run the following\n query. To change the timespan for which usage is shown, modify the\n `timestamp` expression in the `WHERE` clause.\n\n SELECT\n SUM(CAST(JSON_VALUE(labels.data_boost_usage) AS INT64)) AS usage,\n REGEXP_EXTRACT(\n proto_payload.audit_log.resource_name,\n 'projects/[^/]+/instances/[^/]+/databases/[^/]+') AS database,\n proto_payload.audit_log.authentication_info.principal_email AS principal_email\n FROM `\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePROJECT_NAME\u003c/span\u003e\u003c/var\u003e.global._Default._AllLogs`\n WHERE\n timestamp \u003e TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)\n AND resource.type = 'spanner_instance' AND operation.last IS NULL\n AND JSON_VALUE(labels.data_boost_usage) != ''\n GROUP BY database, principal_email;\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e with your project name.\n\nThe following example shows usage in processing units for 4 principals.\n\n### View usage by BigQuery job ID\n\nTo query the audit logs to view Data Boost usage broken down by\ndatabase, user, and BigQuery job ID, follow these steps:\n\n1. Go to the Logs Explorer in the Google Cloud console.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs)\n2. In the navigation menu, click **Log Analytics**.\n\n3. Run the following query:\n\n SELECT\n SUM(CAST(JSON_VALUE(labels.data_boost_usage) AS INT64)) AS usage,\n REGEXP_EXTRACT(\n proto_payload.audit_log.resource_name,\n 'projects/[^/]+/instances/[^/]+/databases/[^/]+') AS database,\n proto_payload.audit_log.authentication_info.principal_email AS principal_email,\n IFNULL(JSON_VALUE(labels.data_boost_workload_id), 'not from BQ') AS job_id\n FROM `\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePROJECT_NAME\u003c/span\u003e\u003c/var\u003e.global._Default._AllLogs`\n WHERE\n timestamp \u003e TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)\n AND resource.type = 'spanner_instance' AND operation.last IS NULL\n AND JSON_VALUE(labels.data_boost_usage) != ''\n GROUP BY database, principal_email, job_id;\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e with your project name.\n\nThe following example shows usage by BigQuery job ID.\n\n### View usage by BigQuery SQL text\n\nTo view Data Boost usage for multiple BigQuery jobs\naggregated by the SQL text of those jobs, follow these steps:\n\n1. Go to the Logs Explorer in the Google Cloud console.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs)\n2. In the navigation menu, click **Log Analytics**.\n\n3. Run the following query:\n\n SELECT\n SUM(\n CAST(\n JSON_VALUE(db.labels.data_boost_usage)\n AS INT64)) AS usage,\n JSON_VALUE(\n bq.proto_payload.audit_log.metadata.jobInsertion.job.jobConfig.queryConfig.query)\n AS bq_query\n FROM\n `\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePROJECT_NAME\u003c/span\u003e\u003c/var\u003e.global._Default._AllLogs` db,\n `\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePROJECT_NAME\u003c/span\u003e\u003c/var\u003e.global._Default._AllLogs` bq\n WHERE\n db.timestamp \u003e TIMESTAMP_SUB(\n CURRENT_TIMESTAMP(), INTERVAL 7 DAY)\n AND db.resource.type = 'spanner_instance'\n AND JSON_VALUE(db.labels.data_boost_usage) != ''\n AND db.operation.last IS NULL\n AND bq.timestamp \u003e TIMESTAMP_SUB(\n CURRENT_TIMESTAMP(), INTERVAL 7 DAY)\n AND bq.proto_payload.audit_log.method_name\n = 'google.cloud.bigquery.v2.JobService.InsertJob'\n AND bq.resource.type = 'bigquery_project'\n AND JSON_VALUE(\n bq.proto_payload.audit_log.metadata.jobInsertion.job.jobConfig.queryConfig.query)\n IS NOT NULL\n AND JSON_VALUE(db.labels.data_boost_workload_id)\n = REGEXP_EXTRACT(bq.proto_payload.audit_log.resource_name, '[^/]*$')\n GROUP BY bq_query\n ORDER BY usage DESC\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e with your project name.\n\nThe following example shows Data Boost usage by SQL text.\n\nCreate a Data Boost alert\n-------------------------\n\nTo create an alert that is issued when Data Boost usage exceeds\na predefined threshold, see\n[Set an alert for Data Boost usage](/spanner/docs/databoost/databoost-quotas#databoost-alert).\n\nWhat's next\n-----------\n\n- Learn about Data Boost in [Data Boost overview](/spanner/docs/databoost/databoost-overview)."]]