{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/comments/77468139","id":77468139,"diff_hunk":"@@ -490,3 +496,84 @@ def list_groups(self):\n         :returns: A list of group instances.\n         \"\"\"\n         return Group._list(self)\n+\n+    def write_time_series(self, timeseries_list):\n+        \"\"\"Writes a list of time series objects to the API.\n+\n+        The recommended approach to creating time series objects is using\n+        the :meth:`~gcloud.monitoring.client.Client.time_series` factory\n+        method.\n+\n+        Example::\n+\n+            >>> client.write_time_series([ts1, ts2])\n+\n+        If you only need to write a single time series object, consider using\n+        the :meth:`~gcloud.monitoring.client.Client.write_point` method\n+        instead.\n+\n+        :type timeseries_list:\n+            list of :class:`~gcloud.monitoring.timeseries.TimeSeries`.","path":"gcloud/monitoring/client.py","position":50,"original_position":50,"commit_id":"94b5938a6291fad4be48a73082dc574d53e4f7aa","original_commit_id":"94b5938a6291fad4be48a73082dc574d53e4f7aa","user":{"login":"rimey","id":360806,"avatar_url":"https://avatars.githubusercontent.com/u/360806?v=3","gravatar_id":"","url":"https://api.github.com/users/rimey","html_url":"https://github.com/rimey","followers_url":"https://api.github.com/users/rimey/followers","following_url":"https://api.github.com/users/rimey/following{/other_user}","gists_url":"https://api.github.com/users/rimey/gists{/gist_id}","starred_url":"https://api.github.com/users/rimey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rimey/subscriptions","organizations_url":"https://api.github.com/users/rimey/orgs","repos_url":"https://api.github.com/users/rimey/repos","events_url":"https://api.github.com/users/rimey/events{/privacy}","received_events_url":"https://api.github.com/users/rimey/received_events","type":"User","site_admin":false},"body":"We're omitting periods after type descriptions.","created_at":"2016-09-05T03:46:57Z","updated_at":"2016-09-05T03:46:57Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2057#discussion_r77468139","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2057","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/comments/77468139"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2057#discussion_r77468139"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2057"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2057","id":80155289,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2057","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2057.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2057.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/2057","number":2057,"state":"open","locked":false,"title":"Monitoring Custom Metrics","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":"This kicks off the PR for #1867 with the usage docs. Implementation is started and will follow this soon.\r\n\r\n@rimey is primary reviewer here, largely just took most of his suggestions but some followup comments here:\r\n\r\n1) Keyword arguments sounds like a good idea and not too tricky, we can do that now.\r\n\r\n2) re: a way to write multiple TimeSeries in one go. I did add the suggested method.\r\n\r\nCurrently, there is no way to write more than one point in a TimeSeries. The only way we could batch writes is doing something like this: \r\n\r\nhttps://developers.google.com/api-client-library/python/guide/batch\r\n\r\nThis might involve some changes to the core client library here, how important do we think this is?\r\n\r\nIn general, what are the main use cases for writing multiple TimeSeries at once? Is it just batching to reduce network requests? I think the method would currently just be a wrapper around\r\n\r\n```\r\nfor ts in timeseries_list:\r\n     ts.create()\r\n```\r\n\r\nwhich may be a good wrapper to have, even though users could trivially write that out.\r\n\r\n3) I think you want the most common use case to be as simple as possible, which is why I think we want a `write` method that just takes a single value without forcing to pass the metric and resource every time. Since the `timeseries.create()` API call requires a Metric and Resource, we have to have a class that contains that Metric and Resource. We can of course just use the TimeSeries itself, but since you can only write a single point to that TimeSeries, it's not something that makes sense to re-use if we want the local object to map well to the API object. So I instead propose to add a TimeseriesWriter class that can take a Metric and Resource and be re-used to create new TimeSeries with those Metric and Resource. \r\n\r\n```\r\ntimeseries_writer = client.get_timeseries_writer(metric, resource)\r\ntimeseries_writer.write_point(value) # API call\r\n````\r\n\r\ncc @sharbison3 @supriyagarg \r\n","created_at":"2016-08-04T21:46:25Z","updated_at":"2016-09-05T03:46:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b12aac23836d96c7259768101207c93e6753f755","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2057/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2057/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/2057/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/statuses/94b5938a6291fad4be48a73082dc574d53e4f7aa","head":{"label":"waprin:justdoc2","ref":"justdoc2","sha":"94b5938a6291fad4be48a73082dc574d53e4f7aa","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-26T20:10:01Z","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":58296,"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":"30dba6c95fc8fcb63a8dd5a6984cf23c87fed392","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-09-04T10:25:53Z","pushed_at":"2016-09-04T17:21:25Z","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":73487,"stargazers_count":384,"watchers_count":384,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":195,"mirror_url":null,"open_issues_count":195,"forks":195,"open_issues":195,"watchers":384,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2057"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-python/pull/2057"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/2057"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/2057/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/pulls/2057/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/2057/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/statuses/94b5938a6291fad4be48a73082dc574d53e4f7aa"}}}}
{"actor":{"display_login":"rimey"}}