Skip to content

Commit

Permalink
Merge pull request #118 from stat-kwon/master
Browse files Browse the repository at this point in the history
Add Metric yaml files of BigQuery service
  • Loading branch information
stat-kwon authored May 10, 2024
2 parents 2966d43 + e3ced6b commit 2ff4f1c
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ def collect_cloud_service(self, params):
data_set_id,
google_cloud_monitoring_filters,
),
"stats": {
"table_count": len(
[
table
for table in updated_bq_tables
if table["type"] == "TABLE"
]
)
},
}
)
big_query_data = BigQueryWorkSpace(bq_dataset, strict=False)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
metric_id: metric-gcp-bigquery-workspace-count
name: SQLWorkspace Count
metric_type: GAUGE
resource_type: inventory.CloudService:google_cloud.BigQuery.SQLWorkspace
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: account
name: Project ID
search_key: account
- key: data.location
name: Location
search_key: data.location
fields:
value:
operator: count
unit: Count
namespace_id: ns-gcp-bigquery-sqlworkspace
version: '1.0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
metric_id: metric-gcp-bigquery-table-count
name: Table Count
metric_type: GAUGE
resource_type: inventory.CloudService:google_cloud.BigQuery.SQLWorkspace
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: account
name: Project ID
search_key: account
- key: data.location
name: Location
search_key: data.location
fields:
value:
key: data.stats.table_count
operator: count
unit: Count
namespace_id: ns-gcp-bigquery-sqlworkspace
version: '1.0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
metric_id: metric-gcp-ce-instance-disk-size
name: Disk Size
metric_type: GAUGE
resource_type: inventory.CloudService:google_cloud.ComputeEngine.Instance
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: data.compute.az
name: Availability Zone
search_key: data.compute.az
- key: account
name: Project ID
search_key: account
- key: instance_type
name: Instance Type
search_key: instance_type
- key: data.os.os_type
name: OS Type
search_key: data.os.os_type
unwind:
- path: data.disks
fields:
value:
key: data.disks.size
operator: sum
unit: BYTES
namespace_id: ns-gcp-ce-instance
version: '1.0'
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class BigQueryWorkSpace(BaseResource):

creation_time = DateTimeType(deserialize_from="creationTime")
last_modified_time = DateTimeType(deserialize_from="lastModifiedTime")
stats = DictType(StringType, default={})

def reference(self):
return {
Expand Down

0 comments on commit 2ff4f1c

Please sign in to comment.