Skip to content

Commit

Permalink
elasticsearch module - xpack enabled parity (#29548)
Browse files Browse the repository at this point in the history
* elasticsearch module - xpack enabled parity

* flip ActiveOnly default

* add ml_job's node

* lint

* update shard cluster's state path

* add back state.id to prevent breaking changes
  • Loading branch information
klacabane authored Dec 23, 2021
1 parent 78e1c58 commit 0bfa0a1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
config := struct {
ActiveOnly bool `config:"index_recovery.active_only"`
}{
ActiveOnly: true,
ActiveOnly: false,
}
if err := base.Module().UnpackConfig(&config); err != nil {
return nil, err
Expand Down
5 changes: 3 additions & 2 deletions metricbeat/module/elasticsearch/ml_job/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
}
},
"node": {
"id": "27fb1c2fd783"
"id": "27fb1c2fd783",
"name": "node-1"
}
},
"event": {
Expand All @@ -39,4 +40,4 @@
"name": "elasticsearch",
"type": "elasticsearch"
}
}
}
7 changes: 6 additions & 1 deletion metricbeat/module/elasticsearch/ml_job/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ func eventsMapping(r mb.ReporterV2, info elasticsearch.Info, content []byte, isX
event.ModuleFields = common.MapStr{}
event.ModuleFields.Put("cluster.name", info.ClusterName)
event.ModuleFields.Put("cluster.id", info.ClusterID)
event.ModuleFields.Put("node.id", info.Name)

if node, exists := job["node"]; exists {
nodeHash := node.(map[string]interface{})
event.ModuleFields.Put("node.id", nodeHash["id"])
event.ModuleFields.Put("node.name", nodeHash["name"])
}

event.MetricSetFields, _ = schema.Apply(job)

Expand Down
7 changes: 6 additions & 1 deletion metricbeat/module/elasticsearch/shard/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"name": "docker-cluster",
"state": {
"id": "XNIdeSZxQwyItvGfR5fHSw"
},
"stats": {
"state": {
"state_uuid": "XNIdeSZxQwyItvGfR5fHSw"
}
}
},
"index": {
Expand Down Expand Up @@ -41,4 +46,4 @@
"address": "172.19.0.2:9200",
"type": "elasticsearch"
}
}
}
2 changes: 2 additions & 0 deletions metricbeat/module/elasticsearch/shard/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func eventsMapping(r mb.ReporterV2, content []byte, isXpack bool) error {
}

event.ModuleFields.Put("cluster.state.id", stateData.StateID)
event.ModuleFields.Put("cluster.stats.state.state_uuid", stateData.StateID)
event.ModuleFields.Put("cluster.id", stateData.ClusterID)
event.ModuleFields.Put("cluster.name", stateData.ClusterName)

Expand Down Expand Up @@ -117,6 +118,7 @@ func eventsMapping(r mb.ReporterV2, content []byte, isXpack bool) error {
errs = append(errs, errors.Wrap(err, "failure getting source node information"))
continue
}
event.ModuleFields.Put("node.name", sourceNode["name"])
event.MetricSetFields.Put("source_node", sourceNode)
}

Expand Down

0 comments on commit 0bfa0a1

Please sign in to comment.