-
Notifications
You must be signed in to change notification settings - Fork 249
Monitoring API #795
Monitoring API #795
Conversation
from gcp._util import Http, RequestException | ||
except ImportError: | ||
# Use a minimal substitute module if the Datalab library is not available. | ||
from .http import Http, RequestException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under what circumstances do you think the Datalab library would not be available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the base library (contents of _impl) is being used as a standalone
module in a context other than gcp.stackdriver.monitoring. We didn't want
to maintain two versions of this code, one that depends on gcp._util, and
one that doesn't.
On Fri, Apr 8, 2016 at 7:40 PM, Graham Wheeler notifications@github.com
wrote:
In sources/lib/api/gcp/stackdriver/monitoring/_impl/api.py
#795 (comment)
:+#
+# 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.
+
+"""HTTP API wrapper for the Google Monitoring API."""
+
+try:
- from gcp._util import Http, RequestException
+except ImportError:Use a minimal substitute module if the Datalab library is not available.
- from .http import Http, RequestException
Under what circumstances do you think the Datalab library would not be
available?—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/GoogleCloudPlatform/datalab/pull/795/files/02f77850899536b23933224d882e31b426170b7d#r59103131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would it be used as a standalone module? See my other comment. If the intention is to use it as a standalone module then IMO it doesn't belong in Datalab except possibly as a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it as a standalone client library for the Monitoring API in a
context that has no connection whatsoever with Datalab. We can remove
_impl/http.py from this pull request if you feel strongly. All of this will
become moot as soon as a version of gcloud-python including the base
library is pip-installable.
On Fri, Apr 8, 2016 at 7:54 PM, Graham Wheeler notifications@github.com
wrote:
In sources/lib/api/gcp/stackdriver/monitoring/_impl/api.py
#795 (comment)
:+#
+# 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.
+
+"""HTTP API wrapper for the Google Monitoring API."""
+
+try:
- from gcp._util import Http, RequestException
+except ImportError:Use a minimal substitute module if the Datalab library is not available.
- from .http import Http, RequestException
When would it be used as a standalone module? See my other comment. If the
intention is to use it as a standalone module then IMO it doesn't belong in
Datalab except possibly as a dependency.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/GoogleCloudPlatform/datalab/pull/795/files/02f77850899536b23933224d882e31b426170b7d#r59103996
This initial version of the monitoring client for Datalab allows users to query timeseries data. It introduces a new module under gcp that users can import using: from gcp.stackdriver import monitoring Querying timeseries data: There is a `Query` class that allows users to query timeseries data for their monitored resources. They can initialize the query by specifying a metric type and time interval, and refine it by adding filters to it. The timeseries data is returned as a pandas DataFrame that allows users to further manipulate the data and visualize it within Datalab. IPython magics: There are a couple of IPython magic commands to allow users to list details of the available metrics and resource types. E.g.: %%monitoring list metrics The base library: The _impl directory is a snapshot of an earlier version of a monitoring client library that we have submitted to gcloud-python: googleapis/google-cloud-python#1691 It works as the base library on top of which the Datalab library adds interactive features. The authors of this code are @rimey and myself, both at Google.
The code was looking for error.errors.0.message, but some APIs (e.g., the Google Monitoring API) don't return error details under error.errors, while error.message is generally supposed to be present.
The changes in this pull request have been made part of a new datalab branch: feature/stackdriver_monitoring: https://github.com/GoogleCloudPlatform/datalab/tree/feature/stackdriver_monitoring |
This initial version of the monitoring client for Datalab allows users
to query timeseries data. It introduces a new module under gcp that
users can import using:
Querying timeseries data:
There is a
Query
class that allows users to query timeseries datafor their monitored resources. They can initialize the query by specifying a
metric type and time interval, and refine it by adding filters to it.
The timeseries data is returned as a pandas DataFrame that allows users
to further manipulate the data and visualize it within Datalab.
IPython magics:
There are a couple of IPython magic commands to allow users to list
details of the available metrics and resource types. E.g.:
The base library:
The _impl directory is a snapshot of an earlier version of a
monitoring client library that we have submitted to gcloud-python:
googleapis/google-cloud-python#1691
It works as the base library on top of which the Datalab library adds
interactive features.
The authors of this code are @rimey and myself, both at Google.