From 235d57fa34106d471d738b97990ed50bd8be3479 Mon Sep 17 00:00:00 2001 From: Artem Vovk Date: Wed, 15 Feb 2023 13:51:36 -0700 Subject: [PATCH] Add table stats to Google Cloud Spanner receiver to track size/etc --- .../internal/metadataconfig/metadata.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/receiver/googlecloudspannerreceiver/internal/metadataconfig/metadata.yaml b/receiver/googlecloudspannerreceiver/internal/metadataconfig/metadata.yaml index 2cfa0e83408f..3ce1051cb3e7 100644 --- a/receiver/googlecloudspannerreceiver/internal/metadataconfig/metadata.yaml +++ b/receiver/googlecloudspannerreceiver/internal/metadataconfig/metadata.yaml @@ -519,3 +519,22 @@ metadata: data: type: "gauge" unit: "second" +# +# -------------------------------------------- Table Size Stats ------------------------------------------------------ +# + - name: "hourly table sizes stats" + query: "SELECT * FROM SPANNER_SYS.TABLE_SIZES_STATS_1HOUR WHERE INTERVAL_END = @pullTimestamp ORDER BY INTERVAL_END DESC, LOCK_WAIT_SECONDS DESC" + metric_name_prefix: "database/spanner/table_sizes/total/" + timestamp_column_name: "INTERVAL_END" + high_cardinality: true + labels: + - name: "table_name" + column_name: "TABLE_NAME" + value_type: "string" + metrics: + - name: "used_bytes" + column_name: "USED_BYTES" + value_type: "int" + data: + type: "gauge" + unit: "byte"