diff --git a/.gitignore b/.gitignore index e470da31..b21b60c9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ elasticsearch_exporter *-stamp .tarballs /vendor +.idea diff --git a/collector/nodes.go b/collector/nodes.go index ba93a9b6..bb6029cf 100644 --- a/collector/nodes.go +++ b/collector/nodes.go @@ -1510,6 +1510,54 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no }, Labels: defaultNodeLabelValues, }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "ingest", "total_count"), + "Total number of ingest count", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.Ingest.Total.Count) + }, + Labels: defaultNodeLabelValues, + }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "ingest", "total_time_in_millis"), + "Total number of ingest time in millis", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.Ingest.Total.TimeInMillis) + }, + Labels: defaultNodeLabelValues, + }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "ingest", "total_current"), + "Total number of current ingest docs", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.Ingest.Total.Current) + }, + Labels: defaultNodeLabelValues, + }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "ingest", "total_failed"), + "Total number of ingest failed docs", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.Ingest.Total.Failed) + }, + Labels: defaultNodeLabelValues, + }, }, gcCollectionMetrics: []*gcCollectionMetric{ { diff --git a/collector/nodes_response.go b/collector/nodes_response.go index 4985add0..67288b24 100644 --- a/collector/nodes_response.go +++ b/collector/nodes_response.go @@ -40,6 +40,7 @@ type NodeStatsNodeResponse struct { HTTP map[string]interface{} `json:"http"` Transport NodeStatsTransportResponse `json:"transport"` Process NodeStatsProcessResponse `json:"process"` + Ingest NodeIngestResponse `json:"ingest"` } // NodeStatsBreakersResponse is a representation of a statistics about the field data circuit breaker @@ -384,3 +385,16 @@ type ClusterHealthResponse struct { TimedOut bool `json:"timed_out"` UnassignedShards int64 `json:"unassigned_shards"` } + +// NodeIngestResponse is a representation of a node ingest stats +type NodeIngestResponse struct { + Total NodeIngestStatsResponse `json:"total"` +} + +// NodeIngestStatsResponse is a representation of a node ingest stats +type NodeIngestStatsResponse struct { + Count int64 `json:"count"` + TimeInMillis int64 `json:"time_in_millis"` + Current int64 `json:"current"` + Failed int64 `json:"failed"` +}