From bb431af4009e39be43aab0c0a13171b086d6d69b Mon Sep 17 00:00:00 2001 From: sayden Date: Thu, 12 Nov 2020 12:56:39 +0100 Subject: [PATCH 01/10] Squash changes and fix conflicts --- metricbeat/docs/fields.asciidoc | 562 ++++++++++++++++++ .../docs/modules/elasticsearch/ccr.asciidoc | 6 - .../module/elasticsearch/_meta/fields.yml | 124 ++++ .../module/elasticsearch/ccr/_meta/data.json | 39 -- .../module/elasticsearch/ccr/_meta/fields.yml | 119 ++++ metricbeat/module/elasticsearch/ccr/ccr.go | 15 +- metricbeat/module/elasticsearch/ccr/data.go | 87 ++- .../module/elasticsearch/ccr/data_xpack.go | 78 --- .../elasticsearch_integration_test.go | 2 +- metricbeat/module/elasticsearch/fields.go | 2 +- 10 files changed, 888 insertions(+), 146 deletions(-) delete mode 100644 metricbeat/module/elasticsearch/ccr/_meta/data.json delete mode 100644 metricbeat/module/elasticsearch/ccr/data_xpack.go diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index dc85a9985c3e..79339aaabd3d 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -17642,6 +17642,359 @@ alias to: elasticsearch.node.name -- +*`ccr_auto_follow_stats.number_of_failed_follow_indices`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.auto_follow.failed.follow_indices.count + +-- + +*`ccr_auto_follow_stats.number_of_failed_remote_cluster_state_requests`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.auto_follow.failed.remote_cluster_state_requests.count + +-- + +*`ccr_auto_follow_stats.number_of_successful_follow_indices`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.auto_follow.success.follow_indices.count + +-- + +*`ccr_auto_follow_stats.recent_auto_follow_errors.leader_index`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.auto_follow.recent_errors.leader_index + +-- + +*`ccr_auto_follow_stats.recent_auto_follow_errors.timestamp`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.auto_follow.recent_errors.timestamp + +-- + +*`ccr_auto_follow_stats.recent_auto_follow_errors.exception.type`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.auto_follow.exception.type + +-- + +*`ccr_auto_follow_stats.recent_auto_follow_errors.exception.reason`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.auto_follow.exception.reason + +-- + + +*`ccr_stats.shard_id`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.shard_id + +-- + +*`ccr_stats.remote_cluster`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.remote_cluster + +-- + +*`ccr_stats.leader_index`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.leader.index + +-- + +*`ccr_stats.follower_index`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.follower.index + +-- + +*`ccr_stats.leader_global_checkpoint`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.leader.global_checkpoint + +-- + +*`ccr_stats.leader_max_seq_no`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.leader.max_seq_no + +-- + +*`ccr_stats.follower_global_checkpoint`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.follower.global_checkpoint + +-- + +*`ccr_stats.follower_max_seq_no`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.follower.max_seq_no + +-- + +*`ccr_stats.last_requested_seq_no`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.last_requested_seq_no + +-- + +*`ccr_stats.outstanding_read_requests`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.requests.outstanding.read.count + +-- + +*`ccr_stats.outstanding_write_requests`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.requests.outstanding.write.count + +-- + +*`ccr_stats.write_buffer_operation_count`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.write_buffer.operation.count + +-- + +*`ccr_stats.write_buffer_size_in_bytes`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.write_buffer.size.bytes + +-- + +*`ccr_stats.follower_mapping_version`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.follower.mapping_version + +-- + +*`ccr_stats.follower_settings_version`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.follower.settings_version + +-- + +*`ccr_stats.follower_aliases_version`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.follower.aliases_version + +-- + +*`ccr_stats.total_read_time_millis`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.total_time.read.ms + +-- + +*`ccr_stats.total_read_remote_exec_time_millis`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.total_time.read.remote_exec.ms + +-- + +*`ccr_stats.successful_read_requests`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.requests.successful.read.count + +-- + +*`ccr_stats.failed_read_requests`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.requests.failed.read.count + +-- + +*`ccr_stats.operations_read`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.operations.read.count + +-- + +*`ccr_stats.operations_written`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.follower.operations_written + +-- + +*`ccr_stats.bytes_read`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.bytes_read + +-- + +*`ccr_stats.total_write_time_millis`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.total_time.write.ms + +-- + +*`ccr_stats.successful_write_requests`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.requests.successful.write.count + +-- + +*`ccr_stats.failed_write_requests`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.requests.failed.write.count + +-- + +*`ccr_stats.read_exceptions.from_seq_no`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.read_exceptions.from_seq_no + +-- + +*`ccr_stats.read_exceptions.retries`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.read_exceptions.retries + +-- + +*`ccr_stats.read_exceptions.exception.type`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.read_exceptions.exception.type + +-- + +*`ccr_stats.read_exceptions.exception.reason`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.read_exceptions.exception.reason + +-- + +*`ccr_stats.fatal_exception.type`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.fatal_exception.type + +-- + +*`ccr_stats.fatal_exception.reason`*:: ++ +-- +type: alias + +alias to: elasticsearch.ccr.fatal_exception.reason + +-- + + *`node_stats.fs.total.available_in_bytes`*:: @@ -18270,6 +18623,170 @@ Cross-cluster replication stats +*`elasticsearch.ccr.remote_cluster`*:: ++ +-- +type: keyword + +-- + +*`elasticsearch.ccr.bytes_read`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.last_requested_seq_no`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.shard_id`*:: ++ +-- +type: integer + +-- + + +*`elasticsearch.ccr.total_time.read.ms`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.total_time.read.remote_exec.ms`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.total_time.write.ms`*:: ++ +-- +type: long + +-- + + + +*`elasticsearch.ccr.requests.successful.read.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.requests.successful.write.count`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.ccr.requests.failed.read.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.requests.failed.write.count`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.ccr.requests.outstanding.read.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.requests.outstanding.write.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.requests.read_exceptions`*:: ++ +-- +type: nested + +-- + + +*`elasticsearch.ccr.write_buffer.size.bytes`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.write_buffer.operation.count`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.ccr.fatal_exceptions.type`*:: ++ +-- +type: keyword + +-- + +*`elasticsearch.ccr.fatal_exceptions.reason`*:: ++ +-- +type: text + +-- + + + +*`elasticsearch.ccr.auto_follow.failed.follow_indices.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.auto_follow.failed.remote_cluster_state_requests.count`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.ccr.auto_follow.success.follow_indices.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.auto_follow.recent_errors`*:: ++ +-- +type: nested + +-- + *`elasticsearch.ccr.leader.index`*:: + @@ -18291,6 +18808,13 @@ type: long -- +*`elasticsearch.ccr.leader.global_checkpoint`*:: ++ +-- +type: long + +-- + *`elasticsearch.ccr.follower.index`*:: + @@ -18342,6 +18866,44 @@ type: long -- +*`elasticsearch.ccr.follower.max_seq_no`*:: ++ +-- +Maximum sequence number of operation on the follower shard + + +type: long + +-- + +*`elasticsearch.ccr.follower.mapping_version`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.follower.settings_version`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.follower.aliases_version`*:: ++ +-- +type: long + +-- + +*`elasticsearch.ccr.follower.operations.read.count`*:: ++ +-- +type: long + +-- + [float] === cluster.stats diff --git a/metricbeat/docs/modules/elasticsearch/ccr.asciidoc b/metricbeat/docs/modules/elasticsearch/ccr.asciidoc index 467d1de0bf3d..87f4303b529d 100644 --- a/metricbeat/docs/modules/elasticsearch/ccr.asciidoc +++ b/metricbeat/docs/modules/elasticsearch/ccr.asciidoc @@ -13,9 +13,3 @@ include::../../../module/elasticsearch/ccr/_meta/docs.asciidoc[] For a description of each field in the metricset, see the <> section. -Here is an example document generated by this metricset: - -[source,json] ----- -include::../../../module/elasticsearch/ccr/_meta/data.json[] ----- diff --git a/metricbeat/module/elasticsearch/_meta/fields.yml b/metricbeat/module/elasticsearch/_meta/fields.yml index 07b33ad5773d..45dc5676a238 100644 --- a/metricbeat/module/elasticsearch/_meta/fields.yml +++ b/metricbeat/module/elasticsearch/_meta/fields.yml @@ -21,6 +21,130 @@ - name: name type: alias path: elasticsearch.node.name + - name: ccr_auto_follow_stats + type: group + fields: + - name: number_of_failed_follow_indices + type: alias + path: elasticsearch.ccr.auto_follow.failed.follow_indices.count + - name: number_of_failed_remote_cluster_state_requests + type: alias + path: elasticsearch.ccr.auto_follow.failed.remote_cluster_state_requests.count + - name: number_of_successful_follow_indices + type: alias + path: elasticsearch.ccr.auto_follow.success.follow_indices.count + - name: recent_auto_follow_errors.leader_index + type: alias + path: elasticsearch.ccr.auto_follow.recent_errors.leader_index + - name: recent_auto_follow_errors.timestamp + type: alias + path: elasticsearch.ccr.auto_follow.recent_errors.timestamp + - name: recent_auto_follow_errors.exception.type + type: alias + path: elasticsearch.ccr.auto_follow.exception.type + - name: recent_auto_follow_errors.exception.reason + type: alias + path: elasticsearch.ccr.auto_follow.exception.reason + - name: ccr_stats + type: group + fields: + - name: shard_id + type: alias + path: elasticsearch.ccr.shard_id + - name: remote_cluster + type: alias + path: elasticsearch.ccr.remote_cluster + - name: leader_index + type: alias + path: elasticsearch.ccr.leader.index + - name: follower_index + type: alias + path: elasticsearch.ccr.follower.index + - name: leader_global_checkpoint + type: alias + path: elasticsearch.ccr.leader.global_checkpoint + - name: leader_max_seq_no + type: alias + path: elasticsearch.ccr.leader.max_seq_no + - name: follower_global_checkpoint + type: alias + path: elasticsearch.ccr.follower.global_checkpoint + - name: follower_max_seq_no + type: alias + path: elasticsearch.ccr.follower.max_seq_no + - name: last_requested_seq_no + type: alias + path: elasticsearch.ccr.last_requested_seq_no + - name: outstanding_read_requests + type: alias + path: elasticsearch.ccr.requests.outstanding.read.count + - name: outstanding_write_requests + type: alias + path: elasticsearch.ccr.requests.outstanding.write.count + - name: write_buffer_operation_count + type: alias + path: elasticsearch.ccr.write_buffer.operation.count + - name: write_buffer_size_in_bytes + type: alias + path: elasticsearch.ccr.write_buffer.size.bytes + - name: follower_mapping_version + type: alias + path: elasticsearch.ccr.follower.mapping_version + - name: follower_settings_version + type: alias + path: elasticsearch.ccr.follower.settings_version + - name: follower_aliases_version + type: alias + path: elasticsearch.ccr.follower.aliases_version + - name: total_read_time_millis + type: alias + path: elasticsearch.ccr.total_time.read.ms + - name: total_read_remote_exec_time_millis + type: alias + path: elasticsearch.ccr.total_time.read.remote_exec.ms + - name: successful_read_requests + type: alias + path: elasticsearch.ccr.requests.successful.read.count + - name: failed_read_requests + type: alias + path: elasticsearch.ccr.requests.failed.read.count + - name: operations_read + type: alias + path: elasticsearch.ccr.operations.read.count + - name: operations_written + type: alias + path: elasticsearch.ccr.follower.operations_written + - name: bytes_read + type: alias + path: elasticsearch.ccr.bytes_read + - name: total_write_time_millis + type: alias + path: elasticsearch.ccr.total_time.write.ms + - name: successful_write_requests + type: alias + path: elasticsearch.ccr.requests.successful.write.count + - name: failed_write_requests + type: alias + path: elasticsearch.ccr.requests.failed.write.count + - name: read_exceptions.from_seq_no + type: alias + path: elasticsearch.ccr.read_exceptions.from_seq_no + - name: read_exceptions.retries + type: alias + path: elasticsearch.ccr.read_exceptions.retries + - name: read_exceptions.exception.type + type: alias + path: elasticsearch.ccr.read_exceptions.exception.type + - name: read_exceptions.exception.reason + type: alias + path: elasticsearch.ccr.read_exceptions.exception.reason + - name: fatal_exception.type + type: alias + path: elasticsearch.ccr.fatal_exception.type + - name: fatal_exception.reason + type: alias + path: elasticsearch.ccr.fatal_exception.reason + - name: node_stats type: group fields: diff --git a/metricbeat/module/elasticsearch/ccr/_meta/data.json b/metricbeat/module/elasticsearch/ccr/_meta/data.json deleted file mode 100644 index a33929b9195d..000000000000 --- a/metricbeat/module/elasticsearch/ccr/_meta/data.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "@timestamp": "2017-10-12T08:05:34.853Z", - "agent": { - "hostname": "host.example.com", - "name": "host.example.com" - }, - "elasticsearch": { - "ccr": { - "follower": { - "global_checkpoint": -1, - "index": "my_index_f", - "operations_written": 0, - "shard": { - "number": 0 - }, - "time_since_last_read": { - "ms": 42294 - } - }, - "leader": { - "index": "my_index", - "max_seq_no": -1 - } - }, - "cluster": { - "id": "3LbUkLkURz--FR-YO0wLNA", - "name": "es1" - } - }, - "metricset": { - "host": "127.0.0.1:9200", - "module": "elasticsearch", - "name": "ccr", - "rtt": 115 - }, - "service": { - "name": "elasticsearch" - } -} \ No newline at end of file diff --git a/metricbeat/module/elasticsearch/ccr/_meta/fields.yml b/metricbeat/module/elasticsearch/ccr/_meta/fields.yml index ba19090815c1..0d830252d5b9 100644 --- a/metricbeat/module/elasticsearch/ccr/_meta/fields.yml +++ b/metricbeat/module/elasticsearch/ccr/_meta/fields.yml @@ -4,6 +4,110 @@ Cross-cluster replication stats release: ga fields: + - name: remote_cluster + type: keyword + - name: bytes_read + type: long + - name: last_requested_seq_no + type: long + - name: shard_id + type: integer + + - name: total_time + type: group + fields: + - name: read.ms + type: long + - name: read.remote_exec.ms + type: long + - name: write.ms + type: long + + - name: requests + type: group + fields: + - name: successful + type: group + fields: + - name: read.count + type: long + - name: write.count + type: long + - name: failed + type: group + fields: + - name: read.count + type: long + - name: write.count + type: long + - name: outstanding + type: group + fields: + - name: read.count + type: long + - name: write.count + type: long + - name: read_exceptions + type: nested + fields: + - name: from_seq_no + type: long + - name: retries + type: integer + - name: exception + type: group + fields: + - name: type + type: keyword + - name: reason + type: text + + - name: write_buffer + type: group + fields: + - name: size.bytes + type: long + - name: operation.count + type: long + + - name: fatal_exceptions + type: group + fields: + - name: type + type: keyword + - name: reason + type: text + + - name: auto_follow + type: group + fields: + - name: failed + type: group + fields: + - name: follow_indices.count + type: long + - name: remote_cluster_state_requests.count + type: long + - name: success + type: group + fields: + - name: follow_indices.count + type: long + - name: recent_errors + type: nested + fields: + - name: leader_index + type: keyword + - name: timestamp + type: long + - name: exception + type: group + fields: + - name: type + type: keyword + - name: reason + type: text + - name: leader type: group fields: @@ -15,6 +119,9 @@ type: long description: > Maximum sequence number of operation on the leader shard + - name: global_checkpoint + type: long + - name: follower type: group fields: @@ -38,3 +145,15 @@ type: long description: > Global checkpoint value on follower shard + - name: max_seq_no + type: long + description: > + Maximum sequence number of operation on the follower shard + - name: mapping_version + type: long + - name: settings_version + type: long + - name: aliases_version + type: long + - name: operations.read.count + type: long diff --git a/metricbeat/module/elasticsearch/ccr/ccr.go b/metricbeat/module/elasticsearch/ccr/ccr.go index 74f7a232281d..bf6cf9c7893c 100644 --- a/metricbeat/module/elasticsearch/ccr/ccr.go +++ b/metricbeat/module/elasticsearch/ccr/ccr.go @@ -89,20 +89,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { return err } - if m.XPack { - err = eventsMappingXPack(r, m, *info, content) - if err != nil { - // Since this is an x-pack code path, we log the error but don't - // return it. Otherwise it would get reported into `metricbeat-*` - // indices. - m.Logger().Error(err) - return nil - } - } else { - return eventsMapping(r, *info, content) - } - - return nil + return eventsMapping(r, *info, content) } func (m *MetricSet) checkCCRAvailability(currentElasticsearchVersion *common.Version) (message string, err error) { diff --git a/metricbeat/module/elasticsearch/ccr/data.go b/metricbeat/module/elasticsearch/ccr/data.go index 8d7d11bffa39..4d579bf8dac6 100644 --- a/metricbeat/module/elasticsearch/ccr/data.go +++ b/metricbeat/module/elasticsearch/ccr/data.go @@ -33,20 +33,94 @@ import ( var ( schema = s.Schema{ "leader": s.Object{ - "index": c.Str("leader_index"), - "max_seq_no": c.Int("leader_max_seq_no"), + "index": c.Str("leader_index"), + "max_seq_no": c.Int("leader_max_seq_no"), + "global_checkpoint": c.Int("leader_global_checkpoint"), }, + "total_time": s.Object{ + "read": s.Object{ + "ms": c.Int("total_read_time_millis"), + "remote_exec": s.Object{ + "ms": c.Int("total_read_remote_exec_time_millis"), + }, + }, + + "write": s.Object{ + "ms": c.Int("total_write_time_millis"), + }, + }, + "write_buffer": s.Object{ + "size": s.Object{ + "bytes": c.Int("write_buffer_size_in_bytes"), + }, + "operation": s.Object{ + "count": c.Int("write_buffer_operation_count"), + }, + }, + "bytes_read": c.Int("bytes_read"), "follower": s.Object{ "index": c.Str("follower_index"), "shard": s.Object{ "number": c.Int("shard_id"), }, "operations_written": c.Int("operations_written"), + "operations": s.Object{ + "read": s.Object{ + "count": c.Int("operations_read"), + }, + }, + "max_seq_no": c.Int("follower_max_seq_no"), "time_since_last_read": s.Object{ "ms": c.Int("time_since_last_read_millis"), }, "global_checkpoint": c.Int("follower_global_checkpoint"), + "settings_version": c.Int("follower_settings_version"), + "aliases_version": c.Int("follower_aliases_version"), + }, + "requests": s.Object{ + "successful": s.Object{ + "read": s.Object{ + "count": c.Int("successful_read_requests"), + }, + "write": s.Object{ + "count": c.Int("successful_write_requests"), + }, + }, + "failed": s.Object{ + "read": s.Object{ + "count": c.Int("failed_read_requests"), + }, + "write": s.Object{ + "count": c.Int("failed_write_requests"), + }, + }, + "outstanding": s.Object{ + "read": s.Object{ + "count": c.Int("outstanding_read_requests"), + }, + "write": s.Object{ + "count": c.Int("outstanding_write_requests"), + }, + }, + "read_exceptions": c.Ifc("read_exceptions"), + }, + } + + autoFollowSchema = s.Schema{ + "failed": s.Object{ + "follow_indices": s.Object{ + "count": c.Int("number_of_failed_follow_indices"), + }, + "remote_cluster_state_requests": s.Object{ + "count": c.Int("number_of_failed_remote_cluster_state_requests"), + }, }, + "success": s.Object{ + "follow_indices": s.Object{ + "count": c.Int("number_of_successful_follow_indices"), + }, + }, + "recent_errors": c.Ifc("recent_auto_follow_errors"), } ) @@ -77,11 +151,10 @@ func eventsMapping(r mb.ReporterV2, info elasticsearch.Info, content []byte) err event.ModuleFields.Put("cluster.name", info.ClusterName) event.ModuleFields.Put("cluster.id", info.ClusterID) - event.MetricSetFields, err = schema.Apply(followerShard) - if err != nil { - errs = append(errs, errors.Wrap(err, "failure applying shard schema")) - continue - } + event.MetricSetFields, _ = schema.Apply(followerShard) + + autoFollow, _ := autoFollowSchema.Apply(data.AutoFollowStats) + event.MetricSetFields["auto_follow"] = autoFollow r.Event(event) } diff --git a/metricbeat/module/elasticsearch/ccr/data_xpack.go b/metricbeat/module/elasticsearch/ccr/data_xpack.go deleted file mode 100644 index 547397f18a0c..000000000000 --- a/metricbeat/module/elasticsearch/ccr/data_xpack.go +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package ccr - -import ( - "encoding/json" - "time" - - "github.com/pkg/errors" - - "github.com/elastic/beats/v7/libbeat/common" - "github.com/elastic/beats/v7/metricbeat/helper/elastic" - "github.com/elastic/beats/v7/metricbeat/mb" - "github.com/elastic/beats/v7/metricbeat/module/elasticsearch" -) - -func eventsMappingXPack(r mb.ReporterV2, m *MetricSet, info elasticsearch.Info, content []byte) error { - var data response - err := json.Unmarshal(content, &data) - if err != nil { - return errors.Wrap(err, "failure parsing Elasticsearch CCR Stats API response") - } - - now := common.Time(time.Now()) - intervalMS := m.Module().Config().Period / time.Millisecond - index := elastic.MakeXPackMonitoringIndexName(elastic.Elasticsearch) - - indexCCRStats(r, data, info, now, intervalMS, index) - indexCCRAutoFollowStats(r, data, info, now, intervalMS, index) - return nil -} - -func indexCCRStats(r mb.ReporterV2, ccrData response, esInfo elasticsearch.Info, now common.Time, intervalMS time.Duration, indexName string) { - for _, followerIndex := range ccrData.FollowStats.Indices { - for _, followerShard := range followerIndex.Shards { - event := mb.Event{} - event.RootFields = common.MapStr{ - "cluster_uuid": esInfo.ClusterID, - "timestamp": now, - "interval_ms": intervalMS, - "type": "ccr_stats", - "ccr_stats": followerShard, - } - - event.Index = indexName - r.Event(event) - } - } -} - -func indexCCRAutoFollowStats(r mb.ReporterV2, ccrData response, esInfo elasticsearch.Info, now common.Time, intervalMS time.Duration, indexName string) { - event := mb.Event{} - event.RootFields = common.MapStr{ - "cluster_uuid": esInfo.ClusterID, - "timestamp": now, - "interval_ms": intervalMS, - "type": "ccr_auto_follow_stats", - "ccr_auto_follow_stats": ccrData.AutoFollowStats, - } - - event.Index = indexName - r.Event(event) -} diff --git a/metricbeat/module/elasticsearch/elasticsearch_integration_test.go b/metricbeat/module/elasticsearch/elasticsearch_integration_test.go index 4ee5c9531503..4c2a6d0f7147 100644 --- a/metricbeat/module/elasticsearch/elasticsearch_integration_test.go +++ b/metricbeat/module/elasticsearch/elasticsearch_integration_test.go @@ -127,7 +127,7 @@ func TestXPackEnabled(t *testing.T) { setupTest(t, host, version) metricSetToTypesMap := map[string][]string{ - "ccr": []string{"ccr_stats", "ccr_auto_follow_stats"}, + "ccr": []string{}, // no longer indexed into .monitoring-es-* "cluster_stats": []string{"cluster_stats"}, "enrich": []string{"enrich_coordinator_stats"}, "index_recovery": []string{"index_recovery"}, diff --git a/metricbeat/module/elasticsearch/fields.go b/metricbeat/module/elasticsearch/fields.go index f6aac5492273..964ae47aba05 100644 --- a/metricbeat/module/elasticsearch/fields.go +++ b/metricbeat/module/elasticsearch/fields.go @@ -32,5 +32,5 @@ func init() { // AssetElasticsearch returns asset data. // This is the base64 encoded gzipped contents of module/elasticsearch. func AssetElasticsearch() string { - return "eJzsXV1v4zazvs+vGOSqBXYFnNtcnB6gXycFdlucTQscvHih0tLY5kYSHZLyJv31L0h9WJJJipKorLNwLopuHD/zzHBIDodD8j084ssdYEaEpIlAwpP9DYCkMsM7uP25+/vbG4AURcLpQVJW3MF/3wAA9P4GcpaWGd4AcMyQCLyDHbkBECglLXbiDv51K0R2+w5u91Iebv+tPtszLuOEFVu6u4MtyYT6/pZiloo7LeI9FCTHO5A0RyFJftC/BZAvB7wDklEi6t8ciNzfwe3/tH952wNIslJI5HFZ0nQEo2eSqP5iVH+twROs5AnGBUuxB7fjrGxIdhXpfrfDwczDxkVJizrfbQDVf+cDtt9u4ViKsZBEismqbcUZj+7XTF/tNTOTJOt9YkOxIXXRyJHQjGwyjGkRb14kirM/dZh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5GHjqgyYp69ollL1EaBKsfccTfnwwu3838njOH3lkdI5Rl9/gR76G9tk56DuVpdf1Iwie5tiZ37C3CvGJ6psfuEdBc/tut1/cjyM7bTEGWnzXeAGrw5m/Of+DKup+L+GHUnXf9JHb0tX0CPoPoqrj//RLUlvT+AKybmsqMNfnrdXZw3+YAP+QKx8mFUcYtb9AzS90JD0csCWHmAMTKWW2R2/W37J5KyHRHHJYkghlRJjr9225ZWSA60ekrBBmlBRQcSxB/6QMwRMuL0WjUC3etK9AmBfK9lFs1bFnQZTN15lIKVNOJeysh04frVjdJdsHUmTnCepju5VrFGfCEVGP+nqUbjQ+lBPnLplk4q4aGfOC30eZcYwF+MhmUNAMi2ZSkTcdqrglEvUHlds3gjDvhLaP0ySv/j8AAP//ltNkhQ==" } From e6f2efebd758649b3f07a464bf0c103dbff5b35b Mon Sep 17 00:00:00 2001 From: sayden Date: Mon, 16 Nov 2020 19:01:48 +0100 Subject: [PATCH 02/10] Add TestData test and data.json file --- .../module/elasticsearch/ccr/_meta/data.json | 111 ++++++++++++++++++ .../module/elasticsearch/ccr/ccr_test.go | 16 +-- .../module/elasticsearch/ccr/data_test.go | 18 +++ 3 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 metricbeat/module/elasticsearch/ccr/_meta/data.json diff --git a/metricbeat/module/elasticsearch/ccr/_meta/data.json b/metricbeat/module/elasticsearch/ccr/_meta/data.json new file mode 100644 index 000000000000..5187774b6b39 --- /dev/null +++ b/metricbeat/module/elasticsearch/ccr/_meta/data.json @@ -0,0 +1,111 @@ +{ + "@timestamp": "2017-10-12T08:05:34.853Z", + "elasticsearch": { + "ccr": { + "auto_follow": { + "failed": { + "follow_indices": { + "count": 0 + }, + "remote_cluster_state_requests": { + "count": 0 + } + }, + "recent_errors": [], + "success": { + "follow_indices": { + "count": 1 + } + } + }, + "bytes_read": 32768, + "follower": { + "global_checkpoint": 768, + "index": "follower_index", + "max_seq_no": 896, + "operations": { + "read": { + "count": 896 + } + }, + "operations_written": 832, + "settings_version": 2, + "shard": { + "number": 0 + }, + "time_since_last_read": { + "ms": 8 + } + }, + "leader": { + "global_checkpoint": 1024, + "index": "leader_index", + "max_seq_no": 1536 + }, + "requests": { + "failed": { + "read": { + "count": 0 + }, + "write": { + "count": 0 + } + }, + "outstanding": { + "read": { + "count": 8 + }, + "write": { + "count": 2 + } + }, + "read_exceptions": [], + "successful": { + "read": { + "count": 32 + }, + "write": { + "count": 16 + } + } + }, + "total_time": { + "read": { + "ms": 32768, + "remote_exec": { + "ms": 16384 + } + }, + "write": { + "ms": 16384 + } + }, + "write_buffer": { + "operation": { + "count": 64 + }, + "size": { + "bytes": 1536 + } + } + }, + "cluster": { + "id": "", + "name": "" + } + }, + "event": { + "dataset": "elasticsearch.ccr", + "duration": 115000, + "module": "elasticsearch" + }, + "metricset": { + "name": "ccr", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:41239", + "name": "elasticsearch", + "type": "elasticsearch" + } +} \ No newline at end of file diff --git a/metricbeat/module/elasticsearch/ccr/ccr_test.go b/metricbeat/module/elasticsearch/ccr/ccr_test.go index f6d94c739e41..7a002744d587 100644 --- a/metricbeat/module/elasticsearch/ccr/ccr_test.go +++ b/metricbeat/module/elasticsearch/ccr/ccr_test.go @@ -30,8 +30,7 @@ import ( mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing" ) -func startESServer(esVersion, license string, ccrEnabled bool) *httptest.Server { - +func createEsMuxer(esVersion, license string, ccrEnabled bool) *http.ServeMux { nodesLocalHandler := func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(`{"nodes": { "foobar": {}}}`)) } @@ -50,9 +49,6 @@ func startESServer(esVersion, license string, ccrEnabled bool) *httptest.Server xpackHandler := func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(`{ "features": { "ccr": { "enabled": ` + strconv.FormatBool(ccrEnabled) + `}}}`)) } - ccrStatsHandler := func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "this should never have been called", 418) - } mux := http.NewServeMux() mux.Handle("/_nodes/_local/nodes", http.HandlerFunc(nodesLocalHandler)) @@ -61,9 +57,8 @@ func startESServer(esVersion, license string, ccrEnabled bool) *httptest.Server mux.Handle("/_license", http.HandlerFunc(licenseHandler)) // for 7.0 and above mux.Handle("/_xpack/license", http.HandlerFunc(licenseHandler)) // for before 7.0 mux.Handle("/_xpack", http.HandlerFunc(xpackHandler)) - mux.Handle("/_ccr/stats", http.HandlerFunc(ccrStatsHandler)) - return httptest.NewServer(mux) + return mux } func TestCCRNotAvailable(t *testing.T) { @@ -95,7 +90,12 @@ func TestCCRNotAvailable(t *testing.T) { for name, test := range tests { t.Run(name, func(t *testing.T) { - server := startESServer(test.esVersion, test.license, test.ccrEnabled) + mux := createEsMuxer(test.esVersion, test.license, test.ccrEnabled) + mux.Handle("/_ccr/stats", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.Error(w, "this should never have been called", 418) + })) + + server := httptest.NewServer(mux) defer server.Close() ms := mbtest.NewReportingMetricSetV2Error(t, getConfig(server.URL)) diff --git a/metricbeat/module/elasticsearch/ccr/data_test.go b/metricbeat/module/elasticsearch/ccr/data_test.go index c75bcdda5044..155d4a6fc017 100644 --- a/metricbeat/module/elasticsearch/ccr/data_test.go +++ b/metricbeat/module/elasticsearch/ccr/data_test.go @@ -21,6 +21,8 @@ package ccr import ( "io/ioutil" + "net/http" + "net/http/httptest" "testing" "github.com/stretchr/testify/require" @@ -47,3 +49,19 @@ func TestEmpty(t *testing.T) { require.Equal(t, 0, len(reporter.GetErrors())) require.Equal(t, 0, len(reporter.GetEvents())) } + +func TestData(t *testing.T) { + mux := createEsMuxer("7.6.0", "platinum", true) + mux.Handle("/_ccr/stats", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + input, _ := ioutil.ReadFile("./_meta/test/ccr_stats.700.json") + w.Write(input) + })) + + server := httptest.NewServer(mux) + defer server.Close() + + ms := mbtest.NewReportingMetricSetV2Error(t, getConfig(server.URL)) + if err := mbtest.WriteEventsReporterV2Error(ms, t, ""); err != nil { + t.Fatal("write", err) + } +} From 9434d999aae87ad86e212d9867021712b1e029be Mon Sep 17 00:00:00 2001 From: sayden Date: Tue, 17 Nov 2020 16:04:17 +0100 Subject: [PATCH 03/10] Fix asciidoc --- metricbeat/docs/modules/elasticsearch/ccr.asciidoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/metricbeat/docs/modules/elasticsearch/ccr.asciidoc b/metricbeat/docs/modules/elasticsearch/ccr.asciidoc index 87f4303b529d..467d1de0bf3d 100644 --- a/metricbeat/docs/modules/elasticsearch/ccr.asciidoc +++ b/metricbeat/docs/modules/elasticsearch/ccr.asciidoc @@ -13,3 +13,9 @@ include::../../../module/elasticsearch/ccr/_meta/docs.asciidoc[] For a description of each field in the metricset, see the <> section. +Here is an example document generated by this metricset: + +[source,json] +---- +include::../../../module/elasticsearch/ccr/_meta/data.json[] +---- From 4d1eed251d08f19375c82a17774caa92fe334b0b Mon Sep 17 00:00:00 2001 From: sayden Date: Tue, 17 Nov 2020 22:13:54 +0100 Subject: [PATCH 04/10] Fix mapping issues --- metricbeat/docs/fields.asciidoc | 121 +----------------- .../module/elasticsearch/_meta/fields.yml | 32 +---- .../module/elasticsearch/ccr/_meta/data.json | 4 +- .../module/elasticsearch/ccr/_meta/fields.yml | 36 ------ metricbeat/module/elasticsearch/ccr/data.go | 3 +- metricbeat/module/elasticsearch/fields.go | 2 +- 6 files changed, 5 insertions(+), 193 deletions(-) diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 79339aaabd3d..3cb5a6996210 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -17669,42 +17669,6 @@ alias to: elasticsearch.ccr.auto_follow.success.follow_indices.count -- -*`ccr_auto_follow_stats.recent_auto_follow_errors.leader_index`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.auto_follow.recent_errors.leader_index - --- - -*`ccr_auto_follow_stats.recent_auto_follow_errors.timestamp`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.auto_follow.recent_errors.timestamp - --- - -*`ccr_auto_follow_stats.recent_auto_follow_errors.exception.type`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.auto_follow.exception.type - --- - -*`ccr_auto_follow_stats.recent_auto_follow_errors.exception.reason`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.auto_follow.exception.reason - --- - *`ccr_stats.shard_id`*:: + @@ -17891,7 +17855,7 @@ alias to: elasticsearch.ccr.requests.failed.read.count -- type: alias -alias to: elasticsearch.ccr.operations.read.count +alias to: elasticsearch.ccr.follower.operations.read.count -- @@ -17940,60 +17904,6 @@ alias to: elasticsearch.ccr.requests.failed.write.count -- -*`ccr_stats.read_exceptions.from_seq_no`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.read_exceptions.from_seq_no - --- - -*`ccr_stats.read_exceptions.retries`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.read_exceptions.retries - --- - -*`ccr_stats.read_exceptions.exception.type`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.read_exceptions.exception.type - --- - -*`ccr_stats.read_exceptions.exception.reason`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.read_exceptions.exception.reason - --- - -*`ccr_stats.fatal_exception.type`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.fatal_exception.type - --- - -*`ccr_stats.fatal_exception.reason`*:: -+ --- -type: alias - -alias to: elasticsearch.ccr.fatal_exception.reason - --- - @@ -18719,13 +18629,6 @@ type: long -- -*`elasticsearch.ccr.requests.read_exceptions`*:: -+ --- -type: nested - --- - *`elasticsearch.ccr.write_buffer.size.bytes`*:: + @@ -18742,21 +18645,6 @@ type: long -- -*`elasticsearch.ccr.fatal_exceptions.type`*:: -+ --- -type: keyword - --- - -*`elasticsearch.ccr.fatal_exceptions.reason`*:: -+ --- -type: text - --- - - *`elasticsearch.ccr.auto_follow.failed.follow_indices.count`*:: + @@ -18780,13 +18668,6 @@ type: long -- -*`elasticsearch.ccr.auto_follow.recent_errors`*:: -+ --- -type: nested - --- - *`elasticsearch.ccr.leader.index`*:: + diff --git a/metricbeat/module/elasticsearch/_meta/fields.yml b/metricbeat/module/elasticsearch/_meta/fields.yml index 45dc5676a238..a74704b588fd 100644 --- a/metricbeat/module/elasticsearch/_meta/fields.yml +++ b/metricbeat/module/elasticsearch/_meta/fields.yml @@ -33,18 +33,6 @@ - name: number_of_successful_follow_indices type: alias path: elasticsearch.ccr.auto_follow.success.follow_indices.count - - name: recent_auto_follow_errors.leader_index - type: alias - path: elasticsearch.ccr.auto_follow.recent_errors.leader_index - - name: recent_auto_follow_errors.timestamp - type: alias - path: elasticsearch.ccr.auto_follow.recent_errors.timestamp - - name: recent_auto_follow_errors.exception.type - type: alias - path: elasticsearch.ccr.auto_follow.exception.type - - name: recent_auto_follow_errors.exception.reason - type: alias - path: elasticsearch.ccr.auto_follow.exception.reason - name: ccr_stats type: group fields: @@ -110,7 +98,7 @@ path: elasticsearch.ccr.requests.failed.read.count - name: operations_read type: alias - path: elasticsearch.ccr.operations.read.count + path: elasticsearch.ccr.follower.operations.read.count - name: operations_written type: alias path: elasticsearch.ccr.follower.operations_written @@ -126,24 +114,6 @@ - name: failed_write_requests type: alias path: elasticsearch.ccr.requests.failed.write.count - - name: read_exceptions.from_seq_no - type: alias - path: elasticsearch.ccr.read_exceptions.from_seq_no - - name: read_exceptions.retries - type: alias - path: elasticsearch.ccr.read_exceptions.retries - - name: read_exceptions.exception.type - type: alias - path: elasticsearch.ccr.read_exceptions.exception.type - - name: read_exceptions.exception.reason - type: alias - path: elasticsearch.ccr.read_exceptions.exception.reason - - name: fatal_exception.type - type: alias - path: elasticsearch.ccr.fatal_exception.type - - name: fatal_exception.reason - type: alias - path: elasticsearch.ccr.fatal_exception.reason - name: node_stats type: group diff --git a/metricbeat/module/elasticsearch/ccr/_meta/data.json b/metricbeat/module/elasticsearch/ccr/_meta/data.json index 5187774b6b39..32024e2360f2 100644 --- a/metricbeat/module/elasticsearch/ccr/_meta/data.json +++ b/metricbeat/module/elasticsearch/ccr/_meta/data.json @@ -11,7 +11,6 @@ "count": 0 } }, - "recent_errors": [], "success": { "follow_indices": { "count": 1 @@ -59,7 +58,6 @@ "count": 2 } }, - "read_exceptions": [], "successful": { "read": { "count": 32 @@ -104,7 +102,7 @@ "period": 10000 }, "service": { - "address": "127.0.0.1:41239", + "address": "127.0.0.1:42127", "name": "elasticsearch", "type": "elasticsearch" } diff --git a/metricbeat/module/elasticsearch/ccr/_meta/fields.yml b/metricbeat/module/elasticsearch/ccr/_meta/fields.yml index 0d830252d5b9..60fffe012b89 100644 --- a/metricbeat/module/elasticsearch/ccr/_meta/fields.yml +++ b/metricbeat/module/elasticsearch/ccr/_meta/fields.yml @@ -47,20 +47,6 @@ type: long - name: write.count type: long - - name: read_exceptions - type: nested - fields: - - name: from_seq_no - type: long - - name: retries - type: integer - - name: exception - type: group - fields: - - name: type - type: keyword - - name: reason - type: text - name: write_buffer type: group @@ -70,14 +56,6 @@ - name: operation.count type: long - - name: fatal_exceptions - type: group - fields: - - name: type - type: keyword - - name: reason - type: text - - name: auto_follow type: group fields: @@ -93,20 +71,6 @@ fields: - name: follow_indices.count type: long - - name: recent_errors - type: nested - fields: - - name: leader_index - type: keyword - - name: timestamp - type: long - - name: exception - type: group - fields: - - name: type - type: keyword - - name: reason - type: text - name: leader type: group diff --git a/metricbeat/module/elasticsearch/ccr/data.go b/metricbeat/module/elasticsearch/ccr/data.go index 4d579bf8dac6..405a21aa1e97 100644 --- a/metricbeat/module/elasticsearch/ccr/data.go +++ b/metricbeat/module/elasticsearch/ccr/data.go @@ -102,7 +102,6 @@ var ( "count": c.Int("outstanding_write_requests"), }, }, - "read_exceptions": c.Ifc("read_exceptions"), }, } @@ -120,7 +119,7 @@ var ( "count": c.Int("number_of_successful_follow_indices"), }, }, - "recent_errors": c.Ifc("recent_auto_follow_errors"), + //"recent_errors": c.Ifc("recent_auto_follow_errors"), } ) diff --git a/metricbeat/module/elasticsearch/fields.go b/metricbeat/module/elasticsearch/fields.go index 964ae47aba05..dfe81db1ba9c 100644 --- a/metricbeat/module/elasticsearch/fields.go +++ b/metricbeat/module/elasticsearch/fields.go @@ -32,5 +32,5 @@ func init() { // AssetElasticsearch returns asset data. // This is the base64 encoded gzipped contents of module/elasticsearch. func AssetElasticsearch() string { - return "eJzsXUuP3DiSvvtXEHXqAWwBc63DzgI9j3UDdjfWngYWi4WaKUVm0pbENEmlq/rXL0TqQUkkRYlUOW2kD4PpqtIXXwRfwWAw+AZ9hudHBAXmgmQcMMvOrxASRBTwiB7+of/84RVCOfCMkYsgtHpE//EKIYRGf4NKmtcFvEKIQQGYwyM64VcIcRCCVCf+iP73gfPi4TV6OAtxefi/5ndnykSa0epITo/oiAvefH8kUOT8UYp4gypcwiMSpAQucHmRP0VIPF/gEeGCYN7+5ILF+RE9/Gf/lw8jgKyouQCW1jXJFzBGJknaD5P2sw6P05plkFY0hxHcidG6I6kron+rcTDzsHFppCXatx1g87/bAfuve1tlLMW1oOmRFgX9mnKBBV+tZVWXB2ApPaZHTArIOzRS5SQDvolvlrFEY5Yo5GSMnGS0rsQyHwYlFZB2PaPRElIGX2rgIio9p6BFtrzOMuD8WBd7WLBF9zMhgwwqMeobwBhlPCkA58Caz+EpCq9WlAt+mdV01ohJaY69zAeeMpAzaNKwiELKArmGCwPMaRWZjQaqTyvbphJ+xixPN06aDccZwGAffWhuxrfAdFKijA4FkpjHgLJ/sIwOxiKl1eNU0AMu0uwM2ecLJdpEsVEnO+BEcomfUg5f0oqGijQgzWwZT8/ersua9tIj6NqLdWjbfNQtRpAHW9eJ1smkteACVzmpTikDnIevuv1qqkE3c1BuWcl0Bl8ZibHwGylIbAsHJfdQH4/NQn8BhpuZMx3/8VoWOmjSg/ow4ORPSEmVHp5FgG8xkt9AJmM8Qze/XJpWuALjJGAZ0vq6GXAmuduZxBNtRZzJltAQUbQNsN9AUYELNdgazyUtSVGQ7c2s4BokNcrKeQtrEtvlEZ4g20W6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5oBsSD15djBcW//tg/v27vdAEhsfEI9F7RcS8BnbK140KEhO6WFO74wez9opmv0VpWvz/GvFp9XNM7j4nCjP4LKQDxJy6g9IgJsbnO0T5X1pPBxqOW4bLwAyYFPhS7CuxSqjS1Le5RlAzL/MM3MU6MBh6+RWHHKPutF5wn+0Dr2+O3Y3cGiHhl2E5vbIc+n+6dFKwvqMfht+iZ8tmx3G7FeaZzbAcy5l8YD2CMRidlZ5F81EPomwKXPgceqA8aHVlf8l73ShGhr2oHwA83Zvd3o4BHsVHAic4h6vxL1ijU0CErB3OlMvdGdQTB4zN29pegnUJCsvr2Z6LRprF9t+oX/xOjXlsMgWZfB53BanGmLzd/o4r630v4plTd9/jIdelqe0r4G1HV8z/dlNTcaXwBdW9rKjA3x63Fp4f/tgH+rWY+TCqOMGr+gOQfTCQzHbDmDDEHJlLKXI/eLK+yea0g0RSyn5IIZUTY7+9bU2Vkget6pLohzCppw41jCfqFMgSPuLwUUqFavGpegbBPlM3TstqxJ0mU1eVMpFRHTofPcHeajx6tWOySzQMpynk2+dhu1zWKM+GI6KcxA65utD6UE6eWTDHx3xoZs8DvvTpxjAWEyGZQ0AwLOaioSocq7hWJ5rOkzRtBmLdCm8dpkhf/CQAA//+pgLSC" } From ddd6b158f77e95f0cb4e80bc968aa47724ea919c Mon Sep 17 00:00:00 2001 From: sayden Date: Tue, 17 Nov 2020 22:41:27 +0100 Subject: [PATCH 05/10] Remove commented field --- metricbeat/module/elasticsearch/ccr/data.go | 1 - 1 file changed, 1 deletion(-) diff --git a/metricbeat/module/elasticsearch/ccr/data.go b/metricbeat/module/elasticsearch/ccr/data.go index 405a21aa1e97..7bc876439340 100644 --- a/metricbeat/module/elasticsearch/ccr/data.go +++ b/metricbeat/module/elasticsearch/ccr/data.go @@ -119,7 +119,6 @@ var ( "count": c.Int("number_of_successful_follow_indices"), }, }, - //"recent_errors": c.Ifc("recent_auto_follow_errors"), } ) From f5d34bec8635f949e720eaec4b20661f505c4492 Mon Sep 17 00:00:00 2001 From: sayden Date: Thu, 19 Nov 2020 09:40:22 +0100 Subject: [PATCH 06/10] Use full response from Elasticsearch in / mock path and update the data.json file --- metricbeat/module/elasticsearch/ccr/_meta/data.json | 6 +++--- metricbeat/module/elasticsearch/ccr/ccr_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/metricbeat/module/elasticsearch/ccr/_meta/data.json b/metricbeat/module/elasticsearch/ccr/_meta/data.json index 32024e2360f2..7c77d63339a6 100644 --- a/metricbeat/module/elasticsearch/ccr/_meta/data.json +++ b/metricbeat/module/elasticsearch/ccr/_meta/data.json @@ -88,8 +88,8 @@ } }, "cluster": { - "id": "", - "name": "" + "id": "8l_zoGznQRmtoX9iSC-goA", + "name": "docker-cluster" } }, "event": { @@ -102,7 +102,7 @@ "period": 10000 }, "service": { - "address": "127.0.0.1:42127", + "address": "127.0.0.1:49940", "name": "elasticsearch", "type": "elasticsearch" } diff --git a/metricbeat/module/elasticsearch/ccr/ccr_test.go b/metricbeat/module/elasticsearch/ccr/ccr_test.go index 7a002744d587..6553f18f5a69 100644 --- a/metricbeat/module/elasticsearch/ccr/ccr_test.go +++ b/metricbeat/module/elasticsearch/ccr/ccr_test.go @@ -41,7 +41,7 @@ func createEsMuxer(esVersion, license string, ccrEnabled bool) *http.ServeMux { if r.URL.Path != "/" { http.NotFound(w, r) } - w.Write([]byte(`{"version": { "number": "` + esVersion + `" } }`)) + w.Write([]byte(`{"name":"a14cf47ef7f2","cluster_name":"docker-cluster","cluster_uuid":"8l_zoGznQRmtoX9iSC-goA","version":{"number":"`+ esVersion + `","build_flavor":"default","build_type":"docker","build_hash":"43884496262f71aa3f33b34ac2f2271959dbf12a","build_date":"2020-10-28T09:54:14.068503Z","build_snapshot":true,"lucene_version":"8.7.0","minimum_wire_compatibility_version":"7.11.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"You Know, for Search"}`)) } licenseHandler := func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(`{ "license": { "type": "` + license + `" } }`)) From 3d881b679c297db1b40a57b210507963192d0f32 Mon Sep 17 00:00:00 2001 From: sayden Date: Thu, 19 Nov 2020 22:51:52 +0100 Subject: [PATCH 07/10] Fix lint in ccr_test.go --- metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json | 1 + metricbeat/module/elasticsearch/ccr/ccr_test.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json diff --git a/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json b/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json new file mode 100644 index 000000000000..669db5776f9b --- /dev/null +++ b/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json @@ -0,0 +1 @@ +{"name":"a14cf47ef7f2","cluster_name":"docker-cluster","cluster_uuid":"8l_zoGznQRmtoX9iSC-goA","version":{"number":"`+ esVersion + `","build_flavor":"default","build_type":"docker","build_hash":"43884496262f71aa3f33b34ac2f2271959dbf12a","build_date":"2020-10-28T09:54:14.068503Z","build_snapshot":true,"lucene_version":"8.7.0","minimum_wire_compatibility_version":"7.11.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"You Know, for Search"} diff --git a/metricbeat/module/elasticsearch/ccr/ccr_test.go b/metricbeat/module/elasticsearch/ccr/ccr_test.go index 6553f18f5a69..8fd7ac8e701d 100644 --- a/metricbeat/module/elasticsearch/ccr/ccr_test.go +++ b/metricbeat/module/elasticsearch/ccr/ccr_test.go @@ -18,6 +18,7 @@ package ccr import ( + "io/ioutil" "net/http" "net/http/httptest" "strconv" @@ -41,7 +42,9 @@ func createEsMuxer(esVersion, license string, ccrEnabled bool) *http.ServeMux { if r.URL.Path != "/" { http.NotFound(w, r) } - w.Write([]byte(`{"name":"a14cf47ef7f2","cluster_name":"docker-cluster","cluster_uuid":"8l_zoGznQRmtoX9iSC-goA","version":{"number":"`+ esVersion + `","build_flavor":"default","build_type":"docker","build_hash":"43884496262f71aa3f33b34ac2f2271959dbf12a","build_date":"2020-10-28T09:54:14.068503Z","build_snapshot":true,"lucene_version":"8.7.0","minimum_wire_compatibility_version":"7.11.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"You Know, for Search"}`)) + + input, _ := ioutil.ReadFile("./_meta/test/root.json") + w.Write(input) } licenseHandler := func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(`{ "license": { "type": "` + license + `" } }`)) From f0cb52553b3fa21ba7e581540bbdd165489e1a74 Mon Sep 17 00:00:00 2001 From: sayden Date: Thu, 19 Nov 2020 22:58:31 +0100 Subject: [PATCH 08/10] Fix typo --- metricbeat/module/elasticsearch/ccr/ccr_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metricbeat/module/elasticsearch/ccr/ccr_test.go b/metricbeat/module/elasticsearch/ccr/ccr_test.go index 8fd7ac8e701d..e7f4978eda7c 100644 --- a/metricbeat/module/elasticsearch/ccr/ccr_test.go +++ b/metricbeat/module/elasticsearch/ccr/ccr_test.go @@ -43,7 +43,7 @@ func createEsMuxer(esVersion, license string, ccrEnabled bool) *http.ServeMux { http.NotFound(w, r) } - input, _ := ioutil.ReadFile("./_meta/test/root.json") + input, _ := ioutil.ReadFile("./_meta/test/root.710.json") w.Write(input) } licenseHandler := func(w http.ResponseWriter, r *http.Request) { From d4cd1c2ddb1d7270dff97f985158b5a0b40a3dfd Mon Sep 17 00:00:00 2001 From: sayden Date: Thu, 19 Nov 2020 23:02:44 +0100 Subject: [PATCH 09/10] Fix typo in json file --- metricbeat/module/elasticsearch/ccr/_meta/data.json | 2 +- metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metricbeat/module/elasticsearch/ccr/_meta/data.json b/metricbeat/module/elasticsearch/ccr/_meta/data.json index 7c77d63339a6..7c022ace612c 100644 --- a/metricbeat/module/elasticsearch/ccr/_meta/data.json +++ b/metricbeat/module/elasticsearch/ccr/_meta/data.json @@ -102,7 +102,7 @@ "period": 10000 }, "service": { - "address": "127.0.0.1:49940", + "address": "127.0.0.1:53293", "name": "elasticsearch", "type": "elasticsearch" } diff --git a/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json b/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json index 669db5776f9b..f2dc2c05e746 100644 --- a/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json +++ b/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json @@ -1 +1 @@ -{"name":"a14cf47ef7f2","cluster_name":"docker-cluster","cluster_uuid":"8l_zoGznQRmtoX9iSC-goA","version":{"number":"`+ esVersion + `","build_flavor":"default","build_type":"docker","build_hash":"43884496262f71aa3f33b34ac2f2271959dbf12a","build_date":"2020-10-28T09:54:14.068503Z","build_snapshot":true,"lucene_version":"8.7.0","minimum_wire_compatibility_version":"7.11.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"You Know, for Search"} +{"name":"a14cf47ef7f2","cluster_name":"docker-cluster","cluster_uuid":"8l_zoGznQRmtoX9iSC-goA","version":{"number":"7.10.0","build_flavor":"default","build_type":"docker","build_hash":"43884496262f71aa3f33b34ac2f2271959dbf12a","build_date":"2020-10-28T09:54:14.068503Z","build_snapshot":true,"lucene_version":"8.7.0","minimum_wire_compatibility_version":"7.11.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"You Know, for Search"} From 227ef4a4d4bfa7ff7b345e2c0c48028ba8a70885 Mon Sep 17 00:00:00 2001 From: sayden Date: Fri, 20 Nov 2020 10:05:24 +0100 Subject: [PATCH 10/10] Fix broken test --- .../elasticsearch/ccr/_meta/test/root.710.json | 18 +++++++++++++++++- .../module/elasticsearch/ccr/ccr_test.go | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json b/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json index f2dc2c05e746..e83ec9204b4b 100644 --- a/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json +++ b/metricbeat/module/elasticsearch/ccr/_meta/test/root.710.json @@ -1 +1,17 @@ -{"name":"a14cf47ef7f2","cluster_name":"docker-cluster","cluster_uuid":"8l_zoGznQRmtoX9iSC-goA","version":{"number":"7.10.0","build_flavor":"default","build_type":"docker","build_hash":"43884496262f71aa3f33b34ac2f2271959dbf12a","build_date":"2020-10-28T09:54:14.068503Z","build_snapshot":true,"lucene_version":"8.7.0","minimum_wire_compatibility_version":"7.11.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"You Know, for Search"} +{ + "name": "a14cf47ef7f2", + "cluster_name": "docker-cluster", + "cluster_uuid": "8l_zoGznQRmtoX9iSC-goA", + "version": { + "number": "7.10.0", + "build_flavor": "default", + "build_type": "docker", + "build_hash": "43884496262f71aa3f33b34ac2f2271959dbf12a", + "build_date": "2020-10-28T09:54:14.068503Z", + "build_snapshot": true, + "lucene_version": "8.7.0", + "minimum_wire_compatibility_version": "7.11.0", + "minimum_index_compatibility_version": "7.0.0" + }, + "tagline": "You Know, for Search" +} diff --git a/metricbeat/module/elasticsearch/ccr/ccr_test.go b/metricbeat/module/elasticsearch/ccr/ccr_test.go index e7f4978eda7c..4890637de1b7 100644 --- a/metricbeat/module/elasticsearch/ccr/ccr_test.go +++ b/metricbeat/module/elasticsearch/ccr/ccr_test.go @@ -22,6 +22,7 @@ import ( "net/http" "net/http/httptest" "strconv" + "strings" "testing" "github.com/stretchr/testify/require" @@ -44,6 +45,7 @@ func createEsMuxer(esVersion, license string, ccrEnabled bool) *http.ServeMux { } input, _ := ioutil.ReadFile("./_meta/test/root.710.json") + input = []byte(strings.Replace(string(input), "7.10.0", esVersion, -1)) w.Write(input) } licenseHandler := func(w http.ResponseWriter, r *http.Request) {