{"action":"created","comment":{"url":"https://api.github.com/repos/minio/minio/pulls/comments/218246473","pull_request_review_id":156141978,"id":218246473,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODI0NjQ3Mw==","diff_hunk":"@@ -182,26 +183,64 @@ func contains(slice interface{}, elem interface{}) bool {\n \treturn false\n }\n \n+// profilerWrapper is created becauses pkg/profiler doesn't\n+// provide any API to calculate the profiler file path in the\n+// disk since the name of this latter is randomly generated.\n+type profilerWrapper struct {\n+\tstopFn func()\n+\tpathFn func() string\n+}\n+\n+func (p profilerWrapper) Stop() {\n+\tp.stopFn()\n+}\n+\n+func (p profilerWrapper) Path() string {\n+\treturn p.pathFn()\n+}\n+\n // Starts a profiler returns nil if profiler is not enabled, caller needs to handle this.\n-func startProfiler(profiler string) interface {\n+func startProfiler(profilerType, dirPath string) interface {\n \tStop()\n+\tPath() string\n } {\n+\n+\tvar err error\n+\tif dirPath == \"\" {\n+\t\tdirPath, err = ioutil.TempDir(\"\", \"profile\")\n+\t\tlogger.FatalIf(err, \"Unable to create a temporary directory for profiling\")\n+\t}\n+\n+\tvar profiler interface {\n+\t\tStop()\n+\t}\n+\n \t// Enable profiler if ``_MINIO_PROFILER`` is set. Supported options are [cpu, mem, block].","path":"cmd/utils.go","position":45,"original_position":45,"commit_id":"77e2a1f8f4bed027b22977e230ff70ac4c4f311b","original_commit_id":"77e2a1f8f4bed027b22977e230ff70ac4c4f311b","user":{"login":"donatello","id":200059,"node_id":"MDQ6VXNlcjIwMDA1OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/200059?v=4","gravatar_id":"","url":"https://api.github.com/users/donatello","html_url":"https://github.com/donatello","followers_url":"https://api.github.com/users/donatello/followers","following_url":"https://api.github.com/users/donatello/following{/other_user}","gists_url":"https://api.github.com/users/donatello/gists{/gist_id}","starred_url":"https://api.github.com/users/donatello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donatello/subscriptions","organizations_url":"https://api.github.com/users/donatello/orgs","repos_url":"https://api.github.com/users/donatello/repos","events_url":"https://api.github.com/users/donatello/events{/privacy}","received_events_url":"https://api.github.com/users/donatello/received_events","type":"User","site_admin":false},"body":"This comment looks out of place here as we are not checking any environment variables near by this code.","created_at":"2018-09-17T22:21:41Z","updated_at":"2018-09-17T22:30:42Z","html_url":"https://github.com/minio/minio/pull/6463#discussion_r218246473","pull_request_url":"https://api.github.com/repos/minio/minio/pulls/6463","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/comments/218246473"},"html":{"href":"https://github.com/minio/minio/pull/6463#discussion_r218246473"},"pull_request":{"href":"https://api.github.com/repos/minio/minio/pulls/6463"}}},"pull_request":{"url":"https://api.github.com/repos/minio/minio/pulls/6463","id":215117394,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1MTE3Mzk0","html_url":"https://github.com/minio/minio/pull/6463","diff_url":"https://github.com/minio/minio/pull/6463.diff","patch_url":"https://github.com/minio/minio/pull/6463.patch","issue_url":"https://api.github.com/repos/minio/minio/issues/6463","number":6463,"state":"open","locked":false,"title":"Add Profiler Admin API","user":{"login":"vadmeste","id":283197,"node_id":"MDQ6VXNlcjI4MzE5Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/283197?v=4","gravatar_id":"","url":"https://api.github.com/users/vadmeste","html_url":"https://github.com/vadmeste","followers_url":"https://api.github.com/users/vadmeste/followers","following_url":"https://api.github.com/users/vadmeste/following{/other_user}","gists_url":"https://api.github.com/users/vadmeste/gists{/gist_id}","starred_url":"https://api.github.com/users/vadmeste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadmeste/subscriptions","organizations_url":"https://api.github.com/users/vadmeste/orgs","repos_url":"https://api.github.com/users/vadmeste/repos","events_url":"https://api.github.com/users/vadmeste/events{/privacy}","received_events_url":"https://api.github.com/users/vadmeste/received_events","type":"User","site_admin":false},"body":"## Description\r\nTwo handlers are added to admin API to enable profiling and disable\r\nprofiling of a server in a standalone mode, or all nodes in the\r\ndistributed mode.\r\n\r\n/minio/admin/profiling/start/{cpu,block,mem}:\r\n  - Start profiling and return starting JSON results, e.g. one\r\n    node is offline.\r\n\r\n/minio/admin/profiling/download:\r\n  - Stop the on-going profiling task\r\n  - Stream a zip file which contains all profiling files that can\r\n    be later inspected by go tool pprof\r\n\r\n## Motivation and Context\r\nFixes https://github.com/minio/minio/issues/6462\r\n\r\n## Regression\r\nNo\r\n\r\n## How Has This Been Tested?\r\n1. Checkout this PR\r\n2. Go to $GOPATH/src/github.com/minio/minio/pkg/madmin/examples/\r\n3. Edit Minio credentials in profiling.go\r\n4. `go run profiling.go`\r\n5. `unzip /tmp/profiling-cpu.zip`\r\n6.  Generate pdf to the profiling data of the first server\r\n`go tool pprof -pdf $(which minio) profiling-0 >/tmp/profiling.pdf`\r\n\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\n- [ ] I have added unit tests to cover my changes.\r\n- [ ] I have added/updated functional tests in [mint](https://github.com/minio/mint). (If yes, add `mint` PR # here: )\r\n- [x] All new and existing tests passed.","created_at":"2018-09-12T22:45:08Z","updated_at":"2018-09-17T22:30:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0217314638d77b080780405c3c93b746a9bdee3d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/minio/minio/pulls/6463/commits","review_comments_url":"https://api.github.com/repos/minio/minio/pulls/6463/comments","review_comment_url":"https://api.github.com/repos/minio/minio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/minio/minio/issues/6463/comments","statuses_url":"https://api.github.com/repos/minio/minio/statuses/77e2a1f8f4bed027b22977e230ff70ac4c4f311b","head":{"label":"vadmeste:add-profiler","ref":"add-profiler","sha":"77e2a1f8f4bed027b22977e230ff70ac4c4f311b","user":{"login":"vadmeste","id":283197,"node_id":"MDQ6VXNlcjI4MzE5Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/283197?v=4","gravatar_id":"","url":"https://api.github.com/users/vadmeste","html_url":"https://github.com/vadmeste","followers_url":"https://api.github.com/users/vadmeste/followers","following_url":"https://api.github.com/users/vadmeste/following{/other_user}","gists_url":"https://api.github.com/users/vadmeste/gists{/gist_id}","starred_url":"https://api.github.com/users/vadmeste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadmeste/subscriptions","organizations_url":"https://api.github.com/users/vadmeste/orgs","repos_url":"https://api.github.com/users/vadmeste/repos","events_url":"https://api.github.com/users/vadmeste/events{/privacy}","received_events_url":"https://api.github.com/users/vadmeste/received_events","type":"User","site_admin":false},"repo":{"id":30432336,"node_id":"MDEwOlJlcG9zaXRvcnkzMDQzMjMzNg==","name":"minio","full_name":"vadmeste/minio","private":false,"owner":{"login":"vadmeste","id":283197,"node_id":"MDQ6VXNlcjI4MzE5Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/283197?v=4","gravatar_id":"","url":"https://api.github.com/users/vadmeste","html_url":"https://github.com/vadmeste","followers_url":"https://api.github.com/users/vadmeste/followers","following_url":"https://api.github.com/users/vadmeste/following{/other_user}","gists_url":"https://api.github.com/users/vadmeste/gists{/gist_id}","starred_url":"https://api.github.com/users/vadmeste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadmeste/subscriptions","organizations_url":"https://api.github.com/users/vadmeste/orgs","repos_url":"https://api.github.com/users/vadmeste/repos","events_url":"https://api.github.com/users/vadmeste/events{/privacy}","received_events_url":"https://api.github.com/users/vadmeste/received_events","type":"User","site_admin":false},"html_url":"https://github.com/vadmeste/minio","description":"Minio is an open source object storage inspired by Amazon S3 and Facebook Haystack ","fork":true,"url":"https://api.github.com/repos/vadmeste/minio","forks_url":"https://api.github.com/repos/vadmeste/minio/forks","keys_url":"https://api.github.com/repos/vadmeste/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vadmeste/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vadmeste/minio/teams","hooks_url":"https://api.github.com/repos/vadmeste/minio/hooks","issue_events_url":"https://api.github.com/repos/vadmeste/minio/issues/events{/number}","events_url":"https://api.github.com/repos/vadmeste/minio/events","assignees_url":"https://api.github.com/repos/vadmeste/minio/assignees{/user}","branches_url":"https://api.github.com/repos/vadmeste/minio/branches{/branch}","tags_url":"https://api.github.com/repos/vadmeste/minio/tags","blobs_url":"https://api.github.com/repos/vadmeste/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vadmeste/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vadmeste/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/vadmeste/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vadmeste/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/vadmeste/minio/languages","stargazers_url":"https://api.github.com/repos/vadmeste/minio/stargazers","contributors_url":"https://api.github.com/repos/vadmeste/minio/contributors","subscribers_url":"https://api.github.com/repos/vadmeste/minio/subscribers","subscription_url":"https://api.github.com/repos/vadmeste/minio/subscription","commits_url":"https://api.github.com/repos/vadmeste/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/vadmeste/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/vadmeste/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/vadmeste/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/vadmeste/minio/contents/{+path}","compare_url":"https://api.github.com/repos/vadmeste/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vadmeste/minio/merges","archive_url":"https://api.github.com/repos/vadmeste/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vadmeste/minio/downloads","issues_url":"https://api.github.com/repos/vadmeste/minio/issues{/number}","pulls_url":"https://api.github.com/repos/vadmeste/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/vadmeste/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/vadmeste/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vadmeste/minio/labels{/name}","releases_url":"https://api.github.com/repos/vadmeste/minio/releases{/id}","deployments_url":"https://api.github.com/repos/vadmeste/minio/deployments","created_at":"2015-02-06T20:48:08Z","updated_at":"2018-04-11T00:18:07Z","pushed_at":"2018-09-17T21:11:45Z","git_url":"git://github.com/vadmeste/minio.git","ssh_url":"git@github.com:vadmeste/minio.git","clone_url":"https://github.com/vadmeste/minio.git","svn_url":"https://github.com/vadmeste/minio","homepage":"http://minio.io","size":42220,"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":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"minio:master","ref":"master","sha":"b729a4e83c39b31628fe6213d69d041cbf74e854","user":{"login":"minio","id":695951,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NTk1MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/695951?v=4","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"repo":{"id":29261473,"node_id":"MDEwOlJlcG9zaXRvcnkyOTI2MTQ3Mw==","name":"minio","full_name":"minio/minio","private":false,"owner":{"login":"minio","id":695951,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NTk1MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/695951?v=4","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/minio/minio","description":"Minio is an open source object storage server compatible with Amazon S3 APIs","fork":false,"url":"https://api.github.com/repos/minio/minio","forks_url":"https://api.github.com/repos/minio/minio/forks","keys_url":"https://api.github.com/repos/minio/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minio/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minio/minio/teams","hooks_url":"https://api.github.com/repos/minio/minio/hooks","issue_events_url":"https://api.github.com/repos/minio/minio/issues/events{/number}","events_url":"https://api.github.com/repos/minio/minio/events","assignees_url":"https://api.github.com/repos/minio/minio/assignees{/user}","branches_url":"https://api.github.com/repos/minio/minio/branches{/branch}","tags_url":"https://api.github.com/repos/minio/minio/tags","blobs_url":"https://api.github.com/repos/minio/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minio/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minio/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/minio/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minio/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/minio/minio/languages","stargazers_url":"https://api.github.com/repos/minio/minio/stargazers","contributors_url":"https://api.github.com/repos/minio/minio/contributors","subscribers_url":"https://api.github.com/repos/minio/minio/subscribers","subscription_url":"https://api.github.com/repos/minio/minio/subscription","commits_url":"https://api.github.com/repos/minio/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/minio/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/minio/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/minio/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/minio/minio/contents/{+path}","compare_url":"https://api.github.com/repos/minio/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minio/minio/merges","archive_url":"https://api.github.com/repos/minio/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minio/minio/downloads","issues_url":"https://api.github.com/repos/minio/minio/issues{/number}","pulls_url":"https://api.github.com/repos/minio/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/minio/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/minio/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minio/minio/labels{/name}","releases_url":"https://api.github.com/repos/minio/minio/releases{/id}","deployments_url":"https://api.github.com/repos/minio/minio/deployments","created_at":"2015-01-14T19:23:58Z","updated_at":"2018-09-17T21:40:53Z","pushed_at":"2018-09-17T21:11:48Z","git_url":"git://github.com/minio/minio.git","ssh_url":"git@github.com:minio/minio.git","clone_url":"https://github.com/minio/minio.git","svn_url":"https://github.com/minio/minio","homepage":"https://minio.io/downloads.html#download-server","size":41867,"stargazers_count":12919,"watchers_count":12919,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1144,"mirror_url":null,"archived":false,"open_issues_count":142,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1144,"open_issues":142,"watchers":12919,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/6463"},"html":{"href":"https://github.com/minio/minio/pull/6463"},"issue":{"href":"https://api.github.com/repos/minio/minio/issues/6463"},"comments":{"href":"https://api.github.com/repos/minio/minio/issues/6463/comments"},"review_comments":{"href":"https://api.github.com/repos/minio/minio/pulls/6463/comments"},"review_comment":{"href":"https://api.github.com/repos/minio/minio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/minio/minio/pulls/6463/commits"},"statuses":{"href":"https://api.github.com/repos/minio/minio/statuses/77e2a1f8f4bed027b22977e230ff70ac4c4f311b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"donatello"}}