mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-22 16:08:13 +00:00
Capture BQ Query Cost (#20124)
This commit is contained in:
parent
d1ae36129c
commit
c5c724887e
@ -32,7 +32,8 @@ BIGQUERY_STATEMENT = textwrap.dedent(
|
|||||||
end_time,
|
end_time,
|
||||||
query as query_text,
|
query as query_text,
|
||||||
null as schema_name,
|
null as schema_name,
|
||||||
total_slot_ms as duration
|
total_slot_ms as duration,
|
||||||
|
(total_bytes_billed / POWER(2, 40)) * {cost_per_tib} as cost
|
||||||
FROM `region-{region}`.INFORMATION_SCHEMA.JOBS_BY_PROJECT
|
FROM `region-{region}`.INFORMATION_SCHEMA.JOBS_BY_PROJECT
|
||||||
WHERE creation_time BETWEEN "{start_time}" AND "{end_time}"
|
WHERE creation_time BETWEEN "{start_time}" AND "{end_time}"
|
||||||
{filters}
|
{filters}
|
||||||
|
@ -66,6 +66,7 @@ class BigqueryQueryParserSource(QueryParserSource, ABC):
|
|||||||
region=self.service_connection.usageLocation,
|
region=self.service_connection.usageLocation,
|
||||||
filters=self.get_filters(),
|
filters=self.get_filters(),
|
||||||
result_limit=self.source_config.resultLimit,
|
result_limit=self.source_config.resultLimit,
|
||||||
|
cost_per_tib=self.service_connection.costPerTB,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -116,6 +116,12 @@
|
|||||||
"supportsDataDiff": {
|
"supportsDataDiff": {
|
||||||
"title": "Supports Data Diff Extraction.",
|
"title": "Supports Data Diff Extraction.",
|
||||||
"$ref": "../connectionBasicType.json#/definitions/supportsDataDiff"
|
"$ref": "../connectionBasicType.json#/definitions/supportsDataDiff"
|
||||||
|
},
|
||||||
|
"costPerTB": {
|
||||||
|
"title": "Cost Per TiB",
|
||||||
|
"description": "Cost per TiB for BigQuery usage",
|
||||||
|
"type": "number",
|
||||||
|
"default": 6.25
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
export interface BigQueryConnection {
|
export interface BigQueryConnection {
|
||||||
connectionArguments?: { [key: string]: any };
|
connectionArguments?: { [key: string]: any };
|
||||||
connectionOptions?: { [key: string]: string };
|
connectionOptions?: { [key: string]: string };
|
||||||
|
/**
|
||||||
|
* Cost per TiB for BigQuery usage
|
||||||
|
*/
|
||||||
|
costPerTB?: number;
|
||||||
/**
|
/**
|
||||||
* GCP Credentials
|
* GCP Credentials
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user