Skip to content

Commit 1dcb59b

Browse files
chalmerloweJon Wayne Parrottdpebotjmdobrywaprin
authored
migrate code from googleapis/python-logging (#13844)
* Update logging samples to fit new style guide and match Node.js samples. [(#435)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/435) * Fix test conflict. Change-Id: I67e149dc43ebdb11144ac3839e062aa4668ebb2e * Fix logging test. Change-Id: I866edcc956fda2265dd7af7b774336930ec6a151 * Auto-update dependencies. [(#456)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/456) * Fix import order lint errors Change-Id: Ieaf7237fc6f925daec46a07d2e81a452b841198a * Auto-update dependencies. [(#540)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/540) * Auto-update dependencies. [(#542)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/542) * Move to google-cloud [(#544)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/544) * Add new "quickstart" samples [(#547)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/547) * Quickstart tests [(#569)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/569) * Add tests for quickstarts * Update secrets * Generate readmes for most service samples [(#599)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/599) * Update samples to support latest Google Cloud Python [(#656)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/656) * Auto-update dependencies. [(#715)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/715) * Remove cloud config fixture [(#887)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/887) * Remove cloud config fixture * Fix client secrets * Fix bigtable instance * Fix reference to our testing tools * Auto-update dependencies. [(#914)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/914) * Auto-update dependencies. * xfail the error reporting test * Fix lint * Re-generate all readmes * Fix README rst links [(#962)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/962) * Fix README rst links * Update all READMEs * Auto-update dependencies. [(#1004)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1004) * Auto-update dependencies. * Fix natural language samples * Fix pubsub iam samples * Fix language samples * Fix bigquery samples * Auto-update dependencies. [(#1055)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1055) * Auto-update dependencies. * Explicitly use latest bigtable client Change-Id: Id71e9e768f020730e4ca9514a0d7ebaa794e7d9e * Revert language update for now Change-Id: I8867f154e9a5aae00d0047c9caf880e5e8f50c53 * Remove pdb. smh Change-Id: I5ff905fadc026eebbcd45512d4e76e003e3b2b43 * Fix logging tests Change-Id: I6691c70912b1e1b5993e962a4827a846642feac3 * Auto-update dependencies. [(#1093)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1093) * Auto-update dependencies. * Fix storage notification poll sample Change-Id: I6afbc79d15e050531555e4c8e51066996717a0f3 * Fix spanner samples Change-Id: I40069222c60d57e8f3d3878167591af9130895cb * Drop coverage because it's not useful Change-Id: Iae399a7083d7866c3c7b9162d0de244fbff8b522 * Try again to fix flaky logging test Change-Id: I6225c074701970c17c426677ef1935bb6d7e36b4 * Update all generated readme auth instructions [(#1121)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1121) Change-Id: I03b5eaef8b17ac3dc3c0339fd2c7447bd3e11bd2 * Added Link to Python Setup Guide [(#1158)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1158) * Update Readme.rst to add Python setup guide As requested in b/64770713. This sample is linked in documentation https://cloud.google.com/bigtable/docs/scaling, and it would make more sense to update the guide here than in the documentation. * Update README.rst * Update README.rst * Update README.rst * Update README.rst * Update README.rst * Update install_deps.tmpl.rst * Updated readmegen scripts and re-generated related README files * Fixed the lint error * Fix a few more lint issues Change-Id: I0d420f3053f391fa225e4b8179e45fd1138f5c65 * Auto-update dependencies. [(#1186)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1186) * Add sample for standard library logging handler configuration [(#1233)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1233) * Add sample for standard library logging handler configuration * Add handler.py to readme * Added "Open in Cloud Shell" buttons to README files [(#1254)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1254) * Auto-update dependencies. [(#1359)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1359) * Auto-update dependencies. [(#1377)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1377) * Auto-update dependencies. * Update requirements.txt * Regenerate the README files and fix the Open in Cloud Shell link for some samples [(#1441)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1441) * Update READMEs to fix numbering and add git clone [(#1464)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1464) * Update logging doc tags. [(#1634)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1634) * Fix deprecation warning [(#1801)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1801) logging.warn -> logging.warning to fix "DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead" * Auto-update dependencies. [(#1846)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1846) ACK, merging. * Auto-update dependencies. [(#1980)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1980) * Auto-update dependencies. * Update requirements.txt * Update requirements.txt * Adds split updates for Firebase ... opencensus [(#2438)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/2438) * Auto-update dependencies. [(#2005)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/2005) * Auto-update dependencies. * Revert update of appengine/flexible/datastore. * revert update of appengine/flexible/scipy * revert update of bigquery/bqml * revert update of bigquery/cloud-client * revert update of bigquery/datalab-migration * revert update of bigtable/quickstart * revert update of compute/api * revert update of container_registry/container_analysis * revert update of dataflow/run_template * revert update of datastore/cloud-ndb * revert update of dialogflow/cloud-client * revert update of dlp * revert update of functions/imagemagick * revert update of functions/ocr/app * revert update of healthcare/api-client/fhir * revert update of iam/api-client * revert update of iot/api-client/gcs_file_to_device * revert update of iot/api-client/mqtt_example * revert update of language/automl * revert update of run/image-processing * revert update of vision/automl * revert update testing/requirements.txt * revert update of vision/cloud-client/detect * revert update of vision/cloud-client/product_search * revert update of jobs/v2/api_client * revert update of jobs/v3/api_client * revert update of opencensus * revert update of translate/cloud-client * revert update to speech/cloud-client Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Co-authored-by: Doug Mahugh <dmahugh@gmail.com> * chore(deps): update dependency google-cloud-logging to v1.15.0 [(#3161)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3161) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [google-cloud-logging](https://togithub.com/googleapis/python-logging) | minor | `==1.14.0` -> `==1.15.0` | --- ### Release Notes <details> <summary>googleapis/python-logging</summary> ### [`v1.15.0`](https://togithub.com/googleapis/python-logging/blob/master/CHANGELOG.md#&#8203;1150httpswwwgithubcomgoogleapispython-loggingcomparev1140v1150-2020-02-26) [Compare Source](https://togithub.com/googleapis/python-logging/compare/v1.14.0...v1.15.0) ##### Features - add support for cmek settings; undeprecate resource name helper methods; bump copyright year to 2020 ([#&#8203;22](https://www.github.com/googleapis/python-logging/issues/22)) ([1c687c1](https://www.github.com/googleapis/python-logging/commit/1c687c168cdc1f5ebc74d2380ad87335a42209a2)) ##### Bug Fixes - **logging:** deprecate resource name helper methods (via synth) ([#&#8203;9837](https://www.github.com/googleapis/python-logging/issues/9837)) ([335af9e](https://www.github.com/googleapis/python-logging/commit/335af9e909eb7fb4696ba906a82176611653531d)) - **logging:** update test assertion and core version pins ([#&#8203;10087](https://www.github.com/googleapis/python-logging/issues/10087)) ([4aedea8](https://www.github.com/googleapis/python-logging/commit/4aedea80e2bccb5ba3c41fae7a0ee46cc07eefa9)) - replace unsafe six.PY3 with PY2 for better future compatibility with Python 4 ([#&#8203;10081](https://www.github.com/googleapis/python-logging/issues/10081)) ([c6eb601](https://www.github.com/googleapis/python-logging/commit/c6eb60179d674dfd5137d90d209094c9369b3581)) </details> --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Never, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#GoogleCloudPlatform/python-docs-samples). * Simplify noxfile setup. [(#2806)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/2806) * chore(deps): update dependency requests to v2.23.0 * Simplify noxfile and add version control. * Configure appengine/standard to only test Python 2.7. * Update Kokokro configs to match noxfile. * Add requirements-test to each folder. * Remove Py2 versions from everything execept appengine/standard. * Remove conftest.py. * Remove appengine/standard/conftest.py * Remove 'no-sucess-flaky-report' from pytest.ini. * Add GAE SDK back to appengine/standard tests. * Fix typo. * Roll pytest to python 2 version. * Add a bunch of testing requirements. * Remove typo. * Add appengine lib directory back in. * Add some additional requirements. * Fix issue with flake8 args. * Even more requirements. * Readd appengine conftest.py. * Add a few more requirements. * Even more Appengine requirements. * Add webtest for appengine/standard/mailgun. * Add some additional requirements. * Add workaround for issue with mailjet-rest. * Add responses for appengine/standard/mailjet. Co-authored-by: Renovate Bot <bot@renovateapp.com> * [logging] chore: remove gcp-devrel-py-tools [(#3477)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3477) * Update logging example to retrieve the default handler [(#3691)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3691) * Update handler.py * Update README.rst * Update handler.py Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> * testing: various cleanups [(#3877)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3877) * testing: various cleanups * [iap]: only run iap tests on Kokoro * [vision/automl]: use temporary directory for temporary files * [appengine/flexible/scipy]: use temporary directory * [bigtable/snippets/reads]: update pytest snapshot * [texttospeech/cloud-client]: added output.mp3 to .gitignore * [iot/api-client/gcs_file_to_device]: use temporary directory * [iot/api-client/mqtt_example]: use temporary directory * [logging/cloud-client]: use uuid and add backoff * use project directory with Trampoline V1 * chore(deps): update dependency pytest to v5.4.3 [(#4279)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/4279) * chore(deps): update dependency pytest to v5.4.3 * specify pytest for python 2 in appengine Co-authored-by: Leah Cole <coleleah@google.com> * Update dependency pytest to v6 [(#4390)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/4390) * chore(deps): update dependency google-cloud-logging to v1.15.1 [(#4458)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/4458) * chore: update templates * feat!: use microgenerator (#94) The bulk of the changes are to the handwritten code (`gogle/cloud/logging_v2/*.py`). Changes are listed in `UPGRADING.md`. * `_gapic` uses the microgenerated surface * Add support for parent resources that are not `project` (`folder`, `billingAccount`, `organization`) where appropriate for log entries and sinks. * Use google-style docstrings * Optional params can only be passed as kwargs * chore(deps): update dependency google-cloud-logging to v2 (#95) * chore: Re-generated to pick up changes from synthtool. (#98) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * fix: address lint issues Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com> Source-Date: Thu Nov 12 11:30:49 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: e89175cf074dccc4babb4eca66ae913696e47a71 Source-Link: https://github.com/googleapis/synthtool/commit/e89175cf074dccc4babb4eca66ae913696e47a71 * docs(python): update intersphinx for grpc and auth * docs(python): update intersphinx for grpc and auth * use https for python intersphinx Co-authored-by: Tim Swast <swast@google.com> Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Wed Nov 18 14:37:25 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 9a7d9fbb7045c34c9d3d22c1ff766eeae51f04c9 Source-Link: https://github.com/googleapis/synthtool/commit/9a7d9fbb7045c34c9d3d22c1ff766eeae51f04c9 * docs(python): fix intersphinx link for google-auth Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Thu Nov 19 10:16:05 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: a073c873f3928c561bdf87fdfbf1d081d1998984 Source-Link: https://github.com/googleapis/synthtool/commit/a073c873f3928c561bdf87fdfbf1d081d1998984 * chore: Re-generated to pick up changes from googleapis. (#97) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * feat: Makes remaining LogBucket and LogViews methods public PiperOrigin-RevId: 342353190 Source-Author: Google APIs <noreply@google.com> Source-Date: Fri Nov 13 15:44:35 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: be0bdf86cd31aa7c1a7b30a9a2e9f2fd53ee3d91 Source-Link: https://github.com/googleapis/googleapis/commit/be0bdf86cd31aa7c1a7b30a9a2e9f2fd53ee3d91 * fixed lint issue Co-authored-by: Daniel Sanche <sanche@google.com> * chore(deps): update dependency google-cloud-logging to v2.0.1 (#109) * chore: Re-generated to pick up changes from synthtool. (#127) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore: add config / docs for 'pre-commit' support Source-Author: Tres Seaver <tseaver@palladion.com> Source-Date: Tue Dec 1 16:01:20 2020 -0500 Source-Repo: googleapis/synthtool Source-Sha: 32af6da519a6b042e3da62008e2a75e991efb6b4 Source-Link: https://github.com/googleapis/synthtool/commit/32af6da519a6b042e3da62008e2a75e991efb6b4 * chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.3.0 Source-Author: WhiteSource Renovate <bot@renovateapp.com> Source-Date: Wed Dec 2 17:18:24 2020 +0100 Source-Repo: googleapis/synthtool Source-Sha: 69629b64b83c6421d616be2b8e11795738ec8a6c Source-Link: https://github.com/googleapis/synthtool/commit/69629b64b83c6421d616be2b8e11795738ec8a6c * test(python): give filesystem paths to pytest-cov https://pytest-cov.readthedocs.io/en/latest/config.html The pytest-cov docs seem to suggest a filesystem path is expected. Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Wed Dec 2 09:28:04 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: f94318521f63085b9ccb43d42af89f153fb39f15 Source-Link: https://github.com/googleapis/synthtool/commit/f94318521f63085b9ccb43d42af89f153fb39f15 * chore: update noxfile.py.j2 * Update noxfile.py.j2 add changes from @glasnt to the template template to ensure that enforcing type hinting doesn't fail for repos with the sample noxfile (aka all samples repos) See https://github.com/GoogleCloudPlatform/python-docs-samples/pull/4869/files for context * fix typo Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com> Source-Date: Thu Dec 3 13:44:30 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: 18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1 Source-Link: https://github.com/googleapis/synthtool/commit/18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1 * docs: fix usage guide (#140) * chore(deps): update dependency google-cloud-bigquery to v2.6.2 (#150) * chore(deps): update dependency google-cloud-logging to v2.1.1 (#152) * chore(deps): update dependency google-cloud-logging to v2.2.0 (#164) * chore(deps): update dependency google-cloud-bigquery to v2.7.0 (#166) * docs: add python std_logging to sample browser (#173) * docs: add existing region tag to python std logging This is so this existing Python example will show up here: https://cloud.google.com/logging/docs/samples/logging-stdlogging * chore: update templates (#168) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore: add 3.9 to noxfile template Since the python-docs-samples noxfile-template doesn't sync with this, I wanted to make sure the noxfile template matched the most recent change [here](https://github.com/GoogleCloudPlatform/python-docs-samples/pull/4968/files) cc @tmatsuo Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com> Source-Date: Fri Jan 15 17:24:05 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 56ddc68f36b32341e9f22c2c59b4ce6aa3ba635f Source-Link: https://github.com/googleapis/synthtool/commit/56ddc68f36b32341e9f22c2c59b4ce6aa3ba635f * build(python): make `NOX_SESSION` optional I added this accidentally in #889. `NOX_SESSION` should be passed down if it is set but not marked required. Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Tue Jan 19 09:38:04 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: ba960d730416fe05c50547e975ce79fcee52c671 Source-Link: https://github.com/googleapis/synthtool/commit/ba960d730416fe05c50547e975ce79fcee52c671 * chore: Add header checker config to python library synth Now that we have it working in [python-docs-samples](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/header-checker-lint.yml) we should consider adding it to the 🐍 libraries :) Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com> Source-Date: Mon Jan 25 13:24:08 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 573f7655311b553a937f9123bee17bf78497db95 Source-Link: https://github.com/googleapis/synthtool/commit/573f7655311b553a937f9123bee17bf78497db95 * chore: add noxfile parameters for extra dependencies Also, add tests for some noxfile parameters for assurance that the template generates valid Python. Co-authored-by: Jeffrey Rennie <rennie@google.com> Source-Author: Tim Swast <swast@google.com> Source-Date: Tue Jan 26 12:26:57 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 778d8beae28d6d87eb01fdc839a4b4d966ed2ebe Source-Link: https://github.com/googleapis/synthtool/commit/778d8beae28d6d87eb01fdc839a4b4d966ed2ebe * chore(deps): update dependency google-cloud-storage to v1.35.1 (#172) * chore(deps): update dependency google-cloud-pubsub to v2.3.0 (#176) * chore(deps): update dependency google-cloud-pubsub to v2.4.0 (#191) * chore(deps): update dependency google-cloud-storage to v1.36.1 (#182) * chore(deps): update dependency google-cloud-bigquery to v2.10.0 (#180) Co-authored-by: Daniel Sanche <sanche@google.com> * chore(deps): update dependency google-cloud-storage to v1.36.2 (#215) * chore(deps): update dependency google-cloud-bigquery to v2.11.0 (#212) * chore(deps): update dependency google-cloud-logging to v2.3.0 (#221) * chore(deps): update dependency google-cloud-bigquery to v2.12.0 (#224) * chore(deps): update dependency google-cloud-logging to v2.3.1 (#242) * chore(deps): update dependency google-cloud-bigquery to v2.13.1 (#232) Co-authored-by: Daniel Sanche <sanche@google.com> * chore(deps): update dependency google-cloud-pubsub to v2.4.1 (#246) * chore(deps): update dependency google-cloud-storage to v1.37.0 (#243) Co-authored-by: Daniel Sanche <sanche@google.com> * chore(deps): update dependency google-cloud-storage to v1.37.1 (#255) * chore: migrate to owl bot (#270) * chore: migrate to owl bot * chore: copy files from googleapis-gen 130ce904e5d546c312943d10f48799590f9c0f66 * chore: run the post processor * 🦉 Updates from OwlBot Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency google-cloud-bigquery to v2.14.0 (#271) * chore(deps): update dependency google-cloud-bigquery to v2.15.0 (#277) * chore(deps): update dependency pytest to v6.2.3 (#273) * chore(deps): update dependency google-cloud-storage to v1.38.0 (#272) Co-authored-by: Daniel Sanche <sanche@google.com> * chore(deps): update dependency pytest to v6.2.4 (#280) * chore(deps): update dependency google-cloud-bigquery to v2.16.0 (#282) * chore(deps): update dependency google-cloud-pubsub to v2.4.2 (#288) * chore(deps): update dependency google-cloud-storage to v1.37.0 (#243) Co-authored-by: Daniel Sanche <sanche@google.com> * chore(deps): update dependency google-cloud-storage to v1.37.1 (#255) * chore: migrate to owl bot (#270) * chore: migrate to owl bot * chore: copy files from googleapis-gen 130ce904e5d546c312943d10f48799590f9c0f66 * chore: run the post processor * 🦉 Updates from OwlBot Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency google-cloud-bigquery to v2.14.0 (#271) * chore(deps): update dependency google-cloud-bigquery to v2.15.0 (#277) * chore(deps): update dependency pytest to v6.2.3 (#273) * chore(deps): update dependency google-cloud-storage to v1.38.0 (#272) Co-authored-by: Daniel Sanche <sanche@google.com> * chore(deps): update dependency pytest to v6.2.4 (#280) * chore(deps): update dependency google-cloud-bigquery to v2.16.0 (#282) * chore(deps): update dependency google-cloud-pubsub to v2.4.2 (#288) * chore(deps): update dependency google-cloud-logging to v2.4.0 (#296) * chore(deps): update dependency google-cloud-bigquery to v2.16.1 (#297) * chore(deps): update dependency google-cloud-pubsub to v2.5.0 (#303) * chore: new owl bot post processor docker image (#308) gcr.io/repo-automation-bots/owlbot-python:latest@sha256:3c3a445b3ddc99ccd5d31edc4b4519729635d20693900db32c4f587ed51f7479 * chore(deps): update dependency google-cloud-bigquery to v2.17.0 (#306) * chore(deps): update dependency google-cloud-bigquery to v2.18.0 (#312) * chore(deps): update dependency google-cloud-bigquery to v2.20.0 (#317) * test: clean up extra topics from snippet tests (#324) * added code to remove extra topics in snippet tests * fixed lint issue * chore(deps): update dependency google-cloud-logging to v2.5.0 (#326) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-logging](https://togithub.com/googleapis/python-logging) | `==2.4.0` -> `==2.5.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-logging/2.5.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-logging/2.5.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-logging/2.5.0/compatibility-slim/2.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-logging/2.5.0/confidence-slim/2.4.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-logging</summary> ### [`v2.5.0`](https://togithub.com/googleapis/python-logging/blob/master/CHANGELOG.md#&#8203;250-httpswwwgithubcomgoogleapispython-loggingcomparev240v250-2021-06-10) [Compare Source](https://togithub.com/googleapis/python-logging/compare/v2.4.0...v2.5.0) ##### Features - support AuditLog and RequestLog protos ([#&#8203;274](https://www.github.com/googleapis/python-logging/issues/274)) ([5d91be9](https://www.github.com/googleapis/python-logging/commit/5d91be9f121c364cbd53c6a9fffc4fb6ca6bd324)) ##### Bug Fixes - **deps:** add packaging requirement ([#&#8203;300](https://www.github.com/googleapis/python-logging/issues/300)) ([68c5cec](https://www.github.com/googleapis/python-logging/commit/68c5ceced3288253af8e3c6013a35fa3954b37bc)) - structured log handler formatting issues ([#&#8203;319](https://www.github.com/googleapis/python-logging/issues/319)) ([db9da37](https://www.github.com/googleapis/python-logging/commit/db9da3700511b5a24c3c44c9f4377705937caf46)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-logging). * chore(deps): update dependency google-cloud-storage to v1.39.0 (#335) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-storage](https://togithub.com/googleapis/python-storage) | `==1.38.0` -> `==1.39.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/compatibility-slim/1.38.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/confidence-slim/1.38.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-storage</summary> ### [`v1.39.0`](https://togithub.com/googleapis/python-storage/blob/master/CHANGELOG.md#&#8203;1390-httpswwwgithubcomgoogleapispython-storagecomparev1380v1390-2021-06-21) [Compare Source](https://togithub.com/googleapis/python-storage/compare/v1.38.0...v1.39.0) ##### Features - media operation retries can be configured using the same interface as with non-media operation ([#&#8203;447](https://www.github.com/googleapis/python-storage/issues/447)) ([0dbbb8a](https://www.github.com/googleapis/python-storage/commit/0dbbb8ac17a4b632707485ee6c7cc15e4670efaa)) ##### Bug Fixes - add ConnectionError to default retry ([#&#8203;445](https://www.github.com/googleapis/python-storage/issues/445)) ([8344253](https://www.github.com/googleapis/python-storage/commit/8344253a1969b9d04b81f87a6d7bddd3ddb55006)) - apply idempotency policies for ACLs ([#&#8203;458](https://www.github.com/googleapis/python-storage/issues/458)) ([2232f38](https://www.github.com/googleapis/python-storage/commit/2232f38933dbdfeb4f6585291794d332771ffdf2)) - replace python lifecycle action parsing ValueError with warning ([#&#8203;437](https://www.github.com/googleapis/python-storage/issues/437)) ([2532d50](https://www.github.com/googleapis/python-storage/commit/2532d506b44fc1ef0fa0a996822d29e7459c465a)) - revise blob.compose query parameters `if_generation_match` ([#&#8203;454](https://www.github.com/googleapis/python-storage/issues/454)) ([70d19e7](https://www.github.com/googleapis/python-storage/commit/70d19e72831dee112bb07f38b50beef4890c1155)) ##### Documentation - streamline 'timeout' / 'retry' docs in docstrings ([#&#8203;461](https://www.github.com/googleapis/python-storage/issues/461)) ([78b2eba](https://www.github.com/googleapis/python-storage/commit/78b2eba81003b437cd24f2b8d269ea2455682507)) - streamline docstrings for conditional parmas ([#&#8203;464](https://www.github.com/googleapis/python-storage/issues/464)) ([6999370](https://www.github.com/googleapis/python-storage/commit/69993702390322df07cc2e818003186a47524c2b)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-logging). * chore(deps): update dependency google-cloud-bigquery to v2.21.0 (#349) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-bigquery](https://togithub.com/googleapis/python-bigquery) | `==2.20.0` -> `==2.21.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.21.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.21.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.21.0/compatibility-slim/2.20.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.21.0/confidence-slim/2.20.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-bigquery</summary> ### [`v2.21.0`](https://togithub.com/googleapis/python-bigquery/blob/master/CHANGELOG.md#&#8203;2210-httpswwwgithubcomgoogleapispython-bigquerycomparev2200v2210-2021-07-12) [Compare Source](https://togithub.com/googleapis/python-bigquery/compare/v2.20.0...v2.21.0) ##### Features - Add max_results parameter to some of the `QueryJob` methods. ([#&#8203;698](https://www.github.com/googleapis/python-bigquery/issues/698)) ([2a9618f](https://www.github.com/googleapis/python-bigquery/commit/2a9618f4daaa4a014161e1a2f7376844eec9e8da)) - Add support for decimal target types. ([#&#8203;735](https://www.github.com/googleapis/python-bigquery/issues/735)) ([7d2d3e9](https://www.github.com/googleapis/python-bigquery/commit/7d2d3e906a9eb161911a198fb925ad79de5df934)) - Add support for table snapshots. ([#&#8203;740](https://www.github.com/googleapis/python-bigquery/issues/740)) ([ba86b2a](https://www.github.com/googleapis/python-bigquery/commit/ba86b2a6300ae5a9f3c803beeb42bda4c522e34c)) - Enable unsetting policy tags on schema fields. ([#&#8203;703](https://www.github.com/googleapis/python-bigquery/issues/703)) ([18bb443](https://www.github.com/googleapis/python-bigquery/commit/18bb443c7acd0a75dcb57d9aebe38b2d734ff8c7)) - Make it easier to disable best-effort deduplication with streaming inserts. ([#&#8203;734](https://www.github.com/googleapis/python-bigquery/issues/734)) ([1246da8](https://www.github.com/googleapis/python-bigquery/commit/1246da86b78b03ca1aa2c45ec71649e294cfb2f1)) - Support passing struct data to the DB API. ([#&#8203;718](https://www.github.com/googleapis/python-bigquery/issues/718)) ([38b3ef9](https://www.github.com/googleapis/python-bigquery/commit/38b3ef96c3dedc139b84f0ff06885141ae7ce78c)) ##### Bug Fixes - Inserting non-finite floats with `insert_rows()`. ([#&#8203;728](https://www.github.com/googleapis/python-bigquery/issues/728)) ([d047419](https://www.github.com/googleapis/python-bigquery/commit/d047419879e807e123296da2eee89a5253050166)) - Use `pandas` function to check for `NaN`. ([#&#8203;750](https://www.github.com/googleapis/python-bigquery/issues/750)) ([67bc5fb](https://www.github.com/googleapis/python-bigquery/commit/67bc5fbd306be7cdffd216f3791d4024acfa95b3)) ##### Documentation - Add docs for all enums in module. ([#&#8203;745](https://www.github.com/googleapis/python-bigquery/issues/745)) ([145944f](https://www.github.com/googleapis/python-bigquery/commit/145944f24fedc4d739687399a8309f9d51d43dfd)) - Omit mention of Python 2.7 in `CONTRIBUTING.rst`. ([#&#8203;706](https://www.github.com/googleapis/python-bigquery/issues/706)) ([27d6839](https://www.github.com/googleapis/python-bigquery/commit/27d6839ee8a40909e4199cfa0da8b6b64705b2e9)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-logging). * chore(deps): update dependency google-cloud-bigquery to v2.22.0 (#355) * feat: add Samples section to CONTRIBUTING.rst (#357) Source-Link: https://github.com/googleapis/synthtool/commit/52e4e46eff2a0b70e3ff5506a02929d089d077d4 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:6186535cbdbf6b9fe61f00294929221d060634dae4a0795c1cefdbc995b2d605 * chore(deps): update dependency google-cloud-pubsub to v2.6.1 (#332) * chore(deps): update dependency google-cloud-bigquery to v2.22.1 (#358) * chore(deps): update dependency backoff to v1.11.1 (#348) * chore(deps): update dependency google-cloud-storage to v1.41.1 (#344) * chore(deps): update dependency google-cloud-pubsub to v2.7.0 (#364) * chore(deps): update dependency google-cloud-bigquery to v2.23.1 (#362) * chore(deps): update dependency google-cloud-logging to v2.6.0 (#365) * chore(deps): update dependency google-cloud-bigquery to v2.23.2 (#366) * chore(deps): update dependency google-cloud-bigquery to v2.23.3 (#370) * chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py (#371) Source-Link: https://github.com/googleapis/synthtool/commit/6252f2cd074c38f37b44abe5e96d128733eb1b61 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:50e35228649c47b6ca82aa0be3ff9eb2afce51c82b66c4a03fe4afeb5ff6c0fc * chore(deps): update dependency google-cloud-bigquery to v2.24.0 (#374) Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com> * chore(deps): update dependency google-cloud-storage to v1.42.0 (#373) * chore(deps): update dependency google-cloud-bigquery to v2.24.1 (#377) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-bigquery](https://togithub.com/googleapis/python-bigquery) | `==2.24.0` -> `==2.24.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.24.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.24.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.24.1/compatibility-slim/2.24.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.24.1/confidence-slim/2.24.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-bigquery</summary> ### [`v2.24.1`](https://togithub.com/googleapis/python-bigquery/blob/master/CHANGELOG.md#&#8203;2241-httpswwwgithubcomgoogleapispython-bigquerycomparev2240v2241-2021-08-13) [Compare Source](https://togithub.com/googleapis/python-bigquery/compare/v2.24.0...v2.24.1) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-logging). * chore(deps): update dependency google-cloud-bigquery to v2.25.0 (#379) * chore(deps): update dependency google-cloud-bigquery to v2.25.1 (#381) * chore(deps): update dependency pytest to v6.2.5 (#383) Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(deps): update dependency google-cloud-bigquery to v2.25.2 (#386) * chore(deps): update dependency google-cloud-bigquery to v2.26.0 (#388) * chore(deps): update dependency google-cloud-pubsub to v2.8.0 (#391) * chore(deps): update dependency google-cloud-storage to v1.42.1 (#393) * chore(deps): update dependency google-cloud-storage to v1.42.2 (#398) * chore(python): fix formatting issue in noxfile.py.j2 (#417) fix: improper types in pagers generation fix: add 'dict' annotation type to 'request' fix(deps): require proto-plus==1.15.0 * chore(deps): update all dependencies (#418) * chore(docs): remove get_default_handler call from setup docs (#421) * chore(docs): added audit log sample to usage guide (#428) * chore(deps): update all dependencies (#436) * chore(deps): update dependency google-cloud-bigquery to v2.30.0 (#437) * chore(deps): update all dependencies (#438) * chore(deps): update all dependencies * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency google-cloud-pubsub to v2.9.0 (#441) * chore(deps): update dependency google-cloud-storage to v1.43.0 (#449) * chore(deps): update dependency google-cloud-bigquery to v2.31.0 (#451) * chore: use python-samples-reviewers (#461) * chore(samples): Add check for tests in directory (#463) Source-Link: https://github.com/googleapis/synthtool/commit/52aef91f8d25223d9dbdb4aebd94ba8eea2101f3 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency google-cloud-storage to v1.44.0 (#460) Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(deps): update all dependencies (#466) * chore(python): Noxfile recognizes that tests can live in a folder (#468) Source-Link: https://github.com/googleapis/synthtool/commit/4760d8dce1351d93658cb11d02a1b7ceb23ae5d7 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * docs: update usage guide for v3.0.0 (#456) * chore(deps): update dependency google-cloud-storage to v2.1.0 (#469) * chore(deps): update all dependencies (#477) * chore(deps): update dependency pytest to v7.0.1 (#490) * chore(deps): update all dependencies (#492) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-bigquery](https://togithub.com/googleapis/python-bigquery) | `==2.32.0` -> `==2.34.2` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.34.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.34.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.34.2/compatibility-slim/2.32.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/2.34.2/confidence-slim/2.32.0)](https://docs.renovatebot.com/merge-confidence/) | | [google-cloud-pubsub](https://togithub.com/googleapis/python-pubsub) | `==2.9.0` -> `==2.10.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.10.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.10.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.10.0/compatibility-slim/2.9.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.10.0/confidence-slim/2.9.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-bigquery</summary> ### [`v2.34.2`](https://togithub.com/googleapis/python-bigquery/blob/HEAD/CHANGELOG.md#&#8203;2342-httpsgithubcomgoogleapispython-bigquerycomparev2341v2342-2022-03-05) [Compare Source](https://togithub.com/googleapis/python-bigquery/compare/v2.34.1...v2.34.2) ### [`v2.34.1`](https://togithub.com/googleapis/python-bigquery/blob/HEAD/CHANGELOG.md#&#8203;2341-httpsgithubcomgoogleapispython-bigquerycomparev2340v2341-2022-03-02) [Compare Source](https://togithub.com/googleapis/python-bigquery/compare/v2.34.0...v2.34.1) ### [`v2.34.0`](https://togithub.com/googleapis/python-bigquery/blob/HEAD/CHANGELOG.md#&#8203;2340-httpsgithubcomgoogleapispython-bigquerycomparev2330v2340-2022-02-18) [Compare Source](https://togithub.com/googleapis/python-bigquery/compare/v2.33.0...v2.34.0) ##### Features - support BI Engine statistics in query job ([#&#8203;1144](https://togithub.com/googleapis/python-bigquery/issues/1144)) ([7482549](https://togithub.com/googleapis/python-bigquery/commit/7482549cb42ed5302634ab4fb7b4efcd97b35c68)) ### [`v2.33.0`](https://togithub.com/googleapis/python-bigquery/blob/HEAD/CHANGELOG.md#&#8203;2330-httpsgithubcomgoogleapispython-bigquerycomparev2320v2330-2022-02-16) [Compare Source](https://togithub.com/googleapis/python-bigquery/compare/v2.32.0...v2.33.0) ##### Features - add `--no_query_cache` option to `%%bigquery` magics to disable query cache ([#&#8203;1141](https://togithub.com/googleapis/python-bigquery/issues/1141)) ([7dd30af](https://togithub.com/googleapis/python-bigquery/commit/7dd30af41b8a595b96176c964ba14aa41645ef0d)) ##### Bug Fixes - return 403 when VPC-SC violation happens ([#&#8203;1131](https://togithub.com/googleapis/python-bigquery/issues/1131)) ([f5daa9b](https://togithub.com/googleapis/python-bigquery/commit/f5daa9b41377a58cb3220bb2ab7c72adc6462196)) ##### Documentation - reference BigQuery REST API defaults in `LoadJobConfig` descrip… ([#&#8203;1132](https://togithub.com/googleapis/python-bigquery/issues/1132)) ([18d9580](https://togithub.com/googleapis/python-bigquery/commit/18d958062721d6be81e7bd7a5bd66f277344a864)) - show common job properties in `get_job` and `cancel_job` samples ([#&#8203;1137](https://togithub.com/googleapis/python-bigquery/issues/1137)) ([8edc10d](https://togithub.com/googleapis/python-bigquery/commit/8edc10d019bd96defebc4f92a47774901e9b956f)) </details> <details> <summary>googleapis/python-pubsub</summary> ### [`v2.10.0`](https://togithub.com/googleapis/python-pubsub/blob/HEAD/CHANGELOG.md#&#8203;2100-httpsgithubcomgoogleapispython-pubsubcomparev290v2100-2022-03-04) [Compare Source](https://togithub.com/googleapis/python-pubsub/compare/v2.9.0...v2.10.0) ##### Features - add api key support ([#&#8203;571](https://togithub.com/googleapis/python-pubsub/issues/571)) ([cdda762](https://togithub.com/googleapis/python-pubsub/commit/cdda762f6d15d96f5e2d7fac975f3494dc49eaa9)) - add exactly once delivery flag ([#&#8203;577](https://togithub.com/googleapis/python-pubsub/issues/577)) ([d6614e2](https://togithub.com/googleapis/python-pubsub/commit/d6614e274328c58449e67dfc788e2e7986c0c10b)) - add support for exactly once delivery ([#&#8203;578](https://togithub.com/googleapis/python-pubsub/issues/578)) ([95a86fa](https://togithub.com/googleapis/python-pubsub/commit/95a86fa5f528701b760064f0cece0efa4e60cd44)) - exactly-once delivery support ([#&#8203;550](https://togithub.com/googleapis/python-pubsub/issues/550)) ([2fb6e15](https://togithub.com/googleapis/python-pubsub/commit/2fb6e1533192ae81dceee5c71283169a0a85a015)) ##### Bug Fixes - **deps:** move libcst to extras ([#&#8203;585](https://togithub.com/googleapis/python-pubsub/issues/585)) ([0846762](https://togithub.com/googleapis/python-pubsub/commit/084676243ca4afd54cda601e589b80883f9703a3)) - refactor client classes for safer type checking ([#&#8203;552](https://togithub.com/googleapis/python-pubsub/issues/552)) ([7f705be](https://togithub.com/googleapis/python-pubsub/commit/7f705beb927383f14b9d56f0341ee0de101f7c05)) - resolve DuplicateCredentialArgs error when using credentials_file ([8ca8cf2](https://togithub.com/googleapis/python-pubsub/commit/8ca8cf27333baf823a1dffd081e63079f1a12625)) ##### Samples - samples: create subscription with filtering enabled [#&#8203;580](https://togithub.com/googleapis/python-pubsub/pull/580) - samples: handle empty response in sync pull samples [#&#8203;586](https://togithub.com/googleapis/python-pubsub/pull/586) - samples: sample for receiving messages with exactly-once delivery enabled [#&#8203;588](https://togithub.com/googleapis/python-pubsub/pull/588) - samples: create subscription with exactly once delivery [#&#8203;592](https://togithub.com/googleapis/python-pubsub/pull/592) [https://github.com/googleapis/python-pubsub/pull/588](https://togithub.com/googleapis/python-pubsub/pull/588)/588 ##### Documentation - add autogenerated code snippets ([aa3754c](https://togithub.com/googleapis/python-pubsub/commit/aa3754cf432bd02be2734a23a32d5b36cd216aee)) - Docs have inconsistent default values for max_latency and max_bytes ([#&#8203;572](https://togithub.com/googleapis/python-pubsub/issues/572)) ([d136dfd](https://togithub.com/googleapis/python-pubsub/commit/d136dfdb69ebeebd1411a1415f863b94d07078f0)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-logging). * chore: Adding support for pytest-xdist and pytest-parallel (#496) Source-Link: https://github.com/googleapis/synthtool/commit/38e11ad1104dcc1e63b52691ddf2fe4015d06955 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 * chore(deps): update dependency google-cloud-pubsub to v2.11.0 (#499) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-pubsub](https://togithub.com/googleapis/python-pubsub) | `==2.10.0` -> `==2.11.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.11.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.11.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.11.0/compatibility-slim/2.10.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.11.0/confidence-slim/2.10.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-pubsub</summary> ### [`v2.11.0`](https://togithub.com/googleapis/python-pubsub/blob/HEAD/CHANGELOG.md#&#8203;2110-httpsgithubcomgoogleapispython-pubsubcomparev2100v2110-2022-03-09) [Compare Source](https://togithub.com/googleapis/python-pubsub/compare/v2.10.0...v2.11.0) ##### Features - retry temporary GRPC statuses for ack/modack/nack when exactly-once delivery is enabled ([#&#8203;607](https://togithub.com/googleapis/python-pubsub/issues/607)) ([a91bed8](https://togithub.com/googleapis/python-pubsub/commit/a91bed829c9040fcc6c1e70b99b66188ac4ded40)) - return singleton success future for exactly-once methods in Message ([#&#8203;608](https://togithub.com/googleapis/python-pubsub/issues/608)) ([253ced2](https://togithub.com/googleapis/python-pubsub/commit/253ced28f308450c7a1a93cc38f6d101ecd7d4c0)) ##### Bug Fixes - **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#&#8203;600](https://togithub.com/googleapis/python-pubsub/issues/600)) ([1608b7f](https://togithub.com/googleapis/python-pubsub/commit/1608b7ffdd5b5db87e1e55fde763440ca9a4086e)) - **deps:** require proto-plus>=1.15.0 ([1608b7f](https://togithub.com/googleapis/python-pubsub/commit/1608b7ffdd5b5db87e1e55fde763440ca9a4086e)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-logging). * chore(deps): update all dependencies (#502) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-storage](https://togithub.com/googleapis/python-storage) | `==2.1.0` -> `==2.2.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/2.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/2.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/2.2.0/compatibility-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/2.2.0/confidence-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) | | [pytest](https://docs.pytest.org/en/latest/) ([source](https://togithub.com/pytest-dev/pytest), [changelog](https://docs.pytest.org/en/stable/changelog.html)) | `==7.0.1` -> `==7.1.0` | [![age](https://badges.renovateapi.com/packages/pypi/pytest/7.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/pytest/7.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/pytest/7.1.0/compatibility-slim/7.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/pytest/7.1.0/confidence-slim/7.0.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-storage</summary> ### [`v2.2.0`](https://togithub.com/googleapis/python-storage/blob/HEAD/CHANGELOG.md#&#8203;220-httpsgithubcomgoogleapispython-storagecomparev210v220-2022-03-14) [Compare Source](https://togithub.com/googleapis/python-storage/compare/v2.1.0...v2.2.0) ##### Features - allow no project in client methods using storage emulator ([#&#8203;703](https://togithub.com/googleapis/python-storage/issues/703)) ([bcde0ec](https://togithub.com/googleapis/python-storage/commit/bcde0ec619d7d303892bcc0863b7f977c79f7649)) ##### Bug Fixes - add user agent in python-storage when calling resumable media ([c7bf615](https://togithub.com/googleapis/python-storage/commit/c7bf615909a04f3bab3efb1047a9f4ba659bba19)) - **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#&#8203;722](https://togithub.com/googleapis/python-storage/issues/722)) ([e9aab38](https://togithub.com/googleapis/python-storage/commit/e9aab389f868799d4425133954bad4f1cbb85786)) - Fix BlobReader handling of interleaved reads and seeks ([#&#8203;721](https://togithub.com/googleapis/python-storage/issues/721)) ([5d1cfd2](https://togithub.com/googleapis/python-storage/commit/5d1cfd2050321481a3bc4acbe80537ea666506fa)) - retry client side requests timeout ([#&#8203;727](https://togithub.com/googleapis/python-storage/issues/727)) ([e0b3b35](https://togithub.com/googleapis/python-storage/commit/e0b3b354d51e4be7c563d7f2f628a7139df842c0)) ##### Documentation - fixed download_blob_to_file example ([#&#8203;704](https://togithub.com/googleapis/python-storage/issues/704)) ([2c94d98](https://togithub.com/googleapis/python-storage/commit/2c94d98ed21cc768cfa54fac3d734254fc4d8480)) </details> <details> <summary>pytest-dev/pytest</summary> ### [`v7.1.0`](https://togithub.com/pytest-dev/pytest/releases/7.1.0) [Compare Source](https://togithub.com/pytest-dev/pytest/compare/7.0.1...7.1.0) # pytest 7.1.0 (2022-03-13) ## Breaking Changes - [#&#8203;8838](https://togithub.com/pytest-dev/pytest/issues/8838): As per our policy, the following features have been deprecated in the 6.X series and are now removed: - `pytest._fillfuncargs` function. - `pytest_warning_captured` hook - use `pytest_warning_recorded` instead. - `-k -foobar` syntax - use `-k 'not foobar'` instead. - `-k foobar:` syntax. - `pytest.collect` module - import from `pytest` directly. For more information consult [Deprecations and Removals](https://docs.pytest.org/en/latest/deprecations.html) in the docs. - [#&#8203;9437](https://togithub.com/pytest-dev/pytest/issues/9437): Dropped support for Python 3.6, which reached [end-of-life](https://devguide.python.org/#status-of-python-branches) at 2021-12-23. ## Improvements - [#&#8203;5192](https://togithub.com/pytest-dev/pytest/issues/5192): Fixed test output for some data types where `-v` would show less information. Also, when showing diffs for sequences, `-q` would produce full diffs instead of the expected diff. - [#&#8203;9362](https://togithub.com/pytest-dev/pytest/issues/9362): pytest now avoids specialized assert formatting when it is detected that the default `__eq__` is overridden in `attrs` or `dataclasses`. - [#&#8203;9536](https://togithub.com/pytest-dev/pytest/issues/9536): When `-vv` is given on command line, show skipping and xfail reasons in full instead of truncating them to fit the terminal width. - [#&#8203;9644](https://togithub.com/pytest-dev/pytest/issues/9644): More information about the location of resources that led Python to raise `ResourceWarning`{.interpreted-text role="class"} can now be obtained by enabling `tracemalloc`{.interpreted-text role="mod"}. See `resource-warnings`{.interpreted-text role="ref"} for more information. - [#&#8203;9678](https://togithub.com/pytest-dev/pytest/issues/9678): More types are now accepted in the `ids` argument to `@pytest.mark.parametrize`. Previously only \[str]{.title-ref}, \[float]{.title-ref}, \[int]{.title-ref} and \[bool]{.title-ref} were accepted; now \[bytes]{.title-ref}, \[complex]{.title-ref}, \[re.Pattern]{.title-ref}, \[Enum]{.title-ref} and anything with a \[\__name\_\_]{.title-ref} are also accepted. - [#&#8203;9692](https://togithub.com/pytest-dev/pytest/issues/9692): `pytest.approx`{.interpreted-text role="func"} now raises a `TypeError`{.interpreted-text role="class"} when given an unordered sequence (such as `set`{.interpreted-text role="class"}). Note that this implies that custom classes which only implement `__iter__` and `__len__` are no longer supported as they don't guarantee order. ## Bug Fixes - [#&#8203;8242](https://togithub.com/pytest-dev/pytest/issues/8242): The deprecation of raising `unittest.SkipTest`{.interpreted-text role="class"} to skip collection of tests during the pytest collection phase is reverted - this is now a supported feature again. - [#&#8203;9493](https://togithub.com/pytest-dev/pytest/issues/9493): Symbolic link components are no longer resolved in conftest paths. This means that if a conftest appears twice in collection tree, using symlinks, it will be executed twice. For example, given > tests/real/conftest.py > tests/real/test_it.py > tests/link -> tests/real running `pytest tests` now imports the conftest twice, once as `tests/real/conftest.py` and once as `tests/link/conftest.py`. This is a fix to match a similar change made to test collection itself in pytest 6.0 (see `6523`{.interpreted-text role="pull"} for details). - [#&#8203;9626](https://togithub.com/pytest-dev/pytest/issues/9626): Fixed count of selected tests on terminal collection summary when there were errors or skipped modules. If there were errors or skipped modules on collection, pytest would mistakenly subtract those from the selected count. - [#&#8203;9645](https://togithub.com/pytest-dev/pytest/issues/9645): Fixed regression where `--import-mode=importlib` used together with `PYTHONPATH`{.interpreted-text role="envvar"} or `pythonpath`{.interpreted-text role="confval"} would cause import errors in test suites. - [#&#8203;9708](https://togithub.com/pytest-dev/pytest/issues/9708): `pytester`{.interpreted-text role="fixture"} now requests a `monkeypatch`{.interpreted-text role="fixture"} fixture instead of creating one internally. This solves some issues with tests that involve pytest environment variables. - [#&#8203;9730](https://togithub.com/pytest-dev/pytest/issues/9730): Malformed `pyproject.toml` files now produce a clearer error message. </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-logging). * chore(deps): update dependency google-cloud-storage to v2.2.1 (#506) * chore(deps): update dependency pytest to v7.1.1 (#509) Co-authored-by: Drew Brown <drewbr@google.com> * chore(python): use black==22.3.0 (#513) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe * chore(deps): update dependency google-cloud-bigquery to v2.34.3 (#514) * chore(deps): update dependency google-cloud-bigquery to v3 (#520) Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(python): add nox session to sort python imports (#538) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update all dependencies (#532) * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Drew Brown <drewbr@google.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * fix: require python 3.7+ (#580) * chore(python): drop python 3.6 Source-Link: https://github.com/googleapis/synthtool/commit/4f89b13af10d086458f9b379e56a614f9d6dab7b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c * add api_description to .repo-metadata.json * require python 3.7+ in setup.py * revert templated README * remove python 3.6 sample configs * exclude templated README Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(deps): update all dependencies (#591) * chore(deps): update all dependencies * revert Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(deps): update all dependencies (#593) * chore(deps): update all dependencies * revert Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(deps): update all dependencies (#596) * chore(deps): update all dependencies * revert Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(deps): update all dependencies (#599) Co-authored-by: Daniel Sanche <d.sanche14@gmail.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * chore(deps): update dependency google-cloud-pubsub to v2.13.6 (#604) * chore(deps): update dependency google-cloud-logging to v3.2.2 (#608) * chore(deps): update dependency google-cloud-bigquery to v3.3.2 (#609) * chore(deps): update dependency pytest to v7.1.3 (#619) * chore: detect samples tests in nested directories (#628) Source-Link: https://github.com/googleapis/synthtool/commit/50db768f450a50d7c1fd62513c113c9bb96fd434 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978 * fix: mimic the pubsub test to clean up bigquery datasets (#639) *…
1 parent bc50019 commit 1dcb59b

15 files changed

+1271
-0
lines changed

logging/samples/AUTHORING_GUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md

logging/samples/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/CONTRIBUTING.md
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file is used to generate README.rst
2+
3+
product:
4+
name: Cloud Logging
5+
short_name: Cloud Logging
6+
url: https://cloud.google.com/logging/docs
7+
description: >
8+
`Cloud Logging`_ allows you to store, search, analyze, monitor,
9+
and alert on log data and events from Google Cloud Platform and Amazon
10+
Web Services.
11+
12+
setup:
13+
- auth
14+
- install_deps
15+
16+
samples:
17+
- name: Quickstart
18+
file: quickstart.py
19+
- name: Snippets
20+
file: snippets.py
21+
show_help: true
22+
- name: Export
23+
file: export.py
24+
show_help: true
25+
26+
cloud_client_library: true
27+
28+
folder: logging/cloud-client

logging/samples/snippets/export.py

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright 2016 Google Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
import argparse
18+
19+
from google.cloud import logging
20+
21+
22+
# [START logging_list_sinks]
23+
def list_sinks():
24+
"""Lists all sinks."""
25+
logging_client = logging.Client()
26+
27+
sinks = list(logging_client.list_sinks())
28+
29+
if not sinks:
30+
print("No sinks.")
31+
32+
for sink in sinks:
33+
print("{}: {} -> {}".format(sink.name, sink.filter_, sink.destination))
34+
35+
36+
# [END logging_list_sinks]
37+
38+
39+
# [START logging_create_sink]
40+
def create_sink(sink_name, destination_bucket, filter_):
41+
"""Creates a sink to export logs to the given Cloud Storage bucket.
42+
43+
The filter determines which logs this sink matches and will be exported
44+
to the destination. For example a filter of 'severity>=INFO' will send
45+
all logs that have a severity of INFO or greater to the destination.
46+
See https://cloud.google.com/logging/docs/view/advanced_filters for more
47+
filter information.
48+
"""
49+
logging_client = logging.Client()
50+
51+
# The destination can be a Cloud Storage bucket, a Cloud Pub/Sub topic,
52+
# or a BigQuery dataset. In this case, it is a Cloud Storage Bucket.
53+
# See https://cloud.google.com/logging/docs/api/tasks/exporting-logs for
54+
# information on the destination format.
55+
destination = "storage.googleapis.com/{bucket}".format(bucket=destination_bucket)
56+
57+
sink = logging_client.sink(sink_name, filter_=filter_, destination=destination)
58+
59+
if sink.exists():
60+
print("Sink {} already exists.".format(sink.name))
61+
return
62+
63+
sink.create()
64+
print("Created sink {}".format(sink.name))
65+
66+
67+
# [END logging_create_sink]
68+
69+
70+
# [START logging_update_sink]
71+
def update_sink(sink_name, filter_):
72+
"""Changes a sink's filter.
73+
74+
The filter determines which logs this sink matches and will be exported
75+
to the destination. For example a filter of 'severity>=INFO' will send
76+
all logs that have a severity of INFO or greater to the destination.
77+
See https://cloud.google.com/logging/docs/view/advanced_filters for more
78+
filter information.
79+
"""
80+
logging_client = logging.Client()
81+
sink = logging_client.sink(sink_name)
82+
83+
sink.reload()
84+
85+
sink.filter_ = filter_
86+
print("Updated sink {}".format(sink.name))
87+
sink.update()
88+
89+
90+
# [END logging_update_sink]
91+
92+
93+
# [START logging_delete_sink]
94+
def delete_sink(sink_name):
95+
"""Deletes a sink."""
96+
logging_client = logging.Client()
97+
sink = logging_client.sink(sink_name)
98+
99+
sink.delete()
100+
101+
print("Deleted sink {}".format(sink.name))
102+
103+
104+
# [END logging_delete_sink]
105+
106+
107+
if __name__ == "__main__":
108+
parser = argparse.ArgumentParser(
109+
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
110+
)
111+
112+
subparsers = parser.add_subparsers(dest="command")
113+
subparsers.add_parser("list", help=list_sinks.__doc__)
114+
115+
create_parser = subparsers.add_parser("create", help=list_sinks.__doc__)
116+
create_parser.add_argument("sink_name", help="Name of the log export sink.")
117+
create_parser.add_argument(
118+
"destination_bucket", help="Cloud Storage bucket where logs will be exported."
119+
)
120+
create_parser.add_argument("filter", help="The filter used to match logs.")
121+
122+
update_parser = subparsers.add_parser("update", help=update_sink.__doc__)
123+
update_parser.add_argument("sink_name", help="Name of the log export sink.")
124+
update_parser.add_argument("filter", help="The filter used to match logs.")
125+
126+
delete_parser = subparsers.add_parser("delete", help=delete_sink.__doc__)
127+
delete_parser.add_argument("sink_name", help="Name of the log export sink.")
128+
129+
args = parser.parse_args()
130+
131+
if args.command == "list":
132+
list_sinks()
133+
elif args.command == "create":
134+
create_sink(args.sink_name, args.destination_bucket, args.filter)
135+
elif args.command == "update":
136+
update_sink(args.sink_name, args.filter)
137+
elif args.command == "delete":
138+
delete_sink(args.sink_name)
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
import re
17+
import random
18+
import string
19+
import time
20+
21+
import backoff
22+
from google.cloud import logging, storage
23+
import pytest
24+
25+
import export
26+
27+
28+
BUCKET = os.environ["CLOUD_STORAGE_BUCKET"]
29+
TEST_SINK_NAME_TMPL = "example_sink_{}_{}"
30+
TEST_SINK_FILTER = "severity>=CRITICAL"
31+
TIMESTAMP = int(time.time())
32+
33+
# Threshold beyond which the cleanup_old_sinks fixture will delete
34+
# old sink, in seconds
35+
CLEANUP_THRESHOLD = 7200 # 2 hours
36+
37+
# Max buckets to delete at a time, to mitigate operation timeout
38+
# issues. To turn off in the future, set to None.
39+
MAX_BUCKETS = 1500
40+
41+
42+
def _random_id():
43+
return "".join(
44+
random.choice(string.ascii_uppercase + string.digits) for _ in range(6)
45+
)
46+
47+
48+
def _create_sink_name():
49+
return TEST_SINK_NAME_TMPL.format(TIMESTAMP, _random_id())
50+
51+
52+
@backoff.on_exception(backoff.expo, Exception, max_time=60, raise_on_giveup=False)
53+
def _delete_object(obj, **kwargs):
54+
obj.delete(**kwargs)
55+
56+
57+
# Runs once for entire test suite
58+
@pytest.fixture(scope="module")
59+
def cleanup_old_sinks():
60+
client = logging.Client()
61+
test_sink_name_regex = (
62+
r"^" + TEST_SINK_NAME_TMPL.format(r"(\d+)", r"[A-Z0-9]{6}") + r"$"
63+
)
64+
for sink in client.list_sinks():
65+
match = re.match(test_sink_name_regex, sink.name)
66+
if match:
67+
sink_timestamp = int(match.group(1))
68+
if TIMESTAMP - sink_timestamp > CLEANUP_THRESHOLD:
69+
_delete_object(sink)
70+
71+
storage_client = storage.Client()
72+
73+
# See _sink_storage_setup in usage_guide.py for details about how
74+
# sinks are named.
75+
test_bucket_name_regex = r"^sink\-storage\-(\d+)$"
76+
for bucket in storage_client.list_buckets(max_results=MAX_BUCKETS):
77+
match = re.match(test_bucket_name_regex, bucket.name)
78+
if match:
79+
# Bucket timestamp is int(time.time() * 1000)
80+
bucket_timestamp = int(match.group(1))
81+
if TIMESTAMP - bucket_timestamp // 1000 > CLEANUP_THRESHOLD:
82+
_delete_object(bucket, force=True)
83+
84+
85+
@pytest.fixture
86+
def example_sink(cleanup_old_sinks):
87+
client = logging.Client()
88+
89+
sink = client.sink(
90+
_create_sink_name(),
91+
filter_=TEST_SINK_FILTER,
92+
destination="storage.googleapis.com/{bucket}".format(bucket=BUCKET),
93+
)
94+
95+
sink.create()
96+
97+
yield sink
98+
99+
_delete_object(sink)
100+
101+
102+
def test_list(example_sink, capsys):
103+
@backoff.on_exception(backoff.expo, AssertionError, max_time=60)
104+
def eventually_consistent_test():
105+
export.list_sinks()
106+
out, _ = capsys.readouterr()
107+
assert example_sink.name in out
108+
109+
eventually_consistent_test()
110+
111+
112+
def test_create(capsys):
113+
sink_name = _create_sink_name()
114+
115+
try:
116+
export.create_sink(sink_name, BUCKET, TEST_SINK_FILTER)
117+
# Clean-up the temporary sink.
118+
finally:
119+
_delete_object(logging.Client().sink(sink_name))
120+
121+
out, _ = capsys.readouterr()
122+
assert sink_name in out
123+
124+
125+
def test_update(example_sink, capsys):
126+
updated_filter = "severity>=INFO"
127+
export.update_sink(example_sink.name, updated_filter)
128+
129+
example_sink.reload()
130+
assert example_sink.filter_ == updated_filter
131+
132+
133+
def test_delete(example_sink, capsys):
134+
export.delete_sink(example_sink.name)
135+
assert not example_sink.exists()
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright 2016 Google Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
def use_logging_handler():
19+
# [START logging_stdlogging]
20+
# [START logging_handler_setup]
21+
# Imports the Cloud Logging client library
22+
import google.cloud.logging
23+
24+
# Instantiates a client
25+
client = google.cloud.logging.Client()
26+
27+
# Retrieves a Cloud Logging handler based on the environment
28+
# you're running in and integrates the handler with the
29+
# Python logging module. By default this captures all logs
30+
# at INFO level and higher
31+
client.setup_logging()
32+
# [END logging_handler_setup]
33+
34+
# [START logging_handler_usage]
35+
# Imports Python standard library logging
36+
import logging
37+
38+
# The data to log
39+
text = "Hello, world!"
40+
41+
# Emits the data using the standard logging module
42+
logging.warning(text)
43+
# [END logging_handler_usage]
44+
45+
print("Logged: {}".format(text))
46+
# [END logging_stdlogging]
47+
48+
49+
if __name__ == "__main__":
50+
use_logging_handler()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
import handler
17+
18+
19+
def test_handler(capsys):
20+
handler.use_logging_handler()
21+
out, _ = capsys.readouterr()
22+
assert "Logged" in out

0 commit comments

Comments
 (0)