|
6 | 6 | "net/http"
|
7 | 7 | "net/url"
|
8 | 8 | "path"
|
| 9 | + "strconv" |
9 | 10 |
|
10 | 11 | "github.com/go-kit/kit/log"
|
11 | 12 | "github.com/go-kit/kit/log/level"
|
@@ -68,7 +69,7 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo
|
68 | 69 |
|
69 | 70 | shardLabels := labels{
|
70 | 71 | keys: func(...string) []string {
|
71 |
| - return []string{"index", "shard", "node", "cluster"} |
| 72 | + return []string{"index", "shard", "node", "primary", "cluster"} |
72 | 73 | },
|
73 | 74 | values: func(lastClusterinfo *clusterinfo.Response, s ...string) []string {
|
74 | 75 | if lastClusterinfo != nil {
|
@@ -970,6 +971,18 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo
|
970 | 971 | },
|
971 | 972 | Labels: shardLabels,
|
972 | 973 | },
|
| 974 | + { |
| 975 | + Type: prometheus.GaugeValue, |
| 976 | + Desc: prometheus.NewDesc( |
| 977 | + prometheus.BuildFQName(namespace, "indices", "shards_store_size_in_bytes"), |
| 978 | + "Store size of this shard", |
| 979 | + shardLabels.keys(), nil, |
| 980 | + ), |
| 981 | + Value: func(data IndexStatsIndexShardsDetailResponse) float64 { |
| 982 | + return float64(data.Store.SizeInBytes) |
| 983 | + }, |
| 984 | + Labels: shardLabels, |
| 985 | + }, |
973 | 986 | },
|
974 | 987 | }
|
975 | 988 |
|
@@ -1087,7 +1100,7 @@ func (i *Indices) Collect(ch chan<- prometheus.Metric) {
|
1087 | 1100 | metric.Desc,
|
1088 | 1101 | metric.Type,
|
1089 | 1102 | metric.Value(shard),
|
1090 |
| - metric.Labels.values(i.lastClusterInfo, indexName, shardNumber, shard.Routing.Node)..., |
| 1103 | + metric.Labels.values(i.lastClusterInfo, indexName, shardNumber, shard.Routing.Node, strconv.FormatBool(shard.Routing.Primary))..., |
1091 | 1104 | )
|
1092 | 1105 | }
|
1093 | 1106 | }
|
|
0 commit comments