{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/174619745","pull_request_review_id":104008652,"id":174619745,"diff_hunk":"@@ -0,0 +1,55 @@\n+/*\n+Copyright 2017 The Kubernetes Authors.\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 value\n+\n+import (\n+\t\"sync\"\n+\t\"time\"\n+\n+\t\"github.com/prometheus/client_golang/prometheus\"\n+)\n+\n+const (\n+\tvalueSubsystem = \"value\"\n+)\n+\n+var (\n+\tTransformerOperationalLatencies = prometheus.NewSummaryVec(\n+\t\tprometheus.SummaryOpts{\n+\t\t\tSubsystem: valueSubsystem,\n+\t\t\tName:      \"storage_transformation_latency_microseconds\",\n+\t\t\tHelp:      \"Latency in microseconds of value transformation operations.\",\n+\t\t},\n+\t\t[]string{\"transformation_type\"},\n+\t)\n+)\n+\n+var registerMetrics sync.Once\n+\n+func RegisterMetrics() {\n+\tregisterMetrics.Do(func() {\n+\t\tprometheus.MustRegister(TransformerOperationalLatencies)\n+\t})\n+}\n+\n+func RecordTransformation(transformationType string, start time.Time) {\n+\tTransformerOperationalLatencies.WithLabelValues(transformationType).Observe(sinceInMicroseconds(start))\n+}\n+\n+func sinceInMicroseconds(start time.Time) float64 {\n+\treturn float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())","path":"staging/src/k8s.io/apiserver/pkg/storage/value/metrics.go","position":54,"original_position":54,"commit_id":"e54864f53de75cd56c0fe94777e1d3de0c559c7f","original_commit_id":"e54864f53de75cd56c0fe94777e1d3de0c559c7f","user":{"login":"tallclair","id":29742491,"avatar_url":"https://avatars1.githubusercontent.com/u/29742491?v=4","gravatar_id":"","url":"https://api.github.com/users/tallclair","html_url":"https://github.com/tallclair","followers_url":"https://api.github.com/users/tallclair/followers","following_url":"https://api.github.com/users/tallclair/following{/other_user}","gists_url":"https://api.github.com/users/tallclair/gists{/gist_id}","starred_url":"https://api.github.com/users/tallclair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallclair/subscriptions","organizations_url":"https://api.github.com/users/tallclair/orgs","repos_url":"https://api.github.com/users/tallclair/repos","events_url":"https://api.github.com/users/tallclair/events{/privacy}","received_events_url":"https://api.github.com/users/tallclair/received_events","type":"User","site_admin":false},"body":"nit: I think it's more clear to leave off the nanoseconds: `time.Since(start) / time.Microsecond`.","created_at":"2018-03-14T21:44:39Z","updated_at":"2018-03-14T21:48:10Z","html_url":"https://github.com/kubernetes/kubernetes/pull/60536#discussion_r174619745","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/174619745"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/60536#discussion_r174619745"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536","id":171832319,"html_url":"https://github.com/kubernetes/kubernetes/pull/60536","diff_url":"https://github.com/kubernetes/kubernetes/pull/60536.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/60536.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/60536","number":60536,"state":"open","locked":false,"title":"Instrument transformer.go with latency metrics.","user":{"login":"immutableT","id":24857912,"avatar_url":"https://avatars1.githubusercontent.com/u/24857912?v=4","gravatar_id":"","url":"https://api.github.com/users/immutableT","html_url":"https://github.com/immutableT","followers_url":"https://api.github.com/users/immutableT/followers","following_url":"https://api.github.com/users/immutableT/following{/other_user}","gists_url":"https://api.github.com/users/immutableT/gists{/gist_id}","starred_url":"https://api.github.com/users/immutableT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immutableT/subscriptions","organizations_url":"https://api.github.com/users/immutableT/orgs","repos_url":"https://api.github.com/users/immutableT/repos","events_url":"https://api.github.com/users/immutableT/events{/privacy}","received_events_url":"https://api.github.com/users/immutableT/received_events","type":"User","site_admin":false},"body":"<!--  Thanks for sending a pull request!  Here are some tips for you:\r\n1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/devel/pull-requests.md#the-pr-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide\r\n2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/devel/pull-requests.md#best-practices-for-faster-reviews\r\n3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/devel/pull-requests.md#write-release-notes-if-needed\r\n4. If the PR is unfinished, see how to mark it: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#marking-unfinished-pull-requests\r\n-->\r\n\r\n**What this PR does / why we need it**:\r\nInstrument transformer.go with latency metrics - allowing to measure performance impact of adding KMS Providers.\r\n**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:\r\nFixes #\r\n\r\n**Special notes for your reviewer**:\r\n\r\n**Release note**:\r\n<!--  Write your release note:\r\n1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string \"action required\".\r\n2. If no release note is required, just write \"NONE\".\r\n-->\r\n```release-note\r\n\"NONE\"\r\n```\r\n","created_at":"2018-02-28T01:26:49Z","updated_at":"2018-03-14T21:48:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"318b505ea50fcc6545533a242bb242c3917ca2ce","assignee":{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars3.githubusercontent.com/u/1787169?v=4","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false},"assignees":[{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars3.githubusercontent.com/u/1787169?v=4","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"liggitt","id":980082,"avatar_url":"https://avatars0.githubusercontent.com/u/980082?v=4","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":477397086,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":349530249,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/release-note-none","name":"release-note-none","color":"c2e0c6","default":false},{"id":253450978,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/L","name":"size/L","color":"ee9900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/60536/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/e54864f53de75cd56c0fe94777e1d3de0c559c7f","head":{"label":"immutableT:transformer_metrics","ref":"transformer_metrics","sha":"e54864f53de75cd56c0fe94777e1d3de0c559c7f","user":{"login":"immutableT","id":24857912,"avatar_url":"https://avatars1.githubusercontent.com/u/24857912?v=4","gravatar_id":"","url":"https://api.github.com/users/immutableT","html_url":"https://github.com/immutableT","followers_url":"https://api.github.com/users/immutableT/followers","following_url":"https://api.github.com/users/immutableT/following{/other_user}","gists_url":"https://api.github.com/users/immutableT/gists{/gist_id}","starred_url":"https://api.github.com/users/immutableT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immutableT/subscriptions","organizations_url":"https://api.github.com/users/immutableT/orgs","repos_url":"https://api.github.com/users/immutableT/repos","events_url":"https://api.github.com/users/immutableT/events{/privacy}","received_events_url":"https://api.github.com/users/immutableT/received_events","type":"User","site_admin":false},"repo":{"id":110576904,"name":"kubernetes","full_name":"immutableT/kubernetes","owner":{"login":"immutableT","id":24857912,"avatar_url":"https://avatars1.githubusercontent.com/u/24857912?v=4","gravatar_id":"","url":"https://api.github.com/users/immutableT","html_url":"https://github.com/immutableT","followers_url":"https://api.github.com/users/immutableT/followers","following_url":"https://api.github.com/users/immutableT/following{/other_user}","gists_url":"https://api.github.com/users/immutableT/gists{/gist_id}","starred_url":"https://api.github.com/users/immutableT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immutableT/subscriptions","organizations_url":"https://api.github.com/users/immutableT/orgs","repos_url":"https://api.github.com/users/immutableT/repos","events_url":"https://api.github.com/users/immutableT/events{/privacy}","received_events_url":"https://api.github.com/users/immutableT/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/immutableT/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/immutableT/kubernetes","forks_url":"https://api.github.com/repos/immutableT/kubernetes/forks","keys_url":"https://api.github.com/repos/immutableT/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/immutableT/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/immutableT/kubernetes/teams","hooks_url":"https://api.github.com/repos/immutableT/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/immutableT/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/immutableT/kubernetes/events","assignees_url":"https://api.github.com/repos/immutableT/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/immutableT/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/immutableT/kubernetes/tags","blobs_url":"https://api.github.com/repos/immutableT/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/immutableT/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/immutableT/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/immutableT/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/immutableT/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/immutableT/kubernetes/languages","stargazers_url":"https://api.github.com/repos/immutableT/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/immutableT/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/immutableT/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/immutableT/kubernetes/subscription","commits_url":"https://api.github.com/repos/immutableT/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/immutableT/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/immutableT/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/immutableT/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/immutableT/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/immutableT/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/immutableT/kubernetes/merges","archive_url":"https://api.github.com/repos/immutableT/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/immutableT/kubernetes/downloads","issues_url":"https://api.github.com/repos/immutableT/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/immutableT/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/immutableT/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/immutableT/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/immutableT/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/immutableT/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/immutableT/kubernetes/deployments","created_at":"2017-11-13T17:06:59Z","updated_at":"2017-11-13T17:08:06Z","pushed_at":"2018-03-05T16:34:32Z","git_url":"git://github.com/immutableT/kubernetes.git","ssh_url":"git@github.com:immutableT/kubernetes.git","clone_url":"https://github.com/immutableT/kubernetes.git","svn_url":"https://github.com/immutableT/kubernetes","homepage":"http://kubernetes.io","size":538890,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"ae1fc13aee81e66b9b74a5fb881ff3f90463ff4e","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","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://avatars2.githubusercontent.com/u/13629408?v=4","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":"Production-Grade Container Scheduling and Management","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":"2018-03-14T21:16:27Z","pushed_at":"2018-03-14T21:36:54Z","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":764795,"stargazers_count":33728,"watchers_count":33728,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11967,"mirror_url":null,"archived":false,"open_issues_count":3535,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":11967,"open_issues":3535,"watchers":33728,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/60536"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/60536"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/60536/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60536/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/e54864f53de75cd56c0fe94777e1d3de0c559c7f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"tallclair"}}