GitHub PullRequestReviewCommentEvent at 2014-11-20 20:21:33
Repository: scollector
Actor: mjibson
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/bosun-monitor/scollector/pulls/comments/20674452","id":20674452,"diff_hunk":"@@ -23,36 +23,36 @@ const (\n )\n \n func c_diskspace_windows() (opentsdb.MultiDataPoint, error) {\n-\tconst megabyte = 1048576\n-\tvar dst []Win32_PerfFormattedData_PerfDisk_LogicalDisk\n-\tvar q = wmi.CreateQuery(&dst, `WHERE Name <> '_Total'`)\n+\tvar dst []Win32_LogicalDisk\n+\tvar q = wmi.CreateQuery(&dst, \"WHERE DriveType = 3\")\n \terr := queryWmi(q, &dst)\n \tif err != nil {\n \t\treturn nil, err\n \t}\n \tvar md opentsdb.MultiDataPoint\n \tfor _, v := range dst {\n-\t\tAdd(&md, \"win.disk.fs.space_free\", v.FreeMegabytes*megabyte, opentsdb.TagSet{\"partition\": v.Name}, metadata.Gauge, metadata.Bytes, \"\")\n-\t\tAdd(&md, osDiskFree, v.FreeMegabytes*megabyte, opentsdb.TagSet{\"disk\": v.Name}, metadata.Gauge, metadata.Bytes, \"\")\n-\t\tif v.PercentFreeSpace != 0 {\n-\t\t\tspace_total := v.FreeMegabytes * megabyte * 100 / v.PercentFreeSpace\n-\t\t\tspace_used := space_total - v.FreeMegabytes*megabyte\n-\t\t\tAdd(&md, \"win.disk.fs.space_total\", space_total, opentsdb.TagSet{\"partition\": v.Name}, metadata.Gauge, metadata.Bytes, \"\")\n-\t\t\tAdd(&md, \"win.disk.fs.space_used\", space_used, opentsdb.TagSet{\"partition\": v.Name}, metadata.Gauge, metadata.Bytes, \"\")\n-\t\t\tAdd(&md, osDiskTotal, space_total, opentsdb.TagSet{\"disk\": v.Name}, metadata.Gauge, metadata.Bytes, \"\")\n-\t\t\tAdd(&md, osDiskUsed, space_used, opentsdb.TagSet{\"disk\": v.Name}, metadata.Gauge, metadata.Bytes, \"\")\n+\t\ttags := opentsdb.TagSet{\"disk\": v.Name}\n+\t\tspace_used := v.Size - v.FreeSpace\n+\t\tvar percent_free float32 = 0\n+\t\tif v.Size != 0 {\n+\t\t\tpercent_free = float32(v.FreeSpace) / float32(v.Size) * 100","path":"collectors/disk_windows.go","position":28,"original_position":28,"commit_id":"a0edd45042ea304ef881b723d11745553267438b","original_commit_id":"a0edd45042ea304ef881b723d11745553267438b","user":{"login":"mjibson","id":41181,"avatar_url":"https://avatars.githubusercontent.com/u/41181?v=3","gravatar_id":"","url":"https://api.github.com/users/mjibson","html_url":"https://github.com/mjibson","followers_url":"https://api.github.com/users/mjibson/followers","following_url":"https://api.github.com/users/mjibson/following{/other_user}","gists_url":"https://api.github.com/users/mjibson/gists{/gist_id}","starred_url":"https://api.github.com/users/mjibson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjibson/subscriptions","organizations_url":"https://api.github.com/users/mjibson/orgs","repos_url":"https://api.github.com/users/mjibson/repos","events_url":"https://api.github.com/users/mjibson/events{/privacy}","received_events_url":"https://api.github.com/users/mjibson/received_events","type":"User","site_admin":false},"body":"Remove the `var percent_free` above and just do `percent_free = float64(...)` here. Note the change to float64, just because it's more common. Then move anything that uses percent_free into this if block.","created_at":"2014-11-20T20:21:33Z","updated_at":"2014-11-20T20:21:33Z","html_url":"https://github.com/bosun-monitor/scollector/pull/147#discussion_r20674452","pull_request_url":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147","_links":{"self":{"href":"https://api.github.com/repos/bosun-monitor/scollector/pulls/comments/20674452"},"html":{"href":"https://github.com/bosun-monitor/scollector/pull/147#discussion_r20674452"},"pull_request":{"href":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147"}}},"pull_request":{"url":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147","id":24794349,"html_url":"https://github.com/bosun-monitor/scollector/pull/147","diff_url":"https://github.com/bosun-monitor/scollector/pull/147.diff","patch_url":"https://github.com/bosun-monitor/scollector/pull/147.patch","issue_url":"https://api.github.com/repos/bosun-monitor/scollector/issues/147","number":147,"state":"open","locked":false,"title":"Fixes #146 win.disk.fs.* metrics using Win32_LogicalDisk","user":{"login":"gbrayut","id":304401,"avatar_url":"https://avatars.githubusercontent.com/u/304401?v=3","gravatar_id":"","url":"https://api.github.com/users/gbrayut","html_url":"https://github.com/gbrayut","followers_url":"https://api.github.com/users/gbrayut/followers","following_url":"https://api.github.com/users/gbrayut/following{/other_user}","gists_url":"https://api.github.com/users/gbrayut/gists{/gist_id}","starred_url":"https://api.github.com/users/gbrayut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbrayut/subscriptions","organizations_url":"https://api.github.com/users/gbrayut/orgs","repos_url":"https://api.github.com/users/gbrayut/repos","events_url":"https://api.github.com/users/gbrayut/events{/privacy}","received_events_url":"https://api.github.com/users/gbrayut/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-11-20T20:17:43Z","updated_at":"2014-11-20T20:21:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62f229bfa1b2ca41c73c4a2da09e6b16324c746b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147/commits","review_comments_url":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147/comments","review_comment_url":"https://api.github.com/repos/bosun-monitor/scollector/pulls/comments/{number}","comments_url":"https://api.github.com/repos/bosun-monitor/scollector/issues/147/comments","statuses_url":"https://api.github.com/repos/bosun-monitor/scollector/statuses/a0edd45042ea304ef881b723d11745553267438b","head":{"label":"bosun-monitor:win_disk","ref":"win_disk","sha":"a0edd45042ea304ef881b723d11745553267438b","user":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"repo":{"id":14876966,"name":"scollector","full_name":"bosun-monitor/scollector","owner":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bosun-monitor/scollector","description":"OpenTSDB's tcollector for the v2 HTTP API","fork":false,"url":"https://api.github.com/repos/bosun-monitor/scollector","forks_url":"https://api.github.com/repos/bosun-monitor/scollector/forks","keys_url":"https://api.github.com/repos/bosun-monitor/scollector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bosun-monitor/scollector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bosun-monitor/scollector/teams","hooks_url":"https://api.github.com/repos/bosun-monitor/scollector/hooks","issue_events_url":"https://api.github.com/repos/bosun-monitor/scollector/issues/events{/number}","events_url":"https://api.github.com/repos/bosun-monitor/scollector/events","assignees_url":"https://api.github.com/repos/bosun-monitor/scollector/assignees{/user}","branches_url":"https://api.github.com/repos/bosun-monitor/scollector/branches{/branch}","tags_url":"https://api.github.com/repos/bosun-monitor/scollector/tags","blobs_url":"https://api.github.com/repos/bosun-monitor/scollector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bosun-monitor/scollector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bosun-monitor/scollector/git/refs{/sha}","trees_url":"https://api.github.com/repos/bosun-monitor/scollector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bosun-monitor/scollector/statuses/{sha}","languages_url":"https://api.github.com/repos/bosun-monitor/scollector/languages","stargazers_url":"https://api.github.com/repos/bosun-monitor/scollector/stargazers","contributors_url":"https://api.github.com/repos/bosun-monitor/scollector/contributors","subscribers_url":"https://api.github.com/repos/bosun-monitor/scollector/subscribers","subscription_url":"https://api.github.com/repos/bosun-monitor/scollector/subscription","commits_url":"https://api.github.com/repos/bosun-monitor/scollector/commits{/sha}","git_commits_url":"https://api.github.com/repos/bosun-monitor/scollector/git/commits{/sha}","comments_url":"https://api.github.com/repos/bosun-monitor/scollector/comments{/number}","issue_comment_url":"https://api.github.com/repos/bosun-monitor/scollector/issues/comments/{number}","contents_url":"https://api.github.com/repos/bosun-monitor/scollector/contents/{+path}","compare_url":"https://api.github.com/repos/bosun-monitor/scollector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bosun-monitor/scollector/merges","archive_url":"https://api.github.com/repos/bosun-monitor/scollector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bosun-monitor/scollector/downloads","issues_url":"https://api.github.com/repos/bosun-monitor/scollector/issues{/number}","pulls_url":"https://api.github.com/repos/bosun-monitor/scollector/pulls{/number}","milestones_url":"https://api.github.com/repos/bosun-monitor/scollector/milestones{/number}","notifications_url":"https://api.github.com/repos/bosun-monitor/scollector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bosun-monitor/scollector/labels{/name}","releases_url":"https://api.github.com/repos/bosun-monitor/scollector/releases{/id}","created_at":"2013-12-02T22:32:52Z","updated_at":"2014-11-20T11:01:15Z","pushed_at":"2014-11-20T20:17:05Z","git_url":"git://github.com/bosun-monitor/scollector.git","ssh_url":"git@github.com:bosun-monitor/scollector.git","clone_url":"https://github.com/bosun-monitor/scollector.git","svn_url":"https://github.com/bosun-monitor/scollector","homepage":"http://bosun.org/scollector","size":7297,"stargazers_count":67,"watchers_count":67,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":29,"forks":15,"open_issues":29,"watchers":67,"default_branch":"master"}},"base":{"label":"bosun-monitor:master","ref":"master","sha":"803e9dd55e8916b20348c975c81b4517b321b5a6","user":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"repo":{"id":14876966,"name":"scollector","full_name":"bosun-monitor/scollector","owner":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bosun-monitor/scollector","description":"OpenTSDB's tcollector for the v2 HTTP API","fork":false,"url":"https://api.github.com/repos/bosun-monitor/scollector","forks_url":"https://api.github.com/repos/bosun-monitor/scollector/forks","keys_url":"https://api.github.com/repos/bosun-monitor/scollector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bosun-monitor/scollector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bosun-monitor/scollector/teams","hooks_url":"https://api.github.com/repos/bosun-monitor/scollector/hooks","issue_events_url":"https://api.github.com/repos/bosun-monitor/scollector/issues/events{/number}","events_url":"https://api.github.com/repos/bosun-monitor/scollector/events","assignees_url":"https://api.github.com/repos/bosun-monitor/scollector/assignees{/user}","branches_url":"https://api.github.com/repos/bosun-monitor/scollector/branches{/branch}","tags_url":"https://api.github.com/repos/bosun-monitor/scollector/tags","blobs_url":"https://api.github.com/repos/bosun-monitor/scollector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bosun-monitor/scollector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bosun-monitor/scollector/git/refs{/sha}","trees_url":"https://api.github.com/repos/bosun-monitor/scollector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bosun-monitor/scollector/statuses/{sha}","languages_url":"https://api.github.com/repos/bosun-monitor/scollector/languages","stargazers_url":"https://api.github.com/repos/bosun-monitor/scollector/stargazers","contributors_url":"https://api.github.com/repos/bosun-monitor/scollector/contributors","subscribers_url":"https://api.github.com/repos/bosun-monitor/scollector/subscribers","subscription_url":"https://api.github.com/repos/bosun-monitor/scollector/subscription","commits_url":"https://api.github.com/repos/bosun-monitor/scollector/commits{/sha}","git_commits_url":"https://api.github.com/repos/bosun-monitor/scollector/git/commits{/sha}","comments_url":"https://api.github.com/repos/bosun-monitor/scollector/comments{/number}","issue_comment_url":"https://api.github.com/repos/bosun-monitor/scollector/issues/comments/{number}","contents_url":"https://api.github.com/repos/bosun-monitor/scollector/contents/{+path}","compare_url":"https://api.github.com/repos/bosun-monitor/scollector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bosun-monitor/scollector/merges","archive_url":"https://api.github.com/repos/bosun-monitor/scollector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bosun-monitor/scollector/downloads","issues_url":"https://api.github.com/repos/bosun-monitor/scollector/issues{/number}","pulls_url":"https://api.github.com/repos/bosun-monitor/scollector/pulls{/number}","milestones_url":"https://api.github.com/repos/bosun-monitor/scollector/milestones{/number}","notifications_url":"https://api.github.com/repos/bosun-monitor/scollector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bosun-monitor/scollector/labels{/name}","releases_url":"https://api.github.com/repos/bosun-monitor/scollector/releases{/id}","created_at":"2013-12-02T22:32:52Z","updated_at":"2014-11-20T11:01:15Z","pushed_at":"2014-11-20T20:17:05Z","git_url":"git://github.com/bosun-monitor/scollector.git","ssh_url":"git@github.com:bosun-monitor/scollector.git","clone_url":"https://github.com/bosun-monitor/scollector.git","svn_url":"https://github.com/bosun-monitor/scollector","homepage":"http://bosun.org/scollector","size":7297,"stargazers_count":67,"watchers_count":67,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":29,"forks":15,"open_issues":29,"watchers":67,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147"},"html":{"href":"https://github.com/bosun-monitor/scollector/pull/147"},"issue":{"href":"https://api.github.com/repos/bosun-monitor/scollector/issues/147"},"comments":{"href":"https://api.github.com/repos/bosun-monitor/scollector/issues/147/comments"},"review_comments":{"href":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147/comments"},"review_comment":{"href":"https://api.github.com/repos/bosun-monitor/scollector/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/bosun-monitor/scollector/pulls/147/commits"},"statuses":{"href":"https://api.github.com/repos/bosun-monitor/scollector/statuses/a0edd45042ea304ef881b723d11745553267438b"}}}}