{"action":"created","comment":{"url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/comments/44897835","id":44897835,"diff_hunk":"@@ -90,46 +95,52 @@ func (nb *Nginxbeat) Setup(b *beat.Beat) error {\n func (nb *Nginxbeat) Run(b *beat.Beat) error {\n \tlogp.Debug(selector, \"Run nginxbeat\")\n \n-\tvar p parser.Parser\n-\tswitch nb.format {\n-\tcase \"stub\":\n-\t\tp = parser.NewStubParser()\n-\tcase \"plus\":\n-\t\tp = parser.NewPlusParser()\n-\t}\n-\n-\tticker := time.NewTicker(nb.period)\n-\tdefer ticker.Stop()\n-\n-\tfor {\n-\t\tselect {\n-\t\tcase <-nb.done:\n-\t\t\tgoto GotoFinish\n-\t\tcase <-ticker.C:\n-\t\t}\n-\n-\t\tstart := time.Now()\n-\n-\t\ts, err := p.Parse(*nb.url)\n-\t\tif err != nil {\n-\t\t\tlogp.Err(\"Fail to read Nginx status: %v\", err)\n-\t\t\tgoto GotoNext\n-\t\t}\n-\t\tnb.events.PublishEvent(common.MapStr{\n-\t\t\t\"@timestamp\": common.Time(time.Now()),\n-\t\t\t\"type\":       \"nginx\",\n-\t\t\t\"nginx\":      s,\n-\t\t})\n-\n-\tGotoNext:\n-\t\tend := time.Now()\n-\t\tduration := end.Sub(start)\n-\t\tif duration.Nanoseconds() > nb.period.Nanoseconds() {\n-\t\t\tlogp.Warn(\"Ignoring tick(s) due to processing taking longer than one period\")\n-\t\t}\n+\tfor _, u := range nb.urls {\n+\t\tgo func() {\n+\t\t\tvar p parser.Parser\n+\t\t\tswitch nb.format {\n+\t\t\tcase \"stub\":\n+\t\t\t\tp = parser.NewStubParser()\n+\t\t\tcase \"plus\":\n+\t\t\t\tp = parser.NewPlusParser()\n+\t\t\t}\n+\n+\t\t\tticker := time.NewTicker(nb.period)\n+\t\t\tdefer ticker.Stop()\n+\n+\t\t\tfor {\n+\t\t\t\tselect {\n+\t\t\t\tcase <-nb.done:\n+\t\t\t\t\tgoto GotoFinish","path":"nginxbeat.go","position":105,"original_position":105,"commit_id":"9a4bb9a5a72f28869fd75c6fb7a2021350d5f6ed","original_commit_id":"9a4bb9a5a72f28869fd75c6fb7a2021350d5f6ed","user":{"login":"mrkschan","id":118147,"avatar_url":"https://avatars.githubusercontent.com/u/118147?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkschan","html_url":"https://github.com/mrkschan","followers_url":"https://api.github.com/users/mrkschan/followers","following_url":"https://api.github.com/users/mrkschan/following{/other_user}","gists_url":"https://api.github.com/users/mrkschan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkschan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkschan/subscriptions","organizations_url":"https://api.github.com/users/mrkschan/orgs","repos_url":"https://api.github.com/users/mrkschan/repos","events_url":"https://api.github.com/users/mrkschan/events{/privacy}","received_events_url":"https://api.github.com/users/mrkschan/received_events","type":"User","site_admin":false},"body":"@ruflin so i will wait until there is one from Elastic. i will keep `goto` right now for the sake of consistency inside that func(). thx for the info :)","created_at":"2015-11-16T08:30:15Z","updated_at":"2015-11-16T08:30:15Z","html_url":"https://github.com/mrkschan/nginxbeat/pull/9#discussion_r44897835","pull_request_url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/comments/44897835"},"html":{"href":"https://github.com/mrkschan/nginxbeat/pull/9#discussion_r44897835"},"pull_request":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9","id":50725550,"html_url":"https://github.com/mrkschan/nginxbeat/pull/9","diff_url":"https://github.com/mrkschan/nginxbeat/pull/9.diff","patch_url":"https://github.com/mrkschan/nginxbeat/pull/9.patch","issue_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues/9","number":9,"state":"open","locked":false,"title":"Add support for watching multiple Nginx instances","user":{"login":"mrkschan","id":118147,"avatar_url":"https://avatars.githubusercontent.com/u/118147?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkschan","html_url":"https://github.com/mrkschan","followers_url":"https://api.github.com/users/mrkschan/followers","following_url":"https://api.github.com/users/mrkschan/following{/other_user}","gists_url":"https://api.github.com/users/mrkschan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkschan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkschan/subscriptions","organizations_url":"https://api.github.com/users/mrkschan/orgs","repos_url":"https://api.github.com/users/mrkschan/repos","events_url":"https://api.github.com/users/mrkschan/events{/privacy}","received_events_url":"https://api.github.com/users/mrkschan/received_events","type":"User","site_admin":false},"body":"Resolve #1.","created_at":"2015-11-14T15:30:05Z","updated_at":"2015-11-16T08:30:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60c7cacdaba3459922b7381f580d764045bed94f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9/commits","review_comments_url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9/comments","review_comment_url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues/9/comments","statuses_url":"https://api.github.com/repos/mrkschan/nginxbeat/statuses/9a4bb9a5a72f28869fd75c6fb7a2021350d5f6ed","head":{"label":"mrkschan:multi-nginx-support","ref":"multi-nginx-support","sha":"9a4bb9a5a72f28869fd75c6fb7a2021350d5f6ed","user":{"login":"mrkschan","id":118147,"avatar_url":"https://avatars.githubusercontent.com/u/118147?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkschan","html_url":"https://github.com/mrkschan","followers_url":"https://api.github.com/users/mrkschan/followers","following_url":"https://api.github.com/users/mrkschan/following{/other_user}","gists_url":"https://api.github.com/users/mrkschan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkschan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkschan/subscriptions","organizations_url":"https://api.github.com/users/mrkschan/orgs","repos_url":"https://api.github.com/users/mrkschan/repos","events_url":"https://api.github.com/users/mrkschan/events{/privacy}","received_events_url":"https://api.github.com/users/mrkschan/received_events","type":"User","site_admin":false},"repo":{"id":44615200,"name":"nginxbeat","full_name":"mrkschan/nginxbeat","owner":{"login":"mrkschan","id":118147,"avatar_url":"https://avatars.githubusercontent.com/u/118147?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkschan","html_url":"https://github.com/mrkschan","followers_url":"https://api.github.com/users/mrkschan/followers","following_url":"https://api.github.com/users/mrkschan/following{/other_user}","gists_url":"https://api.github.com/users/mrkschan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkschan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkschan/subscriptions","organizations_url":"https://api.github.com/users/mrkschan/orgs","repos_url":"https://api.github.com/users/mrkschan/repos","events_url":"https://api.github.com/users/mrkschan/events{/privacy}","received_events_url":"https://api.github.com/users/mrkschan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrkschan/nginxbeat","description":"Open Source Nginx Monitoring Agent","fork":false,"url":"https://api.github.com/repos/mrkschan/nginxbeat","forks_url":"https://api.github.com/repos/mrkschan/nginxbeat/forks","keys_url":"https://api.github.com/repos/mrkschan/nginxbeat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrkschan/nginxbeat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrkschan/nginxbeat/teams","hooks_url":"https://api.github.com/repos/mrkschan/nginxbeat/hooks","issue_events_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues/events{/number}","events_url":"https://api.github.com/repos/mrkschan/nginxbeat/events","assignees_url":"https://api.github.com/repos/mrkschan/nginxbeat/assignees{/user}","branches_url":"https://api.github.com/repos/mrkschan/nginxbeat/branches{/branch}","tags_url":"https://api.github.com/repos/mrkschan/nginxbeat/tags","blobs_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrkschan/nginxbeat/statuses/{sha}","languages_url":"https://api.github.com/repos/mrkschan/nginxbeat/languages","stargazers_url":"https://api.github.com/repos/mrkschan/nginxbeat/stargazers","contributors_url":"https://api.github.com/repos/mrkschan/nginxbeat/contributors","subscribers_url":"https://api.github.com/repos/mrkschan/nginxbeat/subscribers","subscription_url":"https://api.github.com/repos/mrkschan/nginxbeat/subscription","commits_url":"https://api.github.com/repos/mrkschan/nginxbeat/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrkschan/nginxbeat/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrkschan/nginxbeat/contents/{+path}","compare_url":"https://api.github.com/repos/mrkschan/nginxbeat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrkschan/nginxbeat/merges","archive_url":"https://api.github.com/repos/mrkschan/nginxbeat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrkschan/nginxbeat/downloads","issues_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues{/number}","pulls_url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls{/number}","milestones_url":"https://api.github.com/repos/mrkschan/nginxbeat/milestones{/number}","notifications_url":"https://api.github.com/repos/mrkschan/nginxbeat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrkschan/nginxbeat/labels{/name}","releases_url":"https://api.github.com/repos/mrkschan/nginxbeat/releases{/id}","created_at":"2015-10-20T15:18:37Z","updated_at":"2015-11-15T00:52:29Z","pushed_at":"2015-11-14T15:30:05Z","git_url":"git://github.com/mrkschan/nginxbeat.git","ssh_url":"git@github.com:mrkschan/nginxbeat.git","clone_url":"https://github.com/mrkschan/nginxbeat.git","svn_url":"https://github.com/mrkschan/nginxbeat","homepage":null,"size":284,"stargazers_count":8,"watchers_count":8,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":8,"default_branch":"master"}},"base":{"label":"mrkschan:master","ref":"master","sha":"1c128b49ed0a5f7560a28fb868a968f1b0bc23d2","user":{"login":"mrkschan","id":118147,"avatar_url":"https://avatars.githubusercontent.com/u/118147?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkschan","html_url":"https://github.com/mrkschan","followers_url":"https://api.github.com/users/mrkschan/followers","following_url":"https://api.github.com/users/mrkschan/following{/other_user}","gists_url":"https://api.github.com/users/mrkschan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkschan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkschan/subscriptions","organizations_url":"https://api.github.com/users/mrkschan/orgs","repos_url":"https://api.github.com/users/mrkschan/repos","events_url":"https://api.github.com/users/mrkschan/events{/privacy}","received_events_url":"https://api.github.com/users/mrkschan/received_events","type":"User","site_admin":false},"repo":{"id":44615200,"name":"nginxbeat","full_name":"mrkschan/nginxbeat","owner":{"login":"mrkschan","id":118147,"avatar_url":"https://avatars.githubusercontent.com/u/118147?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkschan","html_url":"https://github.com/mrkschan","followers_url":"https://api.github.com/users/mrkschan/followers","following_url":"https://api.github.com/users/mrkschan/following{/other_user}","gists_url":"https://api.github.com/users/mrkschan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkschan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkschan/subscriptions","organizations_url":"https://api.github.com/users/mrkschan/orgs","repos_url":"https://api.github.com/users/mrkschan/repos","events_url":"https://api.github.com/users/mrkschan/events{/privacy}","received_events_url":"https://api.github.com/users/mrkschan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrkschan/nginxbeat","description":"Open Source Nginx Monitoring Agent","fork":false,"url":"https://api.github.com/repos/mrkschan/nginxbeat","forks_url":"https://api.github.com/repos/mrkschan/nginxbeat/forks","keys_url":"https://api.github.com/repos/mrkschan/nginxbeat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrkschan/nginxbeat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrkschan/nginxbeat/teams","hooks_url":"https://api.github.com/repos/mrkschan/nginxbeat/hooks","issue_events_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues/events{/number}","events_url":"https://api.github.com/repos/mrkschan/nginxbeat/events","assignees_url":"https://api.github.com/repos/mrkschan/nginxbeat/assignees{/user}","branches_url":"https://api.github.com/repos/mrkschan/nginxbeat/branches{/branch}","tags_url":"https://api.github.com/repos/mrkschan/nginxbeat/tags","blobs_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrkschan/nginxbeat/statuses/{sha}","languages_url":"https://api.github.com/repos/mrkschan/nginxbeat/languages","stargazers_url":"https://api.github.com/repos/mrkschan/nginxbeat/stargazers","contributors_url":"https://api.github.com/repos/mrkschan/nginxbeat/contributors","subscribers_url":"https://api.github.com/repos/mrkschan/nginxbeat/subscribers","subscription_url":"https://api.github.com/repos/mrkschan/nginxbeat/subscription","commits_url":"https://api.github.com/repos/mrkschan/nginxbeat/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrkschan/nginxbeat/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrkschan/nginxbeat/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrkschan/nginxbeat/contents/{+path}","compare_url":"https://api.github.com/repos/mrkschan/nginxbeat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrkschan/nginxbeat/merges","archive_url":"https://api.github.com/repos/mrkschan/nginxbeat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrkschan/nginxbeat/downloads","issues_url":"https://api.github.com/repos/mrkschan/nginxbeat/issues{/number}","pulls_url":"https://api.github.com/repos/mrkschan/nginxbeat/pulls{/number}","milestones_url":"https://api.github.com/repos/mrkschan/nginxbeat/milestones{/number}","notifications_url":"https://api.github.com/repos/mrkschan/nginxbeat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrkschan/nginxbeat/labels{/name}","releases_url":"https://api.github.com/repos/mrkschan/nginxbeat/releases{/id}","created_at":"2015-10-20T15:18:37Z","updated_at":"2015-11-15T00:52:29Z","pushed_at":"2015-11-14T15:30:05Z","git_url":"git://github.com/mrkschan/nginxbeat.git","ssh_url":"git@github.com:mrkschan/nginxbeat.git","clone_url":"https://github.com/mrkschan/nginxbeat.git","svn_url":"https://github.com/mrkschan/nginxbeat","homepage":null,"size":284,"stargazers_count":8,"watchers_count":8,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9"},"html":{"href":"https://github.com/mrkschan/nginxbeat/pull/9"},"issue":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/issues/9"},"comments":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/mrkschan/nginxbeat/statuses/9a4bb9a5a72f28869fd75c6fb7a2021350d5f6ed"}}}}