Visitar URL original
Merge pull request #2430 from dhermes/make-monitoring-subpackage · googleapis/google-cloud-python@011e56d · GitHub
Skip to content

Commit 011e56d

Browse files
authored
Merge pull request #2430 from dhermes/make-monitoring-subpackage
Move monitoring code into a subpackage
2 parents 685341a + 454dde3 commit 011e56d

31 files changed

Lines changed: 233 additions & 0 deletions

‎.travis.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ script:
1717
- (cd language && tox -e py27)
1818
- (cd error_reporting && tox -e py27)
1919
- (cd resource_manager && tox -e py27)
20+
- (cd monitoring && tox -e py27)
2021
- tox -e py34
2122
- (cd core && tox -e py34)
2223
- (cd bigtable && tox -e py34)
@@ -29,6 +30,7 @@ script:
2930
- (cd language && tox -e py34)
3031
- (cd error_reporting && tox -e py34)
3132
- (cd resource_manager && tox -e py34)
33+
- (cd monitoring && tox -e py34)
3234
- tox -e lint
3335
- tox -e cover
3436
- (cd core && tox -e cover)
@@ -42,6 +44,7 @@ script:
4244
- (cd language && tox -e cover)
4345
- (cd error_reporting && tox -e cover)
4446
- (cd resource_manager && tox -e cover)
47+
- (cd monitoring && tox -e cover)
4548
- tox -e system-tests
4649
- tox -e system-tests3
4750
- scripts/update_docs.sh

‎monitoring/.coveragerc‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
fail_under = 100
6+
show_missing = True
7+
exclude_lines =
8+
# Re-enable the standard pragma
9+
pragma: NO COVER
10+
# Ignore debug-only repr
11+
def __repr__

‎monitoring/MANIFEST.in‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include README.rst
2+
graft google
3+
graft unit_tests
4+
global-exclude *.pyc

‎monitoring/README.rst‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Python Client for Stackdriver Monitoring
2+
========================================
3+
4+
Python idiomatic client for `Stackdriver Monitoring`_
5+
6+
.. _Stackdriver Monitoring: https://cloud.google.com/monitoring/
7+
8+
- `Homepage`_
9+
- `API Documentation`_
10+
11+
.. _Homepage: https://googlecloudplatform.github.io/google-cloud-python/
12+
.. _API Documentation: http://googlecloudplatform.github.io/google-cloud-python/
13+
14+
Quick Start
15+
-----------
16+
17+
::
18+
19+
$ pip install --upgrade google-cloud-monitoring
20+
21+
Authentication
22+
--------------
23+
24+
With ``google-cloud-python`` we try to make authentication as painless as
25+
possible. Check out the `Authentication section`_ in our documentation to
26+
learn more. You may also find the `authentication document`_ shared by all
27+
the ``google-cloud-*`` libraries to be helpful.
28+
29+
.. _Authentication section: http://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html
30+
.. _authentication document: https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication
31+
32+
Using the API
33+
-------------
34+
35+
`Stackdriver Monitoring`_ (`Monitoring API docs`_) collects metrics,
36+
events, and metadata from Google Cloud Platform, Amazon Web Services (AWS),
37+
hosted uptime probes, application instrumentation, and a variety of common
38+
application components including Cassandra, Nginx, Apache Web Server,
39+
Elasticsearch and many others. Stackdriver ingests that data and generates
40+
insights via dashboards, charts, and alerts.
41+
42+
This package currently supports all Monitoring API operations other than
43+
writing custom metrics.
44+
45+
.. _Stackdriver Monitoring: https://cloud.google.com/monitoring/
46+
.. _Monitoring API docs: https://cloud.google.com/monitoring/api/ref_v3/rest/
47+
48+
List available metric types:
49+
50+
.. code:: python
51+
52+
from google.cloud import monitoring
53+
client = monitoring.Client()
54+
for descriptor in client.list_metric_descriptors():
55+
print(descriptor.type)
56+
57+
Display CPU utilization across your GCE instances during the last five minutes:
58+
59+
.. code:: python
60+
61+
metric = 'compute.googleapis.com/instance/cpu/utilization'
62+
query = client.query(metric, minutes=5)
63+
print(query.as_dataframe())
64+
65+
See the ``google-cloud-python`` API `monitoring documentation`_ to learn how
66+
to connect to Stackdriver Monitoring using this Client Library.
67+
68+
.. _monitoring documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/monitoring-usage.html

‎monitoring/google/__init__.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2016 Google Inc.
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+
try:
16+
import pkg_resources
17+
pkg_resources.declare_namespace(__name__)
18+
except ImportError:
19+
import pkgutil
20+
__path__ = pkgutil.extend_path(__path__, __name__)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2014 Google Inc.
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+
try:
16+
import pkg_resources
17+
pkg_resources.declare_namespace(__name__)
18+
except ImportError:
19+
import pkgutil
20+
__path__ = pkgutil.extend_path(__path__, __name__)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)