Skip to content

added external refresh stats #933

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

Merged
merged 9 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 24 additions & 0 deletions collector/indices.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,30 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo
},
Labels: indexLabels,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "index_stats", "refresh_external_time_seconds_total"),
"Total external refresh time in seconds",
indexLabels.keys(), nil,
),
Value: func(indexStats IndexStatsIndexResponse) float64 {
return float64(indexStats.Total.Refresh.ExternalTotalTimeInMillis) / 1000
},
Labels: indexLabels,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "index_stats", "refresh_external_total"),
"Total external refresh count",
indexLabels.keys(), nil,
),
Value: func(indexStats IndexStatsIndexResponse) float64 {
return float64(indexStats.Total.Refresh.ExternalTotal)
},
Labels: indexLabels,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
Expand Down
8 changes: 5 additions & 3 deletions collector/indices_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ type IndexStatsIndexMergesResponse struct {

// IndexStatsIndexRefreshResponse defines index stats index refresh information structure
type IndexStatsIndexRefreshResponse struct {
Total int64 `json:"total"`
TotalTimeInMillis int64 `json:"total_time_in_millis"`
Listeners int64 `json:"listeners"`
Total int64 `json:"total"`
TotalTimeInMillis int64 `json:"total_time_in_millis"`
ExternalTotal int64 `json:"external_total"`
ExternalTotalTimeInMillis int64 `json:"external_total_time_in_millis"`
Listeners int64 `json:"listeners"`
}

// IndexStatsIndexFlushResponse defines index stats index flush information structure
Expand Down
24 changes: 24 additions & 0 deletions collector/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,30 @@ 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, "indices_refresh", "external_total"),
"Total external refreshes",
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.Indices.Refresh.ExternalTotal)
},
Labels: defaultNodeLabelValues,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "indices_refresh", "external_time_seconds_total"),
"Total time spent external refreshing in seconds",
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.Indices.Refresh.ExternalTotalTimeInMillis) / 1000
},
Labels: defaultNodeLabelValues,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
Expand Down
6 changes: 4 additions & 2 deletions collector/nodes_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,10 @@ type NodeStatsIndicesDocsResponse struct {

// NodeStatsIndicesRefreshResponse defines node stats refresh information structure for indices
type NodeStatsIndicesRefreshResponse struct {
Total int64 `json:"total"`
TotalTime int64 `json:"total_time_in_millis"`
Total int64 `json:"total"`
TotalTime int64 `json:"total_time_in_millis"`
ExternalTotal int64 `json:"external_total"`
ExternalTotalTimeInMillis int64 `json:"external_total_time_in_millis"`
}

// NodeStatsIndicesTranslogResponse defines node stats translog information structure for indices
Expand Down