Fix bugs in monitoring views
Also cleans up a bug in the script for publishing views to get udf_js/gunzip working, and removes accidental print statements in generate_sql.
This commit is contained in:
Родитель
e71d5145b1
Коммит
096a209ced
|
@ -51,11 +51,9 @@ def main():
|
|||
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
for root, dirs, files in os.walk(args.sql_dir):
|
||||
print("root: " + root)
|
||||
sql_files = [filename for filename in files if filename.endswith(".sql")]
|
||||
|
||||
basename = root.replace(args.sql_dir, d, 1)
|
||||
print(basename)
|
||||
if not os.path.exists(basename) and (dirs or sql_files):
|
||||
os.mkdir(basename)
|
||||
|
||||
|
@ -66,7 +64,6 @@ def main():
|
|||
full_text = prepend_udf_usage_definitions(text, raw_udfs)
|
||||
|
||||
with open(os.path.join(basename, filename), "a+") as output_file:
|
||||
print(os.path.join(basename, filename))
|
||||
output_file.write(full_text)
|
||||
|
||||
if os.path.exists(args.destination):
|
||||
|
|
|
@ -52,7 +52,7 @@ parser.add_argument(
|
|||
)
|
||||
parser.add_argument(
|
||||
"--dep-dir",
|
||||
default="udf/lib/",
|
||||
default="udf_js/lib/",
|
||||
help="The directory JavaScript dependency files for UDFs are stored.",
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.pipeline.structured_detailed_error_counts_v1`
|
||||
`moz-fx-data-shared-prod.monitoring.structured_detailed_error_counts_v1`
|
||||
AS
|
||||
WITH error_examples AS (
|
||||
SELECT
|
||||
|
@ -9,7 +9,7 @@ WITH error_examples AS (
|
|||
document_version,
|
||||
error_type,
|
||||
error_message,
|
||||
udf_js,gunzip(ANY_VALUE(payload)) AS sample_payload,
|
||||
`moz-fx-data-shared-prod.udf_js.gunzip`(ANY_VALUE(payload)) AS sample_payload,
|
||||
COUNT(*) AS error_count
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_error.structured`
|
||||
|
@ -27,7 +27,7 @@ WITH error_examples AS (
|
|||
error_message,
|
||||
sample_payload
|
||||
FROM
|
||||
structured_hourly_errors
|
||||
`moz-fx-data-shared-prod.monitoring.structured_error_counts_v1` structured_hourly_errors
|
||||
INNER JOIN
|
||||
error_examples USING (hour, document_namespace, document_type, document_version, error_type)
|
||||
), with_ratio AS (
|
||||
|
@ -37,5 +37,7 @@ WITH error_examples AS (
|
|||
FROM
|
||||
structured_detailed_hourly_errors
|
||||
)
|
||||
SELECT * FROM
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
with_ratio
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.pipeline.structured_error_counts_v1`
|
||||
`moz-fx-data-shared-prod.monitoring.structured_error_counts_v1`
|
||||
AS
|
||||
WITH ping_counts AS (
|
||||
SELECT
|
||||
|
@ -34,7 +34,7 @@ WITH ping_counts AS (
|
|||
document_version,
|
||||
error_type,
|
||||
ping_count + error_counts.error_count AS ping_count,
|
||||
error_counts.error_count,
|
||||
error_counts.error_count
|
||||
FROM
|
||||
ping_counts
|
||||
INNER JOIN
|
||||
|
@ -46,5 +46,7 @@ WITH ping_counts AS (
|
|||
FROM
|
||||
structured_hourly_errors
|
||||
)
|
||||
SELECT * FROM
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
with_ratio
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.pipeline.structured_detailed_error_counts_v1`
|
||||
`moz-fx-data-shared-prod.monitoring.structured_detailed_error_counts_v1`
|
||||
AS
|
||||
WITH error_examples AS (
|
||||
SELECT
|
||||
|
@ -9,7 +9,7 @@ WITH error_examples AS (
|
|||
document_version,
|
||||
error_type,
|
||||
error_message,
|
||||
udf_js,gunzip(ANY_VALUE(payload)) AS sample_payload,
|
||||
`moz-fx-data-shared-prod.udf_js.gunzip`(ANY_VALUE(payload)) AS sample_payload,
|
||||
COUNT(*) AS error_count
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_error.structured`
|
||||
|
@ -27,7 +27,7 @@ WITH error_examples AS (
|
|||
error_message,
|
||||
sample_payload
|
||||
FROM
|
||||
structured_hourly_errors
|
||||
`moz-fx-data-shared-prod.monitoring.structured_error_counts_v1` structured_hourly_errors
|
||||
INNER JOIN
|
||||
error_examples USING (hour, document_namespace, document_type, document_version, error_type)
|
||||
), with_ratio AS (
|
||||
|
@ -37,5 +37,7 @@ WITH error_examples AS (
|
|||
FROM
|
||||
structured_detailed_hourly_errors
|
||||
)
|
||||
SELECT * FROM
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
with_ratio
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.pipeline.structured_error_counts_v1`
|
||||
`moz-fx-data-shared-prod.monitoring.structured_error_counts_v1`
|
||||
AS
|
||||
WITH ping_counts AS (
|
||||
SELECT
|
||||
|
@ -34,7 +34,7 @@ WITH ping_counts AS (
|
|||
document_version,
|
||||
error_type,
|
||||
ping_count + error_counts.error_count AS ping_count,
|
||||
error_counts.error_count,
|
||||
error_counts.error_count
|
||||
FROM
|
||||
ping_counts
|
||||
INNER JOIN
|
||||
|
@ -46,5 +46,7 @@ WITH ping_counts AS (
|
|||
FROM
|
||||
structured_hourly_errors
|
||||
)
|
||||
SELECT * FROM
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
with_ratio
|
||||
|
|
Загрузка…
Ссылка в новой задаче