{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/beats/pulls/comments/90214203","pull_request_review_id":10734604,"id":90214203,"diff_hunk":"@@ -19,75 +21,196 @@ func init() {\n // MetricSet type defines all fields of the partition MetricSet\n type MetricSet struct {\n \tmb.BaseMetricSet\n-\tclient sarama.Client\n+\n+\tbroker *sarama.Broker\n+\tcfg    *sarama.Config\n+\tid     int32\n }\n \n-// New creates a new instance of the partition MetricSet\n+var noID int32 = -1\n+\n+var errFailQueryOffset = errors.New(\"Failed to query offset for\")\n+\n+// New create a new instance of the partition MetricSet\n func New(base mb.BaseMetricSet) (mb.MetricSet, error) {\n-\tlogp.Warn(\"EXPERIMENTAL: The %v %v metricset is experimental\", base.Module().Name(), base.Name())\n+\tconfig := struct{}{}\n+\tif err := base.Module().UnpackConfig(&config); err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tcfg := sarama.NewConfig()\n+\tcfg.Net.DialTimeout = base.Module().Config().Timeout\n+\tcfg.Net.ReadTimeout = base.Module().Config().Timeout\n+\tcfg.ClientID = \"metricbeat\"\n+\n+\tbroker := sarama.NewBroker(base.Host())\n+\treturn &MetricSet{\n+\t\tBaseMetricSet: base,\n+\t\tbroker:        broker,\n+\t\tcfg:           cfg,\n+\t\tid:            noID,\n+\t}, nil\n+}\n+\n+func (m *MetricSet) connect() (*sarama.Broker, error) {\n+\tb := m.broker\n+\tif err := b.Open(m.cfg); err != nil {\n+\t\treturn nil, err\n+\t}","path":"metricbeat/module/kafka/partition/partition.go","position":54,"original_position":54,"commit_id":"9559407c33edc9d5795ebf23c4826822b31de599","original_commit_id":"03cb921073e66ca24c94f84601535c9ff69ccebf","user":{"login":"ruflin","id":244900,"avatar_url":"https://avatars.githubusercontent.com/u/244900?v=3","gravatar_id":"","url":"https://api.github.com/users/ruflin","html_url":"https://github.com/ruflin","followers_url":"https://api.github.com/users/ruflin/followers","following_url":"https://api.github.com/users/ruflin/following{/other_user}","gists_url":"https://api.github.com/users/ruflin/gists{/gist_id}","starred_url":"https://api.github.com/users/ruflin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruflin/subscriptions","organizations_url":"https://api.github.com/users/ruflin/orgs","repos_url":"https://api.github.com/users/ruflin/repos","events_url":"https://api.github.com/users/ruflin/events{/privacy}","received_events_url":"https://api.github.com/users/ruflin/received_events","type":"User","site_admin":false},"body":"Not sure. But my thinking here is similar to my comment below. It is ok if it fails from time to time, as we call connect() for each Fetch. I prefer that it fails instead of waiting for a long time.","created_at":"2016-11-30T11:25:23Z","updated_at":"2016-11-30T11:25:47Z","html_url":"https://github.com/elastic/beats/pull/3029#discussion_r90214203","pull_request_url":"https://api.github.com/repos/elastic/beats/pulls/3029","_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments/90214203"},"html":{"href":"https://github.com/elastic/beats/pull/3029#discussion_r90214203"},"pull_request":{"href":"https://api.github.com/repos/elastic/beats/pulls/3029"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/beats/pulls/3029","id":94188101,"html_url":"https://github.com/elastic/beats/pull/3029","diff_url":"https://github.com/elastic/beats/pull/3029.diff","patch_url":"https://github.com/elastic/beats/pull/3029.patch","issue_url":"https://api.github.com/repos/elastic/beats/issues/3029","number":3029,"state":"open","locked":false,"title":"Switch partition metricset from client to broker","user":{"login":"ruflin","id":244900,"avatar_url":"https://avatars.githubusercontent.com/u/244900?v=3","gravatar_id":"","url":"https://api.github.com/users/ruflin","html_url":"https://github.com/ruflin","followers_url":"https://api.github.com/users/ruflin/followers","following_url":"https://api.github.com/users/ruflin/following{/other_user}","gists_url":"https://api.github.com/users/ruflin/gists{/gist_id}","starred_url":"https://api.github.com/users/ruflin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruflin/subscriptions","organizations_url":"https://api.github.com/users/ruflin/orgs","repos_url":"https://api.github.com/users/ruflin/repos","events_url":"https://api.github.com/users/ruflin/events{/privacy}","received_events_url":"https://api.github.com/users/ruflin/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-17T15:23:59Z","updated_at":"2016-11-30T11:25:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0dc926f8c17ddeb0b14dd86cd6cccc68b39e0065","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/beats/pulls/3029/commits","review_comments_url":"https://api.github.com/repos/elastic/beats/pulls/3029/comments","review_comment_url":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/beats/issues/3029/comments","statuses_url":"https://api.github.com/repos/elastic/beats/statuses/9559407c33edc9d5795ebf23c4826822b31de599","head":{"label":"ruflin:kafka-partition-refactoring","ref":"kafka-partition-refactoring","sha":"9559407c33edc9d5795ebf23c4826822b31de599","user":{"login":"ruflin","id":244900,"avatar_url":"https://avatars.githubusercontent.com/u/244900?v=3","gravatar_id":"","url":"https://api.github.com/users/ruflin","html_url":"https://github.com/ruflin","followers_url":"https://api.github.com/users/ruflin/followers","following_url":"https://api.github.com/users/ruflin/following{/other_user}","gists_url":"https://api.github.com/users/ruflin/gists{/gist_id}","starred_url":"https://api.github.com/users/ruflin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruflin/subscriptions","organizations_url":"https://api.github.com/users/ruflin/orgs","repos_url":"https://api.github.com/users/ruflin/repos","events_url":"https://api.github.com/users/ruflin/events{/privacy}","received_events_url":"https://api.github.com/users/ruflin/received_events","type":"User","site_admin":false},"repo":{"id":40544282,"name":"beats","full_name":"ruflin/beats","owner":{"login":"ruflin","id":244900,"avatar_url":"https://avatars.githubusercontent.com/u/244900?v=3","gravatar_id":"","url":"https://api.github.com/users/ruflin","html_url":"https://github.com/ruflin","followers_url":"https://api.github.com/users/ruflin/followers","following_url":"https://api.github.com/users/ruflin/following{/other_user}","gists_url":"https://api.github.com/users/ruflin/gists{/gist_id}","starred_url":"https://api.github.com/users/ruflin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruflin/subscriptions","organizations_url":"https://api.github.com/users/ruflin/orgs","repos_url":"https://api.github.com/users/ruflin/repos","events_url":"https://api.github.com/users/ruflin/events{/privacy}","received_events_url":"https://api.github.com/users/ruflin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ruflin/beats","description":"Beats - Lightweight shippers for Elasticsearch & Logstash","fork":true,"url":"https://api.github.com/repos/ruflin/beats","forks_url":"https://api.github.com/repos/ruflin/beats/forks","keys_url":"https://api.github.com/repos/ruflin/beats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruflin/beats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruflin/beats/teams","hooks_url":"https://api.github.com/repos/ruflin/beats/hooks","issue_events_url":"https://api.github.com/repos/ruflin/beats/issues/events{/number}","events_url":"https://api.github.com/repos/ruflin/beats/events","assignees_url":"https://api.github.com/repos/ruflin/beats/assignees{/user}","branches_url":"https://api.github.com/repos/ruflin/beats/branches{/branch}","tags_url":"https://api.github.com/repos/ruflin/beats/tags","blobs_url":"https://api.github.com/repos/ruflin/beats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruflin/beats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruflin/beats/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruflin/beats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruflin/beats/statuses/{sha}","languages_url":"https://api.github.com/repos/ruflin/beats/languages","stargazers_url":"https://api.github.com/repos/ruflin/beats/stargazers","contributors_url":"https://api.github.com/repos/ruflin/beats/contributors","subscribers_url":"https://api.github.com/repos/ruflin/beats/subscribers","subscription_url":"https://api.github.com/repos/ruflin/beats/subscription","commits_url":"https://api.github.com/repos/ruflin/beats/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruflin/beats/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruflin/beats/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruflin/beats/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruflin/beats/contents/{+path}","compare_url":"https://api.github.com/repos/ruflin/beats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruflin/beats/merges","archive_url":"https://api.github.com/repos/ruflin/beats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruflin/beats/downloads","issues_url":"https://api.github.com/repos/ruflin/beats/issues{/number}","pulls_url":"https://api.github.com/repos/ruflin/beats/pulls{/number}","milestones_url":"https://api.github.com/repos/ruflin/beats/milestones{/number}","notifications_url":"https://api.github.com/repos/ruflin/beats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruflin/beats/labels{/name}","releases_url":"https://api.github.com/repos/ruflin/beats/releases{/id}","deployments_url":"https://api.github.com/repos/ruflin/beats/deployments","created_at":"2015-08-11T13:49:02Z","updated_at":"2016-10-24T12:55:12Z","pushed_at":"2016-11-30T11:25:45Z","git_url":"git://github.com/ruflin/beats.git","ssh_url":"git@github.com:ruflin/beats.git","clone_url":"https://github.com/ruflin/beats.git","svn_url":"https://github.com/ruflin/beats","homepage":"https://www.elastic.co/products/beats","size":49334,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"7d3adfeaff49602e1150059f830701aa17de20da","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":16554739,"name":"beats","full_name":"elastic/beats","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/beats","description":":tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash ","fork":false,"url":"https://api.github.com/repos/elastic/beats","forks_url":"https://api.github.com/repos/elastic/beats/forks","keys_url":"https://api.github.com/repos/elastic/beats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/beats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/beats/teams","hooks_url":"https://api.github.com/repos/elastic/beats/hooks","issue_events_url":"https://api.github.com/repos/elastic/beats/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/beats/events","assignees_url":"https://api.github.com/repos/elastic/beats/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/beats/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/beats/tags","blobs_url":"https://api.github.com/repos/elastic/beats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/beats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/beats/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/beats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/beats/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/beats/languages","stargazers_url":"https://api.github.com/repos/elastic/beats/stargazers","contributors_url":"https://api.github.com/repos/elastic/beats/contributors","subscribers_url":"https://api.github.com/repos/elastic/beats/subscribers","subscription_url":"https://api.github.com/repos/elastic/beats/subscription","commits_url":"https://api.github.com/repos/elastic/beats/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/beats/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/beats/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/beats/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/beats/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/beats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/beats/merges","archive_url":"https://api.github.com/repos/elastic/beats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/beats/downloads","issues_url":"https://api.github.com/repos/elastic/beats/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/beats/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/beats/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/beats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/beats/labels{/name}","releases_url":"https://api.github.com/repos/elastic/beats/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/beats/deployments","created_at":"2014-02-05T19:01:02Z","updated_at":"2016-11-30T02:24:53Z","pushed_at":"2016-11-30T11:25:45Z","git_url":"git://github.com/elastic/beats.git","ssh_url":"git@github.com:elastic/beats.git","clone_url":"https://github.com/elastic/beats.git","svn_url":"https://github.com/elastic/beats","homepage":"https://www.elastic.co/products/beats","size":51085,"stargazers_count":3396,"watchers_count":3396,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":655,"mirror_url":null,"open_issues_count":295,"forks":655,"open_issues":295,"watchers":3396,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/3029"},"html":{"href":"https://github.com/elastic/beats/pull/3029"},"issue":{"href":"https://api.github.com/repos/elastic/beats/issues/3029"},"comments":{"href":"https://api.github.com/repos/elastic/beats/issues/3029/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/beats/pulls/3029/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/beats/pulls/3029/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/beats/statuses/9559407c33edc9d5795ebf23c4826822b31de599"}}}}
{"actor":{"display_login":"ruflin"}}