Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update monitoring library to use new generated client #5212

Merged
merged 9 commits into from
Apr 23, 2018

Conversation

theacodes
Copy link
Contributor

No description provided.

@theacodes theacodes requested a review from crwilcox April 19, 2018 16:51
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 19, 2018
Copy link
Contributor

@supriyagarg supriyagarg left a comment

Choose a reason for hiding this comment

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

If you see the link below, a lot of the old documentation is still showing up. The usage.rst file needs to be re-written to refer to the GAPIC based library:
https://github.com/GoogleCloudPlatform/google-cloud-python/blob/10643a87d0835747a70c6dd1127b75a702525fc8/docs/monitoring/usage.rst

.. _Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/monitoring/usage.html
.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Stackdriver Monitoring API: https://cloud.google.com/monitoring
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/monitoring-usage

This comment was marked as spam.

@theacodes theacodes force-pushed the monitoring-autogen branch from 10643a8 to 501beca Compare April 19, 2018 21:29
@theacodes
Copy link
Contributor Author

Okay, I've done a lot of work to make this branch current.

  1. I re-organized everything under monitoring_v3. google.cloud.monitoring is just an alias to monitoring_v3 (same as other packages).
  2. I have enabled testing with pandas.
  3. I have dropped the old handwritten docs and have imported the autogen docs. I have carried over the query docs.
  4. I have re-generated the gapic. This should now contain the alerts feature (and more).

@supriyagarg I need you help as a few tests for query are failing and I'm not 100% sure how they should be fixed. Can you please take a look? (see test output here). Feel free to push new commits to this branch to fix those and ping me if you run into issues.

It would also be great if you could give the docs a once-over. I've staged them here for easy review.

/cc @SurferJeffAtGoogle

@supriyagarg
Copy link
Contributor

I just sent a PR #5215 to merge into monitoring-autogen.
I still see some coverage issues, but having trouble seeing which lines are not covered.

@theacodes theacodes force-pushed the monitoring-autogen branch from 543f163 to 9145e47 Compare April 23, 2018 17:58
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Stackdriver Monitoring API.: https://cloud.google.com/monitoring
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/stable/core/auth.html

This comment was marked as spam.

This comment was marked as spam.

.. _Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/monitoring/usage.html
.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Stackdriver Monitoring API: https://cloud.google.com/monitoring
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/monitoring/usage.html

This comment was marked as spam.

This comment was marked as spam.


.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Stackdriver Monitoring API: https://cloud.google.com/monitoring
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/monitoring/usage.html

This comment was marked as spam.

This comment was marked as spam.

package='google.monitoring.v3',
syntax='proto3',
serialized_pb=_b('\n,google/cloud/monitoring_v3/proto/alert.proto\x12\x14google.monitoring.v3\x1a\x1cgoogle/api/annotations.proto\x1a-google/cloud/monitoring_v3/proto/common.proto\x1a\x36google/cloud/monitoring_v3/proto/mutation_record.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xdd\x0c\n\x0b\x41lertPolicy\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x46\n\rdocumentation\x18\r \x01(\x0b\x32/.google.monitoring.v3.AlertPolicy.Documentation\x12\x46\n\x0buser_labels\x18\x10 \x03(\x0b\x32\x31.google.monitoring.v3.AlertPolicy.UserLabelsEntry\x12?\n\nconditions\x18\x0c \x03(\x0b\x32+.google.monitoring.v3.AlertPolicy.Condition\x12I\n\x08\x63ombiner\x18\x06 \x01(\x0e\x32\x37.google.monitoring.v3.AlertPolicy.ConditionCombinerType\x12+\n\x07\x65nabled\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x1d\n\x15notification_channels\x18\x0e \x03(\t\x12=\n\x0f\x63reation_record\x18\n \x01(\x0b\x32$.google.monitoring.v3.MutationRecord\x12=\n\x0fmutation_record\x18\x0b \x01(\x0b\x32$.google.monitoring.v3.MutationRecord\x1a\x33\n\rDocumentation\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x11\n\tmime_type\x18\x02 \x01(\t\x1a\xf8\x06\n\tCondition\x12\x0c\n\x04name\x18\x0c \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x06 \x01(\t\x12Z\n\x13\x63ondition_threshold\x18\x01 \x01(\x0b\x32;.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdH\x00\x12U\n\x10\x63ondition_absent\x18\x02 \x01(\x0b\x32\x39.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceH\x00\x1a\x35\n\x07Trigger\x12\x0f\n\x05\x63ount\x18\x01 \x01(\x05H\x00\x12\x11\n\x07percent\x18\x02 \x01(\x01H\x00\x42\x06\n\x04type\x1a\x81\x03\n\x0fMetricThreshold\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x37\n\x0c\x61ggregations\x18\x08 \x03(\x0b\x32!.google.monitoring.v3.Aggregation\x12\x1a\n\x12\x64\x65nominator_filter\x18\t \x01(\t\x12\x43\n\x18\x64\x65nominator_aggregations\x18\n \x03(\x0b\x32!.google.monitoring.v3.Aggregation\x12\x38\n\ncomparison\x18\x04 \x01(\x0e\x32$.google.monitoring.v3.ComparisonType\x12\x17\n\x0fthreshold_value\x18\x05 \x01(\x01\x12+\n\x08\x64uration\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x44\n\x07trigger\x18\x07 \x01(\x0b\x32\x33.google.monitoring.v3.AlertPolicy.Condition.Trigger\x1a\xcb\x01\n\rMetricAbsence\x12\x0e\n\x06\x66ilter\x18\x01 \x01(\t\x12\x37\n\x0c\x61ggregations\x18\x05 \x03(\x0b\x32!.google.monitoring.v3.Aggregation\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x44\n\x07trigger\x18\x03 \x01(\x0b\x32\x33.google.monitoring.v3.AlertPolicy.Condition.TriggerB\x0b\n\tcondition\x1a\x31\n\x0fUserLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"a\n\x15\x43onditionCombinerType\x12\x17\n\x13\x43OMBINE_UNSPECIFIED\x10\x00\x12\x07\n\x03\x41ND\x10\x01\x12\x06\n\x02OR\x10\x02\x12\x1e\n\x1a\x41ND_WITH_MATCHING_RESOURCE\x10\x03\x42\xa2\x01\n\x18\x63om.google.monitoring.v3B\nAlertProtoP\x01Z>google.golang.org/genproto/googleapis/monitoring/v3;monitoring\xaa\x02\x1aGoogle.Cloud.Monitoring.V3\xca\x02\x1aGoogle\\Cloud\\Monitoring\\V3b\x06proto3')
,

This comment was marked as spam.

>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initialize ``uptime_check_config``:

This comment was marked as spam.

@@ -0,0 +1,674 @@
# Copyright 2018 Google LLC

This comment was marked as spam.

self.assertEqual(query._group_by_fields, ())

def test_constructor_default_end_time(self):
import datetime
import mock
from google.cloud.monitoring_v3 import MetricServiceClient

MINUTES = 5
NOW, T0, T1 = [

This comment was marked as spam.

This comment was marked as spam.

@@ -15,6 +15,12 @@
"""Time series as :mod:`pandas` dataframes."""

import itertools
try:
import pandas

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor Author

@theacodes theacodes left a comment

Choose a reason for hiding this comment

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

Addressed most comments, some comments about autogenerated code aren't feasible right now.

.. _Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/monitoring/usage.html
.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Stackdriver Monitoring API: https://cloud.google.com/monitoring
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/monitoring/usage.html

This comment was marked as spam.

.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Stackdriver Monitoring API.: https://cloud.google.com/monitoring
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/stable/core/auth.html

This comment was marked as spam.


.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Stackdriver Monitoring API: https://cloud.google.com/monitoring
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/monitoring/usage.html

This comment was marked as spam.

@@ -15,6 +15,12 @@
"""Time series as :mod:`pandas` dataframes."""

import itertools
try:
import pandas

This comment was marked as spam.

self.assertEqual(query._group_by_fields, ())

def test_constructor_default_end_time(self):
import datetime
import mock
from google.cloud.monitoring_v3 import MetricServiceClient

MINUTES = 5
NOW, T0, T1 = [

This comment was marked as spam.

@theacodes
Copy link
Contributor Author

Merging despite flaky system test, hopefully that's just a relatively rare 500 error.

@theacodes theacodes merged commit 0e8e3b7 into master Apr 23, 2018
@theacodes theacodes deleted the monitoring-autogen branch April 23, 2018 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants