Is it possible to make a custom metric about a BigQuery SQL query?

2k Views Asked by At

Because there is no GCP Monitoring metric that can count the total number of rows in a BigQuery table I want to create a custom metric for that. My goal is to use that metric for visualization in a dashboard.

According to the documentation (https://cloud.google.com/monitoring/custom-metrics/creating-metrics#monitoring_create_metric-java) you can write a java script using the Monitoring API to create a custom metric. In addition to that I was wondering if I can use the BigQuery API and do a simple sql query to count the number of rows in a BigQuery table and use this as data points for the custom metric.

Is this possible?

Thanks for any answer in advance.

1

There are 1 best solutions below

6
On

Yes, of course, you can add a side jobs that create these custom metrics. In addition, on BigQuery, when you perform a select count(*) from TABLE, you pay nothing because this data is retrieve from the table metadata.