{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/56458404","id":56458404,"diff_hunk":"@@ -0,0 +1,104 @@\n+/*\n+Copyright 2016 The Kubernetes Authors 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+\n+package e2e\n+\n+import (\n+\t\"fmt\"\n+\n+\t\"k8s.io/kubernetes/test/e2e/perftype\"\n+)\n+\n+// TODO(random-liu): Change the tests to actually use PerfData from the begining instead of\n+// translating one to the other here.\n+\n+// apiCallToPerfData transforms APIResponsiveness to PerfData.\n+func apiCallToPerfData(apicalls APIResponsiveness) *perftype.PerfData {\n+\tperfData := &perftype.PerfData{}\n+\tfor _, apicall := range apicalls.APICalls {\n+\t\titem := perftype.DataItem{\n+\t\t\tData: map[string]float64{\n+\t\t\t\t\"Perc50\": float64(apicall.Latency.Perc50) / 1000000, // us -> ms\n+\t\t\t\t\"Perc90\": float64(apicall.Latency.Perc90) / 1000000,\n+\t\t\t\t\"Perc99\": float64(apicall.Latency.Perc99) / 1000000,\n+\t\t\t},\n+\t\t\tUnit: \"ms\",\n+\t\t\tLabels: map[string]string{\n+\t\t\t\t\"Verb\":     apicall.Verb,\n+\t\t\t\t\"Resource\": apicall.Resource,\n+\t\t\t},\n+\t\t}\n+\t\tperfData.DataItems = append(perfData.DataItems, item)\n+\t}\n+\treturn perfData\n+}\n+\n+// resourceUsageToPerfData transforms resourceUsagePerNode to PerfData. Notice that this function\n+// only cares about memory usage, because cpu usage information will be extracted from nodesCpuSummary.\n+func resourceUsageToPerfData(usagePerNode resourceUsagePerNode) *perftype.PerfData {\n+\titems := []perftype.DataItem{}\n+\tfor node, usages := range usagePerNode {\n+\t\tfor c, usage := range usages {\n+\t\t\titem := perftype.DataItem{\n+\t\t\t\tData: map[string]float64{\n+\t\t\t\t\t\"memory\":     float64(usage.MemoryRSSInBytes) / (1024 * 1024),\n+\t\t\t\t\t\"workingset\": float64(usage.MemoryWorkingSetInBytes) / (1024 * 1024),\n+\t\t\t\t\t\"rss\":        float64(usage.MemoryRSSInBytes) / (1024 * 1024),\n+\t\t\t\t},\n+\t\t\t\tUnit: \"MB\",\n+\t\t\t\tLabels: map[string]string{\n+\t\t\t\t\t\"node\":      node,\n+\t\t\t\t\t\"container\": c,\n+\t\t\t\t\t\"resource\":  \"memory\",\n+\t\t\t\t},\n+\t\t\t}\n+\t\t\titems = append(items, item)\n+\t\t}\n+\t}\n+\treturn &perftype.PerfData{DataItems: items}\n+}\n+\n+// cpuUsageToPerfData transforms nodesCPUSummary to PerfData.\n+func cpuUsageToPerfData(usagePerNode nodesCPUSummary) *perftype.PerfData {\n+\titems := []perftype.DataItem{}\n+\tfor node, usages := range usagePerNode {\n+\t\tfor c, usage := range usages {\n+\t\t\tdata := map[string]float64{}\n+\t\t\tfor perc, value := range usage {\n+\t\t\t\tdata[fmt.Sprintf(\"Perc%02.0f\", perc*100)] = value * 100\n+\t\t\t}\n+\t\t\titem := perftype.DataItem{\n+\t\t\t\tData: data,\n+\t\t\t\tUnit: \"%\",\n+\t\t\t\tLabels: map[string]string{\n+\t\t\t\t\t\"node\":      node,\n+\t\t\t\t\t\"container\": c,\n+\t\t\t\t\t\"resource\":  \"cpu\",\n+\t\t\t\t},\n+\t\t\t}\n+\t\t\titems = append(items, item)\n+\t\t}\n+\t}\n+\treturn &perftype.PerfData{DataItems: items}\n+}\n+\n+// printPerfData prints the perfdata in json format with PerfResultTag prefix.\n+// If an error occurs, nothing will be printed.\n+func printPerfData(p *perftype.PerfData) {\n+\tif str := prettyPrintJSON(p); str != \"\" {\n+\t\tLogf(\"%s\", perftype.PerfResultTag+\" \"+str)","path":"test/e2e/perf_util.go","position":102,"original_position":102,"commit_id":"dac367f5eaeb9f703d6658f09fb6255a6df20e52","original_commit_id":"dac367f5eaeb9f703d6658f09fb6255a6df20e52","user":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars.githubusercontent.com/u/5821883?v=3","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"body":"@ixdy, Yeah, it would be better. However, it seems that we have plan to push metrics to Prometheus in the future #22980, so for now I think maybe we could keep the old behavior. :)","created_at":"2016-03-17T05:47:07Z","updated_at":"2016-03-17T05:47:07Z","html_url":"https://github.com/kubernetes/kubernetes/pull/22912#discussion_r56458404","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/56458404"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/22912#discussion_r56458404"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912","id":62656548,"html_url":"https://github.com/kubernetes/kubernetes/pull/22912","diff_url":"https://github.com/kubernetes/kubernetes/pull/22912.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/22912.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/22912","number":22912,"state":"open","locked":false,"title":"Add generalized performance data type in e2e test","user":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars.githubusercontent.com/u/5821883?v=3","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"body":"For kubernetes/contrib/issues/564 and #15554.\r\n\r\nThis PR added two files in e2e test:\r\n1) `perftype/perftype.go`: This file contains generalized performance data type. The type can be pretty printed in Json format and analyzed by other performance analyzing tools, such as [Perfdash](https://github.com/kubernetes/contrib/tree/master/perfdash).\r\n2) `perf_util.go`: This file contains functions which convert e2e performance test result into new performance data type.\r\n\r\nThe new performance data type is now used in *Density test, Load test and Kubelet resource tracking*. It's easy to support other e2e performance test by adding new convert function in `perf_util.go`.\r\n\r\n@gmarek @yujuhong \r\n/cc @kubernetes/sig-testing","created_at":"2016-03-13T00:06:11Z","updated_at":"2016-03-17T05:47:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7358484af354530bf9606ff61b6402c35b0cd249","assignee":{"login":"gmarek","id":1703842,"avatar_url":"https://avatars.githubusercontent.com/u/1703842?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarek","html_url":"https://github.com/gmarek","followers_url":"https://api.github.com/users/gmarek/followers","following_url":"https://api.github.com/users/gmarek/following{/other_user}","gists_url":"https://api.github.com/users/gmarek/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarek/subscriptions","organizations_url":"https://api.github.com/users/gmarek/orgs","repos_url":"https://api.github.com/users/gmarek/repos","events_url":"https://api.github.com/users/gmarek/events{/privacy}","received_events_url":"https://api.github.com/users/gmarek/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/22912/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/dac367f5eaeb9f703d6658f09fb6255a6df20e52","head":{"label":"Random-Liu:kubelet-perf","ref":"kubelet-perf","sha":"dac367f5eaeb9f703d6658f09fb6255a6df20e52","user":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars.githubusercontent.com/u/5821883?v=3","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"repo":{"id":44042241,"name":"kubernetes","full_name":"Random-Liu/kubernetes","owner":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars.githubusercontent.com/u/5821883?v=3","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Random-Liu/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/Random-Liu/kubernetes","forks_url":"https://api.github.com/repos/Random-Liu/kubernetes/forks","keys_url":"https://api.github.com/repos/Random-Liu/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Random-Liu/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Random-Liu/kubernetes/teams","hooks_url":"https://api.github.com/repos/Random-Liu/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/Random-Liu/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/Random-Liu/kubernetes/events","assignees_url":"https://api.github.com/repos/Random-Liu/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/Random-Liu/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/Random-Liu/kubernetes/tags","blobs_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Random-Liu/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/Random-Liu/kubernetes/languages","stargazers_url":"https://api.github.com/repos/Random-Liu/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/Random-Liu/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/Random-Liu/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/Random-Liu/kubernetes/subscription","commits_url":"https://api.github.com/repos/Random-Liu/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/Random-Liu/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/Random-Liu/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/Random-Liu/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/Random-Liu/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Random-Liu/kubernetes/merges","archive_url":"https://api.github.com/repos/Random-Liu/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Random-Liu/kubernetes/downloads","issues_url":"https://api.github.com/repos/Random-Liu/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/Random-Liu/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/Random-Liu/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/Random-Liu/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Random-Liu/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/Random-Liu/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/Random-Liu/kubernetes/deployments","created_at":"2015-10-11T06:51:00Z","updated_at":"2016-02-04T00:52:34Z","pushed_at":"2016-03-14T22:42:32Z","git_url":"git://github.com/Random-Liu/kubernetes.git","ssh_url":"git@github.com:Random-Liu/kubernetes.git","clone_url":"https://github.com/Random-Liu/kubernetes.git","svn_url":"https://github.com/Random-Liu/kubernetes","homepage":"http://kubernetes.io","size":178342,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"kubernetes:master","ref":"master","sha":"c9250bba2a41129df3a06ee8cac6305c73c3231b","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2016-03-17T05:46:23Z","pushed_at":"2016-03-17T05:01:29Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":343290,"stargazers_count":13279,"watchers_count":13279,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3841,"mirror_url":null,"open_issues_count":3016,"forks":3841,"open_issues":3016,"watchers":13279,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/22912"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/22912"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/22912/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/22912/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/dac367f5eaeb9f703d6658f09fb6255a6df20e52"}}}}