{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/comments/74127900","id":74127900,"diff_hunk":"@@ -195,6 +203,126 @@ def metric_descriptor(self, type_,\n             display_name=display_name,\n         )\n \n+    @staticmethod\n+    def metric(type_, labels):\n+        \"\"\"Construct a metric object.\n+\n+        The type of the Metric should match the type of a MetricDescriptor.\n+        For a list of built-in Metric types and the associated labels, see:\n+\n+        https://cloud.google.com/monitoring/api/metrics\n+\n+        Here is an example of creating using a built-in metric type:\n+\n+             >>> type_ = 'compute.googleapis.com/instance/cpu/utilization'\n+             >>> metric = client.metric(type_, labels={\n+             ...    'instance_name': 'my-instance',\n+             ... })\n+\n+        For custom metrics, the simplest way to get the type is from the\n+        :class:`~gcloud.monitoring.metric.MetricDescriptor` class used to\n+        create the custom metric::\n+\n+             >>> metric = client.metric(metric_descriptor.type, labels={\n+             ...    'instance_name': 'my-instance',\n+             ... })\n+\n+        :type type_: string\n+        :param type_: The metric type name.\n+\n+        :type labels: dict\n+        :param labels: A mapping from label names to values for all labels\n+                       enumerated in the associated :class:`MetricDescriptor`.\n+\n+        :rtype: :class:`~gcloud.monitoring.metric.Metric`\n+        :returns: The Metric created with the passed in arguments\n+        \"\"\"\n+        return Metric(type=type_, labels=labels)\n+\n+    @staticmethod\n+    def resource(type_, labels):\n+        \"\"\"Construct a resource object.\n+\n+        For a list of possible MonitoredResources and their associated labels,\n+        see:\n+\n+        https://cloud.google.com/monitoring/api/resources\n+\n+        For example, to create a Resource object for a GCE instance::\n+\n+            >>> resource = client.resource('gce_instance', labels= {\n+            ...     'project_id': 'my-project-id',\n+            ...     'instance_id': 'my-instance-id',\n+            ...     'zone': 'us-central1-f'\n+            ... })\n+\n+        :type type_: string\n+        :param type_: The monitored resource type name.\n+\n+        :type labels: dict\n+        :param labels: A mapping from label names to values for all labels\n+                       enumerated in the associated\n+                       :class:`ResourceDescriptor`.\n+\n+        :rtype: :class:`gcloud.resource.Resource`\n+        :returns: The Resource created with the passed in arguments\n+        \"\"\"\n+        return Resource(type_, labels)\n+\n+    @staticmethod\n+    def timeseries(metric, resource, value,\n+                   start_time=None, end_time=None):\n+        \"\"\"Constructs a TimeSeries object for a single data point.\n+\n+        .. note::\n+\n+           While TimeSeries objects returned by the API can have\n+           multiple data points when queried as aggregates, TimeSeries created\n+           on the client-side can have at most one point.\n+\n+        For example::\n+\n+            >>> timeseries = client.timeseries(metric, resource, value,\n+            ...     end_time=end)\n+\n+        For more information, see:\n+\n+        https://cloud.google.com/monitoring/api/ref_v3/rest/v3/TimeSeries\n+\n+        :type metric: :class:`~gcloud.monitoring.metric.Metric`\n+        :param metric: A metric object.\n+\n+        :type resource: :class:`~gcloud.monitoring.resource.Resource`\n+        :param resource: A resource object.\n+\n+        :type value: bool, int, string, or float\n+        :param value: The value of the data point to create for the TimeSeries\n+               Note that this parameter can be multiple types and the\n+               TypedValue of the `gcloud.monitoring.TimeSeries.Point` will be\n+               mapped from the type passed in. For example, a Python float\n+               will be sent to the API as a doubleValue.","path":"gcloud/monitoring/client.py","position":124,"original_position":124,"commit_id":"74ac4c189571a691a587a96836dc3b618be600fa","original_commit_id":"74ac4c189571a691a587a96836dc3b618be600fa","user":{"login":"dhermes","id":520669,"avatar_url":"https://avatars.githubusercontent.com/u/520669?v=3","gravatar_id":"","url":"https://api.github.com/users/dhermes","html_url":"https://github.com/dhermes","followers_url":"https://api.github.com/users/dhermes/followers","following_url":"https://api.github.com/users/dhermes/following{/other_user}","gists_url":"https://api.github.com/users/dhermes/gists{/gist_id}","starred_url":"https://api.github.com/users/dhermes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhermes/subscriptions","organizations_url":"https://api.github.com/users/dhermes/orgs","repos_url":"https://api.github.com/users/dhermes/repos","events_url":"https://api.github.com/users/dhermes/events{/privacy}","received_events_url":"https://api.github.com/users/dhermes/received_events","type":"User","site_admin":false},"body":"Here are the two choices I was suggesting.\r\n\r\nLine up the content:\r\n\r\n```python\r\n        :param value: The value of the data point to create for the TimeSeries\r\n                      Note that this parameter can be multiple types and the\r\n                      TypedValue of the `gcloud.monitoring.TimeSeries.Point`\r\n                      will be mapped from the type passed in. For example, a\r\n                      Python float will be sent to the API as a doubleValue.\r\n```\r\n\r\nor 4-space indent for all content\r\n\r\n```python\r\n        :param value:\r\n            The value of the data point to create for the TimeSeries\r\n            Note that this parameter can be multiple types and the\r\n            TypedValue of the `gcloud.monitoring.TimeSeries.Point` will be\r\n            mapped from the type passed in. For example, a Python float\r\n            will be sent to the API as a doubleValue.\r\n```\r\n","created_at":"2016-08-09T19:26:38Z","updated_at":"2016-08-09T19:26:38Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2071#discussion_r74127900","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/comments/74127900"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2071#discussion_r74127900"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071","id":80666150,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2071","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2071.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2071.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/2071","number":2071,"state":"open","locked":false,"title":"Add Factory Methods for Metric/Resource/Timeseries","user":{"login":"waprin","id":1075173,"avatar_url":"https://avatars.githubusercontent.com/u/1075173?v=3","gravatar_id":"","url":"https://api.github.com/users/waprin","html_url":"https://github.com/waprin","followers_url":"https://api.github.com/users/waprin/followers","following_url":"https://api.github.com/users/waprin/following{/other_user}","gists_url":"https://api.github.com/users/waprin/gists{/gist_id}","starred_url":"https://api.github.com/users/waprin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waprin/subscriptions","organizations_url":"https://api.github.com/users/waprin/orgs","repos_url":"https://api.github.com/users/waprin/repos","events_url":"https://api.github.com/users/waprin/events{/privacy}","received_events_url":"https://api.github.com/users/waprin/received_events","type":"User","site_admin":false},"body":"@rimey @supriyagarg \r\n\r\ncc @sharbison3","created_at":"2016-08-09T18:00:35Z","updated_at":"2016-08-09T19:26:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"faa58c9181dbf2caec043d82894d10456bef6fd8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/2071/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/statuses/74ac4c189571a691a587a96836dc3b618be600fa","head":{"label":"waprin:monitoring_factories","ref":"monitoring_factories","sha":"74ac4c189571a691a587a96836dc3b618be600fa","user":{"login":"waprin","id":1075173,"avatar_url":"https://avatars.githubusercontent.com/u/1075173?v=3","gravatar_id":"","url":"https://api.github.com/users/waprin","html_url":"https://github.com/waprin","followers_url":"https://api.github.com/users/waprin/followers","following_url":"https://api.github.com/users/waprin/following{/other_user}","gists_url":"https://api.github.com/users/waprin/gists{/gist_id}","starred_url":"https://api.github.com/users/waprin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waprin/subscriptions","organizations_url":"https://api.github.com/users/waprin/orgs","repos_url":"https://api.github.com/users/waprin/repos","events_url":"https://api.github.com/users/waprin/events{/privacy}","received_events_url":"https://api.github.com/users/waprin/received_events","type":"User","site_admin":false},"repo":{"id":60732333,"name":"gcloud-python","full_name":"waprin/gcloud-python","owner":{"login":"waprin","id":1075173,"avatar_url":"https://avatars.githubusercontent.com/u/1075173?v=3","gravatar_id":"","url":"https://api.github.com/users/waprin","html_url":"https://github.com/waprin","followers_url":"https://api.github.com/users/waprin/followers","following_url":"https://api.github.com/users/waprin/following{/other_user}","gists_url":"https://api.github.com/users/waprin/gists{/gist_id}","starred_url":"https://api.github.com/users/waprin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waprin/subscriptions","organizations_url":"https://api.github.com/users/waprin/orgs","repos_url":"https://api.github.com/users/waprin/repos","events_url":"https://api.github.com/users/waprin/events{/privacy}","received_events_url":"https://api.github.com/users/waprin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/waprin/gcloud-python","description":"Google Cloud Client Library for Python","fork":true,"url":"https://api.github.com/repos/waprin/gcloud-python","forks_url":"https://api.github.com/repos/waprin/gcloud-python/forks","keys_url":"https://api.github.com/repos/waprin/gcloud-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/waprin/gcloud-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/waprin/gcloud-python/teams","hooks_url":"https://api.github.com/repos/waprin/gcloud-python/hooks","issue_events_url":"https://api.github.com/repos/waprin/gcloud-python/issues/events{/number}","events_url":"https://api.github.com/repos/waprin/gcloud-python/events","assignees_url":"https://api.github.com/repos/waprin/gcloud-python/assignees{/user}","branches_url":"https://api.github.com/repos/waprin/gcloud-python/branches{/branch}","tags_url":"https://api.github.com/repos/waprin/gcloud-python/tags","blobs_url":"https://api.github.com/repos/waprin/gcloud-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/waprin/gcloud-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/waprin/gcloud-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/waprin/gcloud-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/waprin/gcloud-python/statuses/{sha}","languages_url":"https://api.github.com/repos/waprin/gcloud-python/languages","stargazers_url":"https://api.github.com/repos/waprin/gcloud-python/stargazers","contributors_url":"https://api.github.com/repos/waprin/gcloud-python/contributors","subscribers_url":"https://api.github.com/repos/waprin/gcloud-python/subscribers","subscription_url":"https://api.github.com/repos/waprin/gcloud-python/subscription","commits_url":"https://api.github.com/repos/waprin/gcloud-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/waprin/gcloud-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/waprin/gcloud-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/waprin/gcloud-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/waprin/gcloud-python/contents/{+path}","compare_url":"https://api.github.com/repos/waprin/gcloud-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/waprin/gcloud-python/merges","archive_url":"https://api.github.com/repos/waprin/gcloud-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/waprin/gcloud-python/downloads","issues_url":"https://api.github.com/repos/waprin/gcloud-python/issues{/number}","pulls_url":"https://api.github.com/repos/waprin/gcloud-python/pulls{/number}","milestones_url":"https://api.github.com/repos/waprin/gcloud-python/milestones{/number}","notifications_url":"https://api.github.com/repos/waprin/gcloud-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/waprin/gcloud-python/labels{/name}","releases_url":"https://api.github.com/repos/waprin/gcloud-python/releases{/id}","deployments_url":"https://api.github.com/repos/waprin/gcloud-python/deployments","created_at":"2016-06-08T21:34:51Z","updated_at":"2016-06-08T21:34:55Z","pushed_at":"2016-08-09T19:18:35Z","git_url":"git://github.com/waprin/gcloud-python.git","ssh_url":"git@github.com:waprin/gcloud-python.git","clone_url":"https://github.com/waprin/gcloud-python.git","svn_url":"https://github.com/waprin/gcloud-python","homepage":"https://googlecloudplatform.github.io/gcloud-python/","size":57968,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"4dbd7f928e80864533bc3731aa91647cbeaccbd4","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":16316451,"name":"gcloud-python","full_name":"GoogleCloudPlatform/gcloud-python","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-python","description":"Google Cloud Client Library for Python","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/deployments","created_at":"2014-01-28T15:51:47Z","updated_at":"2016-08-09T17:04:19Z","pushed_at":"2016-08-09T19:18:35Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-python.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-python.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-python.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-python","homepage":"https://googlecloudplatform.github.io/gcloud-python/","size":71147,"stargazers_count":364,"watchers_count":364,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":188,"mirror_url":null,"open_issues_count":170,"forks":188,"open_issues":170,"watchers":364,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2071"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/2071"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/2071/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2071/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/statuses/74ac4c189571a691a587a96836dc3b618be600fa"}}}}
{"actor":{"display_login":"dhermes"}}