mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-21 23:48:47 +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,
|
||||
query as query_text,
|
||||
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
|
||||
WHERE creation_time BETWEEN "{start_time}" AND "{end_time}"
|
||||
{filters}
|
||||
|
@ -66,6 +66,7 @@ class BigqueryQueryParserSource(QueryParserSource, ABC):
|
||||
region=self.service_connection.usageLocation,
|
||||
filters=self.get_filters(),
|
||||
result_limit=self.source_config.resultLimit,
|
||||
cost_per_tib=self.service_connection.costPerTB,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
@ -116,6 +116,12 @@
|
||||
"supportsDataDiff": {
|
||||
"title": "Supports Data Diff Extraction.",
|
||||
"$ref": "../connectionBasicType.json#/definitions/supportsDataDiff"
|
||||
},
|
||||
"costPerTB": {
|
||||
"title": "Cost Per TiB",
|
||||
"description": "Cost per TiB for BigQuery usage",
|
||||
"type": "number",
|
||||
"default": 6.25
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
@ -16,6 +16,10 @@
|
||||
export interface BigQueryConnection {
|
||||
connectionArguments?: { [key: string]: any };
|
||||
connectionOptions?: { [key: string]: string };
|
||||
/**
|
||||
* Cost per TiB for BigQuery usage
|
||||
*/
|
||||
costPerTB?: number;
|
||||
/**
|
||||
* GCP Credentials
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user