Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c5217f9
Update logging samples to fit new style guide and match Node.js sampl…
Aug 4, 2016
9401475
Fix test conflict.
Aug 4, 2016
c94e662
Fix logging test.
Aug 4, 2016
22afe69
Auto-update dependencies. [(#456)](https://github.com/GoogleCloudPlat…
dpebot Aug 16, 2016
8ae5f10
Fix import order lint errors
Aug 19, 2016
052f3e5
Auto-update dependencies. [(#540)](https://github.com/GoogleCloudPlat…
dpebot Sep 23, 2016
f53c654
Auto-update dependencies. [(#542)](https://github.com/GoogleCloudPlat…
dpebot Sep 26, 2016
49cf318
Move to google-cloud [(#544)](https://github.com/GoogleCloudPlatform/…
Sep 30, 2016
4271a02
Add new "quickstart" samples [(#547)](https://github.com/GoogleCloudP…
jmdobry Oct 5, 2016
7024024
Quickstart tests [(#569)](https://github.com/GoogleCloudPlatform/pyth…
Oct 12, 2016
9aecaa2
Generate readmes for most service samples [(#599)](https://github.com…
Oct 24, 2016
957eb57
Update samples to support latest Google Cloud Python [(#656)](https:/…
Nov 15, 2016
d270cbf
Auto-update dependencies. [(#715)](https://github.com/GoogleCloudPlat…
dpebot Dec 13, 2016
ec152a2
Remove cloud config fixture [(#887)](https://github.com/GoogleCloudPl…
Apr 4, 2017
68078a3
Fix reference to our testing tools
Apr 12, 2017
006a15d
Auto-update dependencies. [(#914)](https://github.com/GoogleCloudPlat…
dpebot Apr 24, 2017
e387e65
Re-generate all readmes
Apr 27, 2017
aa308d6
Fix README rst links [(#962)](https://github.com/GoogleCloudPlatform/…
waprin May 24, 2017
148d61e
Auto-update dependencies. [(#1004)](https://github.com/GoogleCloudPla…
dpebot Jun 27, 2017
14786d6
Auto-update dependencies. [(#1055)](https://github.com/GoogleCloudPla…
dpebot Aug 7, 2017
9dcd1e7
Fix logging tests
Aug 29, 2017
9c986cb
Auto-update dependencies. [(#1093)](https://github.com/GoogleCloudPla…
dpebot Aug 29, 2017
5e1b0ef
Update all generated readme auth instructions [(#1121)](https://githu…
Sep 18, 2017
cc71331
Added Link to Python Setup Guide [(#1158)](https://github.com/GoogleC…
Oct 12, 2017
de4dbfa
Fix a few more lint issues
Oct 24, 2017
049f1fd
Auto-update dependencies. [(#1186)](https://github.com/GoogleCloudPla…
dpebot Nov 1, 2017
b1c379a
Add sample for standard library logging handler configuration [(#1233…
andrewsg Nov 28, 2017
51a20c0
Added "Open in Cloud Shell" buttons to README files [(#1254)](https:/…
Dec 7, 2017
ef1fd81
Auto-update dependencies. [(#1359)](https://github.com/GoogleCloudPla…
dpebot Feb 26, 2018
908af21
Auto-update dependencies. [(#1377)](https://github.com/GoogleCloudPla…
dpebot Mar 5, 2018
afa6c2e
Regenerate the README files and fix the Open in Cloud Shell link for …
Apr 7, 2018
cd2b128
Update READMEs to fix numbering and add git clone [(#1464)](https://g…
frankyn Apr 26, 2018
12bf3da
Update logging doc tags. [(#1634)](https://github.com/GoogleCloudPlat…
SurferJeffAtGoogle Aug 15, 2018
5262931
Fix deprecation warning [(#1801)](https://github.com/GoogleCloudPlatf…
andrewsg Nov 20, 2018
8afd09d
Auto-update dependencies. [(#1846)](https://github.com/GoogleCloudPla…
dpebot Nov 20, 2018
c0fa69f
Auto-update dependencies. [(#1980)](https://github.com/GoogleCloudPla…
dpebot Feb 6, 2019
3958331
Adds split updates for Firebase ... opencensus [(#2438)](https://gith…
gguuss Oct 8, 2019
609284c
Auto-update dependencies. [(#2005)](https://github.com/GoogleCloudPla…
dpebot Dec 21, 2019
10dab41
chore(deps): update dependency google-cloud-logging to v1.15.0 [(#316…
renovate-bot Mar 27, 2020
6a53a84
Simplify noxfile setup. [(#2806)](https://github.com/GoogleCloudPlatf…
kurtisvg Apr 2, 2020
5999d8e
[logging] chore: remove gcp-devrel-py-tools [(#3477)](https://github.…
Apr 23, 2020
ff2cea8
Update logging example to retrieve the default handler [(#3691)](http…
darrencarlton May 6, 2020
d6789bd
testing: various cleanups [(#3877)](https://github.com/GoogleCloudPla…
May 26, 2020
121d6df
chore(deps): update dependency pytest to v5.4.3 [(#4279)](https://git…
renovate-bot Jul 12, 2020
d28afc9
Update dependency pytest to v6 [(#4390)](https://github.com/GoogleClo…
renovate-bot Aug 1, 2020
be25bb0
chore(deps): update dependency google-cloud-logging to v1.15.1 [(#445…
renovate-bot Aug 10, 2020
a44921f
chore: update templates
busunkim96 Oct 12, 2020
2b57b0e
chore: remove multiprocessing note
busunkim96 Oct 30, 2020
fd8440a
Merge branch 'master' into microgen
busunkim96 Nov 2, 2020
ca80508
docs: fix samples README
busunkim96 Nov 11, 2020
d8ff32f
chore: regen samples noxfile
busunkim96 Nov 11, 2020
0d8437a
docs: remove stackdriver logging
busunkim96 Nov 11, 2020
eab2f26
chore: run formatter
busunkim96 Nov 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# Generated by synthtool. DO NOT EDIT!
[run]
branch = True
omit =
google/cloud/__init__.py

[report]
fail_under = 100
Expand All @@ -32,4 +34,5 @@ omit =
*/gapic/*.py
*/proto/*.py
*/core/*.py
*/site-packages/*.py
*/site-packages/*.py
google/cloud/__init__.py
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ exclude =
# Exclude generated code.
**/proto/**
**/gapic/**
**/services/**
**/types/**
*_pb2.py

# Standard linting exemptions.
Expand Down
Empty file added .github/snippet-bot.yml
Empty file.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
dist
build
eggs
.eggs
parts
bin
var
Expand Down Expand Up @@ -45,14 +46,16 @@ pip-log.txt
# Built documentation
docs/_build
bigquery/docs/generated
docs.metadata

# Virtual environment
env/
coverage.xml
sponge_log.xml

# System test environment variables.
system_tests/local_test_setup

# Make sure a generated file isn't accidentally committed.
pylintrc
pylintrc.test
pylintrc.test
43 changes: 43 additions & 0 deletions .kokoro/populate-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
function msg { println "$*" >&2 ;}
function println { printf '%s\n' "$(now) $*" ;}


# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
mkdir -p ${SECRET_LOCATION}
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
do
msg "Retrieving secret ${key}"
docker run --entrypoint=gcloud \
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
gcr.io/google.com/cloudsdktool/cloud-sdk \
secrets versions access latest \
--project cloud-devrel-kokoro-resources \
--secret ${key} > \
"${SECRET_LOCATION}/${key}"
if [[ $? == 0 ]]; then
msg "Secret written to ${SECRET_LOCATION}/${key}"
else
msg "Error retrieving secret ${key}"
fi
done
19 changes: 0 additions & 19 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,6 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.

.. nox: https://pypi.org/project/nox/

Note on Editable Installs / Develop Mode
========================================

- As mentioned previously, using ``setuptools`` in `develop mode`_
or a ``pip`` `editable install`_ is not possible with this
library. This is because this library uses `namespace packages`_.
For context see `Issue #2316`_ and the relevant `PyPA issue`_.

Since ``editable`` / ``develop`` mode can't be used, packages
need to be installed directly. Hence your changes to the source
tree don't get incorporated into the **already installed**
package.

.. _namespace packages: https://www.python.org/dev/peps/pep-0420/
.. _Issue #2316: https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2316
.. _PyPA issue: https://github.com/pypa/packaging-problems/issues/12
.. _develop mode: https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode
.. _editable install: https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs

*****************************************
I'm getting weird errors... Can you help?
*****************************************
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ recursive-include google *.json *.proto
recursive-include tests *
global-exclude *.py[co]
global-exclude __pycache__

# Exclude scripts for samples readmegen
prune scripts/readme-gen
33 changes: 0 additions & 33 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,39 +172,6 @@ def docs(session):
)


@nox.session(python="3.7")
def docfx(session):
"""Build the docfx yaml files for this library."""

session.install("-e", ".")
session.install("sphinx", "alabaster", "recommonmark")

shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
session.run(
"sphinx-build",
"-T", # show full traceback on exception
"-N", # no colors
"-D",
(
"extensions=sphinx.ext.autodoc,"
"sphinx.ext.autosummary,"
"docfx_yaml.extension,"
"sphinx.ext.intersphinx,"
"sphinx.ext.coverage,"
"sphinx.ext.napoleon,"
"sphinx.ext.todo,"
"sphinx.ext.viewcode,"
"recommonmark"
),
"-b",
"html",
"-d",
os.path.join("docs", "_build", "doctrees", ""),
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional? Won't this get overwritten by the upstream since we're now using synthtool for this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This session was duplicated on accident (see docfx below)



@nox.session(python=DEFAULT_PYTHON_VERSION)
def docfx(session):
"""Build the docfx yaml files for this library."""
Expand Down
1 change: 1 addition & 0 deletions samples/AUTHORING_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md
1 change: 1 addition & 0 deletions samples/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md
172 changes: 172 additions & 0 deletions samples/snippets/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
.. This file is automatically generated. Do not edit this file directly.

Cloud Logging Python Samples
===============================================================================

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=logging/cloud-client/README.rst


This directory contains samples for Cloud Logging. `Cloud Logging`_ allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.




.. _Cloud Logging: https://cloud.google.com/logging/docs





Setup
-------------------------------------------------------------------------------


Authentication
++++++++++++++

This sample requires you to have authentication setup. Refer to the
`Authentication Getting Started Guide`_ for instructions on setting up
credentials for applications.

.. _Authentication Getting Started Guide:
https://cloud.google.com/docs/authentication/getting-started

Install Dependencies
++++++++++++++++++++

#. Clone python-logging and change directory to the sample directory you want to use.

.. code-block:: bash

$ git clone https://github.com/googleapis/python-logging.git

#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions.

.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 3.6+.

.. code-block:: bash

$ virtualenv env
$ source env/bin/activate

#. Install the dependencies needed to run the samples.

.. code-block:: bash

$ pip install -r requirements.txt

.. _pip: https://pip.pypa.io/
.. _virtualenv: https://virtualenv.pypa.io/

Samples
-------------------------------------------------------------------------------

Quickstart
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=logging/cloud-client/quickstart.py,logging/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python quickstart.py


Snippets
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=logging/cloud-client/snippets.py,logging/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python snippets.py

usage: snippets.py [-h] logger_name {list,write,delete} ...

This application demonstrates how to perform basic operations on logs and
log entries with Cloud Logging.

For more information, see the README.md under /logging and the
documentation at https://cloud.google.com/logging/docs.

positional arguments:
logger_name Logger name
{list,write,delete}
list Lists the most recent entries for a given logger.
write Writes log entries to the given logger.
delete Deletes a logger and all its entries. Note that a
deletion can take several minutes to take effect.

optional arguments:
-h, --help show this help message and exit



Export
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=logging/cloud-client/export.py,logging/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python export.py

usage: export.py [-h] {list,create,update,delete} ...

positional arguments:
{list,create,update,delete}
list Lists all sinks.
create Lists all sinks.
update Changes a sink's filter. The filter determines which
logs this sink matches and will be exported to the
destination. For example a filter of 'severity>=INFO'
will send all logs that have a severity of INFO or
greater to the destination. See https://cloud.google.c
om/logging/docs/view/advanced_filters for more filter
information.
delete Deletes a sink.

optional arguments:
-h, --help show this help message and exit





The client library
-------------------------------------------------------------------------------

This sample uses the `Google Cloud Client Library for Python`_.
You can read the documentation for more details on API usage and use GitHub
to `browse the source`_ and `report issues`_.

.. _Google Cloud Client Library for Python:
https://googlecloudplatform.github.io/google-cloud-python/
.. _browse the source:
https://github.com/GoogleCloudPlatform/google-cloud-python
.. _report issues:
https://github.com/GoogleCloudPlatform/google-cloud-python/issues


.. _Google Cloud SDK: https://cloud.google.com/sdk/
28 changes: 28 additions & 0 deletions samples/snippets/README.rst.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is used to generate README.rst

product:
name: Cloud Logging
short_name: Cloud Logging
url: https://cloud.google.com/logging/docs
description: >
`Cloud Logging`_ allows you to store, search, analyze, monitor,
and alert on log data and events from Google Cloud Platform and Amazon
Web Services.

setup:
- auth
- install_deps

samples:
- name: Quickstart
file: quickstart.py
- name: Snippets
file: snippets.py
show_help: true
- name: Export
file: export.py
show_help: true

cloud_client_library: true

folder: logging/cloud-client
Loading