{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/comments/26991185","id":26991185,"diff_hunk":"@@ -0,0 +1,48 @@\n+// Copyright 2014 Google Inc. All Rights Reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+// This file implements a cadvisor datasource, that collects metrics from an instance\n+// of cadvisor runing on a specific host.\n+\n+package datasource\n+\n+import (\n+\t\"time\"\n+\n+\t\"github.com/golang/glog\"\n+\tcadvisor \"github.com/google/cadvisor/info/v1\"\n+)\n+\n+func sampleContainerStats(stats []*cadvisor.ContainerStats, resolution time.Duration) []*cadvisor.ContainerStats {\n+\tif len(stats) == 0 {\n+\t\treturn stats\n+\t}\n+\tfilteredStats := []*cadvisor.ContainerStats{}\n+\tvar nextTimestamp time.Time","path":"sources/datasource/utils.go","position":32,"original_position":32,"commit_id":"413beabfa1d3e0f571fe84b8ccc84bea55ec17b3","original_commit_id":"9279b94293dae710aa42673cdbf408383df587b0","user":{"login":"vishh","id":7063592,"avatar_url":"https://avatars.githubusercontent.com/u/7063592?v=3","gravatar_id":"","url":"https://api.github.com/users/vishh","html_url":"https://github.com/vishh","followers_url":"https://api.github.com/users/vishh/followers","following_url":"https://api.github.com/users/vishh/following{/other_user}","gists_url":"https://api.github.com/users/vishh/gists{/gist_id}","starred_url":"https://api.github.com/users/vishh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishh/subscriptions","organizations_url":"https://api.github.com/users/vishh/orgs","repos_url":"https://api.github.com/users/vishh/repos","events_url":"https://api.github.com/users/vishh/events{/privacy}","received_events_url":"https://api.github.com/users/vishh/received_events","type":"User","site_admin":false},"body":"Thats true. But that would require us passing in last timestamp all the way through. I resorted to requiring the resolution to be relative to the polling duration. If you think it is too confusing for users, I can plumb last timestamp as well.","created_at":"2015-03-23T23:27:02Z","updated_at":"2015-03-23T23:27:02Z","html_url":"https://github.com/GoogleCloudPlatform/heapster/pull/181#discussion_r26991185","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/comments/26991185"},"html":{"href":"https://github.com/GoogleCloudPlatform/heapster/pull/181#discussion_r26991185"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181","id":31704375,"html_url":"https://github.com/GoogleCloudPlatform/heapster/pull/181","diff_url":"https://github.com/GoogleCloudPlatform/heapster/pull/181.diff","patch_url":"https://github.com/GoogleCloudPlatform/heapster/pull/181.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/181","number":181,"state":"open","locked":false,"title":"Use time range instead of last x stats when querying cadvisor or kubelet","user":{"login":"vishh","id":7063592,"avatar_url":"https://avatars.githubusercontent.com/u/7063592?v=3","gravatar_id":"","url":"https://api.github.com/users/vishh","html_url":"https://github.com/vishh","followers_url":"https://api.github.com/users/vishh/followers","following_url":"https://api.github.com/users/vishh/following{/other_user}","gists_url":"https://api.github.com/users/vishh/gists{/gist_id}","starred_url":"https://api.github.com/users/vishh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishh/subscriptions","organizations_url":"https://api.github.com/users/vishh/orgs","repos_url":"https://api.github.com/users/vishh/repos","events_url":"https://api.github.com/users/vishh/events{/privacy}","received_events_url":"https://api.github.com/users/vishh/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-23T04:23:53Z","updated_at":"2015-03-23T23:27:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66c3eca54e95258105f28932b12200049ac4b751","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/181/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/statuses/413beabfa1d3e0f571fe84b8ccc84bea55ec17b3","head":{"label":"vishh:resolution","ref":"resolution","sha":"413beabfa1d3e0f571fe84b8ccc84bea55ec17b3","user":{"login":"vishh","id":7063592,"avatar_url":"https://avatars.githubusercontent.com/u/7063592?v=3","gravatar_id":"","url":"https://api.github.com/users/vishh","html_url":"https://github.com/vishh","followers_url":"https://api.github.com/users/vishh/followers","following_url":"https://api.github.com/users/vishh/following{/other_user}","gists_url":"https://api.github.com/users/vishh/gists{/gist_id}","starred_url":"https://api.github.com/users/vishh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishh/subscriptions","organizations_url":"https://api.github.com/users/vishh/orgs","repos_url":"https://api.github.com/users/vishh/repos","events_url":"https://api.github.com/users/vishh/events{/privacy}","received_events_url":"https://api.github.com/users/vishh/received_events","type":"User","site_admin":false},"repo":{"id":26147157,"name":"heapster-1","full_name":"vishh/heapster-1","owner":{"login":"vishh","id":7063592,"avatar_url":"https://avatars.githubusercontent.com/u/7063592?v=3","gravatar_id":"","url":"https://api.github.com/users/vishh","html_url":"https://github.com/vishh","followers_url":"https://api.github.com/users/vishh/followers","following_url":"https://api.github.com/users/vishh/following{/other_user}","gists_url":"https://api.github.com/users/vishh/gists{/gist_id}","starred_url":"https://api.github.com/users/vishh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishh/subscriptions","organizations_url":"https://api.github.com/users/vishh/orgs","repos_url":"https://api.github.com/users/vishh/repos","events_url":"https://api.github.com/users/vishh/events{/privacy}","received_events_url":"https://api.github.com/users/vishh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vishh/heapster-1","description":"Monitor container resource usage of a Kubernetes cluster","fork":true,"url":"https://api.github.com/repos/vishh/heapster-1","forks_url":"https://api.github.com/repos/vishh/heapster-1/forks","keys_url":"https://api.github.com/repos/vishh/heapster-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vishh/heapster-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vishh/heapster-1/teams","hooks_url":"https://api.github.com/repos/vishh/heapster-1/hooks","issue_events_url":"https://api.github.com/repos/vishh/heapster-1/issues/events{/number}","events_url":"https://api.github.com/repos/vishh/heapster-1/events","assignees_url":"https://api.github.com/repos/vishh/heapster-1/assignees{/user}","branches_url":"https://api.github.com/repos/vishh/heapster-1/branches{/branch}","tags_url":"https://api.github.com/repos/vishh/heapster-1/tags","blobs_url":"https://api.github.com/repos/vishh/heapster-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vishh/heapster-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vishh/heapster-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/vishh/heapster-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vishh/heapster-1/statuses/{sha}","languages_url":"https://api.github.com/repos/vishh/heapster-1/languages","stargazers_url":"https://api.github.com/repos/vishh/heapster-1/stargazers","contributors_url":"https://api.github.com/repos/vishh/heapster-1/contributors","subscribers_url":"https://api.github.com/repos/vishh/heapster-1/subscribers","subscription_url":"https://api.github.com/repos/vishh/heapster-1/subscription","commits_url":"https://api.github.com/repos/vishh/heapster-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/vishh/heapster-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/vishh/heapster-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/vishh/heapster-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/vishh/heapster-1/contents/{+path}","compare_url":"https://api.github.com/repos/vishh/heapster-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vishh/heapster-1/merges","archive_url":"https://api.github.com/repos/vishh/heapster-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vishh/heapster-1/downloads","issues_url":"https://api.github.com/repos/vishh/heapster-1/issues{/number}","pulls_url":"https://api.github.com/repos/vishh/heapster-1/pulls{/number}","milestones_url":"https://api.github.com/repos/vishh/heapster-1/milestones{/number}","notifications_url":"https://api.github.com/repos/vishh/heapster-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vishh/heapster-1/labels{/name}","releases_url":"https://api.github.com/repos/vishh/heapster-1/releases{/id}","created_at":"2014-11-04T01:26:41Z","updated_at":"2014-11-03T17:13:19Z","pushed_at":"2015-03-23T23:15:05Z","git_url":"git://github.com/vishh/heapster-1.git","ssh_url":"git@github.com:vishh/heapster-1.git","clone_url":"https://github.com/vishh/heapster-1.git","svn_url":"https://github.com/vishh/heapster-1","homepage":"","size":20252,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"9ea7e6f379c1860fabefc0c3ce86dc36a173c157","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":23272510,"name":"heapster","full_name":"GoogleCloudPlatform/heapster","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/heapster","description":"Monitor container resource usage of a Kubernetes cluster","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/heapster","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/releases{/id}","created_at":"2014-08-24T03:50:18Z","updated_at":"2015-03-23T19:22:31Z","pushed_at":"2015-03-23T23:23:52Z","git_url":"git://github.com/GoogleCloudPlatform/heapster.git","ssh_url":"git@github.com:GoogleCloudPlatform/heapster.git","clone_url":"https://github.com/GoogleCloudPlatform/heapster.git","svn_url":"https://github.com/GoogleCloudPlatform/heapster","homepage":"","size":19613,"stargazers_count":233,"watchers_count":233,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":33,"forks":40,"open_issues":33,"watchers":233,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181"},"html":{"href":"https://github.com/GoogleCloudPlatform/heapster/pull/181"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/181"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/181/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/pulls/181/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/heapster/statuses/413beabfa1d3e0f571fe84b8ccc84bea55ec17b3"}}}}