Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ingest total metrics #617

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ elasticsearch_exporter
*-stamp
.tarballs
/vendor
.idea
48 changes: 48 additions & 0 deletions collector/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
zengxilong marked this conversation as resolved.
Show resolved Hide resolved
"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(
zengxilong marked this conversation as resolved.
Show resolved Hide resolved
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"),
zengxilong marked this conversation as resolved.
Show resolved Hide resolved
"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"),
zengxilong marked this conversation as resolved.
Show resolved Hide resolved
"Total number of ingest failed docs",
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.Ingest.Total.Failed)
},
Labels: defaultNodeLabelValues,
},
},
gcCollectionMetrics: []*gcCollectionMetric{
{
Expand Down
14 changes: 14 additions & 0 deletions collector/nodes_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"`
}