Conversation
... on multiple projects fixup!
Add an environment variable to support overriding the default project for the BigQuery Client. By default this will be the project in which the cloud function is deployed.
Change the tests to use new utils module.
Change import pattern
Move utility methods into a utils module
* Restructures code into constants and exception modules * Implements Backlog Publisher / Subscriber algorithm for ordering incrementals * Implements basic integration tests for Publisher / Subscriber
|
you need to sign the first two commits. git commit --amend --author="Author Name <email@address.com>" |
jaketf
left a comment
There was a problem hiding this comment.
I'd like if the SQL had more structured place holders for dataset / project ids and a script to render them.
For example you could use envsubst
This way we could render them and dry run them in the cloud build so we'd have some basic level of CI on these queries.
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/README.md
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/README.md
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/README.md
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/README.md
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/README.md
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/gcf_ingest_log.sql
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/gcf_ingest_log.sql
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/gcf_ingest_log.sql
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/monitored_tables.sql
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/monitored_tables.sql
Outdated
Show resolved
Hide resolved
Adding the views and tables for ingest monitoring Remove unneeded sql Update README.md Fix formatting issues on the tables.
f8c6ed9 to
41ebdbd
Compare
…/README.md Re-Wording Co-authored-by: Jacob Ferriero <jferriero@google.com>
…/README.md Co-authored-by: Jacob Ferriero <jferriero@google.com>
…/README.md Co-authored-by: Jacob Ferriero <jferriero@google.com>
…/README.md Co-authored-by: Jacob Ferriero <jferriero@google.com>
…/README.md Co-authored-by: Jacob Ferriero <jferriero@google.com>
…query-utils into sequencing-monitoring
Adding additional information to the READMEmd
tools/cloud_functions/gcs_event_based_ingest/tests/gcs_ocn_bq_ingest/test_monitoring_tables.sh
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/gcs_ocn_bq_ingest/README.md
Outdated
Show resolved
Hide resolved
...unctions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/monitoring_tables_and_views.sql
Show resolved
Hide resolved
...unctions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/monitoring_tables_and_views.sql
Outdated
Show resolved
Hide resolved
...unctions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/monitoring_tables_and_views.sql
Outdated
Show resolved
Hide resolved
...unctions/gcs_event_based_ingest/gcs_ocn_bq_ingest/monitoring/monitoring_tables_and_views.sql
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/tests/gcs_ocn_bq_ingest/test_monitoring_tables.sh
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/tests/gcs_ocn_bq_ingest/test_monitoring_tables.sh
Outdated
Show resolved
Hide resolved
tools/cloud_functions/gcs_event_based_ingest/tests/gcs_ocn_bq_ingest/test_monitoring_tables.sh
Outdated
Show resolved
Hide resolved
Co-authored-by: Jacob Ferriero <jferriero@google.com>
…ingest/test_monitoring_tables.sh Co-authored-by: Jacob Ferriero <jferriero@google.com>
Move the monitoring.sql files up a directory Split out the monitoring sql into its own files (Note the numbering is to ensure the files are listed in the correct order because they are all dependent on one another) test_monitoring_tables.sh Made some alterations to test_monitoring_tables.sh to ensure dataset gets cleaned up even if the sqls error. removed the dry run argument from the bq query to ensure the sql is actually applied. Readme: Moved the Monitoring section out to the higher-level README cloudbuild.yaml Updated the cloudbuild to point to the new location of the tests.
Fix 03_gcf_ingest_latest_by_table.sql Some more README fixes.
|
Hey! It looks like I don't have permissions to delete datasets in your test project, which is causing my local tests to fail. |
| @@ -0,0 +1,28 @@ | |||
| /* | |||
There was a problem hiding this comment.
is there a reasoning for the numbering 01, 02, 03 in these query filenames? can we remove that?
There was a problem hiding this comment.
I see you need to run these sql in a certain order because they create metadata entries that you depend on existing and you're doing this with sort. If there's a way to just have an ordered list in the shell script that might be better than confusing filenames IMO.
| destination_table.project_id, | ||
| destination_table.dataset_id, | ||
| destination_table.table_id, | ||
| start_time; No newline at end of file |
| fi | ||
| done < <(find monitoring -path "*.sql" | sort) | ||
| echo "removing dataset $DATASET" | ||
| trap "bq rm -r -f -d $DATASET" EXIT |
There was a problem hiding this comment.
nit. this line will never get executed if there is a failure above. Trap statement should be moved to like 29 (see suggestion above).
| trap "bq rm -r -f -d $DATASET" EXIT |
| exit "$result" | ||
| fi | ||
| done < <(find monitoring -path "*.sql" | sort) | ||
| echo "removing dataset $DATASET" |
There was a problem hiding this comment.
| echo "removing dataset $DATASET" |
|
|
||
| export DATASET="test_monitoring_dataset_${BUILD_ID}" | ||
| echo "Creating ${DATASET}" | ||
| bq --location=US mk -f -d "$DATASET" |
There was a problem hiding this comment.
| bq --location=US mk -f -d "$DATASET" | |
| bq --location=US mk -f -d "$DATASET" | |
| trap 'echo "removing dataset $DATASET" && bq rm -r -f -d $DATASET' EXIT |
| @@ -0,0 +1,41 @@ | |||
| #!/bin/bash | |||
|
|
|||
| # Copyright 2019 Google Inc. | |||
There was a problem hiding this comment.
| # Copyright 2019 Google Inc. | |
| # Copyright 2021 Google Inc. |
| @@ -0,0 +1,51 @@ | |||
| /* | |||
| # Copyright 2020 Google LLC | |||
There was a problem hiding this comment.
| # Copyright 2020 Google LLC | |
| # Copyright 2021 Google LLC |
| @@ -0,0 +1,57 @@ | |||
| /* | |||
| # Copyright 2020 Google LLC | |||
There was a problem hiding this comment.
| # Copyright 2020 Google LLC | |
| # Copyright 2021 Google LLC |
| @@ -0,0 +1,28 @@ | |||
| /* | |||
| # Copyright 2020 Google LLC | |||
There was a problem hiding this comment.
| # Copyright 2020 Google LLC | |
| # Copyright 2021 Google LLC |
|
You can just install envsubst in Dockerfile.ci |
21bd43c to
98e7863
Compare
Here are the updates for the monitoring views.