Skip to content

Commit

Permalink
fix: add Metric yaml files of BigQuery service
Browse files Browse the repository at this point in the history
Signed-off-by: seolmin <[email protected]>
  • Loading branch information
stat-kwon committed May 10, 2024
1 parent b86e1d4 commit e3ced6b
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 e3ced6b

Please sign in to comment.