{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/beats/pulls/comments/200484990","pull_request_review_id":134812338,"id":200484990,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDQ4NDk5MA==","diff_hunk":"@@ -0,0 +1,78 @@\n+// Licensed to Elasticsearch B.V. under one or more contributor\n+// license agreements. See the NOTICE file distributed with\n+// this work for additional information regarding copyright\n+// ownership. Elasticsearch B.V. licenses this file to you under\n+// the Apache License, Version 2.0 (the \"License\"); you may\n+// 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,\n+// software distributed under the License is distributed on an\n+// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+// KIND, either express or implied.  See the License for the\n+// specific language governing permissions and limitations\n+// under the License.\n+\n+package ml_job\n+\n+import (\n+\t\"github.com/elastic/beats/libbeat/common/cfgwarn\"\n+\t\"github.com/elastic/beats/libbeat/logp\"\n+\t\"github.com/elastic/beats/metricbeat/mb\"\n+\t\"github.com/elastic/beats/metricbeat/module/elasticsearch\"\n+)\n+\n+func init() {\n+\tmb.Registry.MustAddMetricSet(\"elasticsearch\", \"ml_job\", New,\n+\t\tmb.WithHostParser(elasticsearch.HostParser),\n+\t\tmb.WithNamespace(\"elasticsearch.ml.job\"),\n+\t)\n+}\n+\n+const (\n+\tjobPath = \"/_xpack/ml/anomaly_detectors/_all/_stats\"\n+)\n+\n+// MetricSet for ml job\n+type MetricSet struct {\n+\t*elasticsearch.MetricSet\n+}\n+\n+// New creates a new instance of the MetricSet. New is responsible for unpacking\n+// any MetricSet specific configuration options if there are any.\n+func New(base mb.BaseMetricSet) (mb.MetricSet, error) {\n+\tcfgwarn.Experimental(\"The elasticsearch ml_job metricset is experimental.\")\n+\n+\t// Get the stats from the local node\n+\tms, err := elasticsearch.NewMetricSet(base, jobPath)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\treturn &MetricSet{MetricSet: ms}, nil\n+}\n+\n+// Fetch methods implements the data gathering and data conversion to the right format\n+func (m *MetricSet) Fetch(r mb.ReporterV2) {\n+\n+\tisMaster, err := elasticsearch.IsMaster(m.HTTP, m.HostData().SanitizedURI+jobPath)\n+\tif err != nil {\n+\t\tr.Error(err)\n+\t\treturn\n+\t}\n+\n+\t// Not master, no event sent\n+\tif !isMaster {\n+\t\tlogp.Debug(\"elasticsearch\", \"Trying to fetch index summary stats from a none master node.\")\n+\t\treturn\n+\t}\n+\n+\tcontent, err := m.HTTP.FetchContent()\n+\tif err != nil {\n+\t\tr.Error(err)","path":"metricbeat/module/elasticsearch/ml_job/ml.go","position":73,"original_position":73,"commit_id":"a469a130b7e8bff34f60ce081564feebd3f80dc9","original_commit_id":"a469a130b7e8bff34f60ce081564feebd3f80dc9","user":{"login":"ycombinator","id":51061,"node_id":"MDQ6VXNlcjUxMDYx","avatar_url":"https://avatars2.githubusercontent.com/u/51061?v=4","gravatar_id":"","url":"https://api.github.com/users/ycombinator","html_url":"https://github.com/ycombinator","followers_url":"https://api.github.com/users/ycombinator/followers","following_url":"https://api.github.com/users/ycombinator/following{/other_user}","gists_url":"https://api.github.com/users/ycombinator/gists{/gist_id}","starred_url":"https://api.github.com/users/ycombinator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ycombinator/subscriptions","organizations_url":"https://api.github.com/users/ycombinator/orgs","repos_url":"https://api.github.com/users/ycombinator/repos","events_url":"https://api.github.com/users/ycombinator/events{/privacy}","received_events_url":"https://api.github.com/users/ycombinator/received_events","type":"User","site_admin":false},"body":"Alternatively, could we somehow make use of the `xpack` config setting here?","created_at":"2018-07-05T20:46:30Z","updated_at":"2018-07-05T20:46:30Z","html_url":"https://github.com/elastic/beats/pull/7196#discussion_r200484990","pull_request_url":"https://api.github.com/repos/elastic/beats/pulls/7196","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments/200484990"},"html":{"href":"https://github.com/elastic/beats/pull/7196#discussion_r200484990"},"pull_request":{"href":"https://api.github.com/repos/elastic/beats/pulls/7196"}},"in_reply_to_id":200419888},"pull_request":{"url":"https://api.github.com/repos/elastic/beats/pulls/7196","id":191133948,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxMTMzOTQ4","html_url":"https://github.com/elastic/beats/pull/7196","diff_url":"https://github.com/elastic/beats/pull/7196.diff","patch_url":"https://github.com/elastic/beats/pull/7196.patch","issue_url":"https://api.github.com/repos/elastic/beats/issues/7196","number":7196,"state":"open","locked":false,"title":"Add ml_job metricset to Elasticsearch module","user":{"login":"ruflin","id":244900,"node_id":"MDQ6VXNlcjI0NDkwMA==","avatar_url":"https://avatars3.githubusercontent.com/u/244900?v=4","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":"This adds a basic ml_job metricset to the Elasticsearch module.\r\n\r\nThe testing was enhanced to enabled to also test non x-pack Basic features by enabling the trial license as part of the test run.","created_at":"2018-05-29T12:46:01Z","updated_at":"2018-07-05T20:46:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a8e6bea31f35d68d28b8082342017f6775c431b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":331378892,"node_id":"MDU6TGFiZWwzMzEzNzg4OTI=","url":"https://api.github.com/repos/elastic/beats/labels/Metricbeat","name":"Metricbeat","color":"008000","default":false},{"id":219536313,"node_id":"MDU6TGFiZWwyMTk1MzYzMTM=","url":"https://api.github.com/repos/elastic/beats/labels/module","name":"module","color":"008000","default":false},{"id":228068770,"node_id":"MDU6TGFiZWwyMjgwNjg3NzA=","url":"https://api.github.com/repos/elastic/beats/labels/review","name":"review","color":"207de5","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/beats/pulls/7196/commits","review_comments_url":"https://api.github.com/repos/elastic/beats/pulls/7196/comments","review_comment_url":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/beats/issues/7196/comments","statuses_url":"https://api.github.com/repos/elastic/beats/statuses/a469a130b7e8bff34f60ce081564feebd3f80dc9","head":{"label":"ruflin:ml-stats","ref":"ml-stats","sha":"a469a130b7e8bff34f60ce081564feebd3f80dc9","user":{"login":"ruflin","id":244900,"node_id":"MDQ6VXNlcjI0NDkwMA==","avatar_url":"https://avatars3.githubusercontent.com/u/244900?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk0MDU0NDI4Mg==","name":"beats","full_name":"ruflin/beats","owner":{"login":"ruflin","id":244900,"node_id":"MDQ6VXNlcjI0NDkwMA==","avatar_url":"https://avatars3.githubusercontent.com/u/244900?v=4","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":"2018-05-09T08:21:57Z","pushed_at":"2018-07-05T15:03:33Z","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":89008,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"694cc594c0ab1399f20b6727922c3c2777dff51b","user":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU1NDczOQ==","name":"beats","full_name":"elastic/beats","owner":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","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":"2018-07-05T14:33:57Z","pushed_at":"2018-07-05T20:27:35Z","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":83600,"stargazers_count":5784,"watchers_count":5784,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1760,"mirror_url":null,"archived":false,"open_issues_count":821,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1760,"open_issues":821,"watchers":5784,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/7196"},"html":{"href":"https://github.com/elastic/beats/pull/7196"},"issue":{"href":"https://api.github.com/repos/elastic/beats/issues/7196"},"comments":{"href":"https://api.github.com/repos/elastic/beats/issues/7196/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/beats/pulls/7196/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/beats/pulls/7196/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/beats/statuses/a469a130b7e8bff34f60ce081564feebd3f80dc9"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ycombinator"}}