Skip to content

Commit a4f94e5

Browse files
authored
added external refresh stats (#933)
Signed-off-by: Tamara Bernshtein <[email protected]> Signed-off-by: TomaBere <[email protected]>
1 parent 5c8fca8 commit a4f94e5

File tree

4 files changed

+57
-5
lines changed

4 files changed

+57
-5
lines changed

collector/indices.go

+24
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,30 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo
803803
},
804804
Labels: indexLabels,
805805
},
806+
{
807+
Type: prometheus.CounterValue,
808+
Desc: prometheus.NewDesc(
809+
prometheus.BuildFQName(namespace, "index_stats", "refresh_external_time_seconds_total"),
810+
"Total external refresh time in seconds",
811+
indexLabels.keys(), nil,
812+
),
813+
Value: func(indexStats IndexStatsIndexResponse) float64 {
814+
return float64(indexStats.Total.Refresh.ExternalTotalTimeInMillis) / 1000
815+
},
816+
Labels: indexLabels,
817+
},
818+
{
819+
Type: prometheus.CounterValue,
820+
Desc: prometheus.NewDesc(
821+
prometheus.BuildFQName(namespace, "index_stats", "refresh_external_total"),
822+
"Total external refresh count",
823+
indexLabels.keys(), nil,
824+
),
825+
Value: func(indexStats IndexStatsIndexResponse) float64 {
826+
return float64(indexStats.Total.Refresh.ExternalTotal)
827+
},
828+
Labels: indexLabels,
829+
},
806830
{
807831
Type: prometheus.CounterValue,
808832
Desc: prometheus.NewDesc(

collector/indices_response.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ type IndexStatsIndexMergesResponse struct {
145145

146146
// IndexStatsIndexRefreshResponse defines index stats index refresh information structure
147147
type IndexStatsIndexRefreshResponse struct {
148-
Total int64 `json:"total"`
149-
TotalTimeInMillis int64 `json:"total_time_in_millis"`
150-
Listeners int64 `json:"listeners"`
148+
Total int64 `json:"total"`
149+
TotalTimeInMillis int64 `json:"total_time_in_millis"`
150+
ExternalTotal int64 `json:"external_total"`
151+
ExternalTotalTimeInMillis int64 `json:"external_total_time_in_millis"`
152+
Listeners int64 `json:"listeners"`
151153
}
152154

153155
// IndexStatsIndexFlushResponse defines index stats index flush information structure

collector/nodes.go

+24
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,30 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no
630630
},
631631
Labels: defaultNodeLabelValues,
632632
},
633+
{
634+
Type: prometheus.CounterValue,
635+
Desc: prometheus.NewDesc(
636+
prometheus.BuildFQName(namespace, "indices_refresh", "external_total"),
637+
"Total external refreshes",
638+
defaultNodeLabels, nil,
639+
),
640+
Value: func(node NodeStatsNodeResponse) float64 {
641+
return float64(node.Indices.Refresh.ExternalTotal)
642+
},
643+
Labels: defaultNodeLabelValues,
644+
},
645+
{
646+
Type: prometheus.CounterValue,
647+
Desc: prometheus.NewDesc(
648+
prometheus.BuildFQName(namespace, "indices_refresh", "external_time_seconds_total"),
649+
"Total time spent external refreshing in seconds",
650+
defaultNodeLabels, nil,
651+
),
652+
Value: func(node NodeStatsNodeResponse) float64 {
653+
return float64(node.Indices.Refresh.ExternalTotalTimeInMillis) / 1000
654+
},
655+
Labels: defaultNodeLabelValues,
656+
},
633657
{
634658
Type: prometheus.CounterValue,
635659
Desc: prometheus.NewDesc(

collector/nodes_response.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ type NodeStatsIndicesDocsResponse struct {
172172

173173
// NodeStatsIndicesRefreshResponse defines node stats refresh information structure for indices
174174
type NodeStatsIndicesRefreshResponse struct {
175-
Total int64 `json:"total"`
176-
TotalTime int64 `json:"total_time_in_millis"`
175+
Total int64 `json:"total"`
176+
TotalTime int64 `json:"total_time_in_millis"`
177+
ExternalTotal int64 `json:"external_total"`
178+
ExternalTotalTimeInMillis int64 `json:"external_total_time_in_millis"`
177179
}
178180

179181
// NodeStatsIndicesTranslogResponse defines node stats translog information structure for indices

0 commit comments

Comments
 (0)