|
96 | 96 | defaultRoleLabels = []string{"cluster", "host", "name"}
|
97 | 97 | defaultThreadPoolLabels = append(defaultNodeLabels, "type")
|
98 | 98 | defaultBreakerLabels = append(defaultNodeLabels, "breaker")
|
| 99 | + defaultIndexingPressureLabels = []string{"cluster", "host", "name", "indexing_pressure"} |
99 | 100 | defaultFilesystemDataLabels = append(defaultNodeLabels, "mount", "path")
|
100 | 101 | defaultFilesystemIODeviceLabels = append(defaultNodeLabels, "device")
|
101 | 102 | defaultCacheLabels = append(defaultNodeLabels, "cache")
|
@@ -150,6 +151,13 @@ type breakerMetric struct {
|
150 | 151 | Labels func(cluster string, node NodeStatsNodeResponse, breaker string) []string
|
151 | 152 | }
|
152 | 153 |
|
| 154 | +type indexingPressureMetric struct { |
| 155 | + Type prometheus.ValueType |
| 156 | + Desc *prometheus.Desc |
| 157 | + Value func(indexingPressureStats NodeStatsIndexingPressureResponse) float64 |
| 158 | + Labels func(cluster string, node NodeStatsNodeResponse, indexingPressure string) []string |
| 159 | +} |
| 160 | + |
153 | 161 | type threadPoolMetric struct {
|
154 | 162 | Type prometheus.ValueType
|
155 | 163 | Desc *prometheus.Desc
|
@@ -185,6 +193,7 @@ type Nodes struct {
|
185 | 193 | nodeMetrics []*nodeMetric
|
186 | 194 | gcCollectionMetrics []*gcCollectionMetric
|
187 | 195 | breakerMetrics []*breakerMetric
|
| 196 | + indexingPressureMetrics []*indexingPressureMetric |
188 | 197 | threadPoolMetrics []*threadPoolMetric
|
189 | 198 | filesystemDataMetrics []*filesystemDataMetric
|
190 | 199 | filesystemIODeviceMetrics []*filesystemIODeviceMetric
|
@@ -1607,6 +1616,46 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no
|
1607 | 1616 | },
|
1608 | 1617 | },
|
1609 | 1618 | },
|
| 1619 | + indexingPressureMetrics: []*indexingPressureMetric{ |
| 1620 | + { |
| 1621 | + Type: prometheus.GaugeValue, |
| 1622 | + Desc: prometheus.NewDesc( |
| 1623 | + prometheus.BuildFQName(namespace, "indexing_pressure", "current_all_in_bytes"), |
| 1624 | + "Memory consumed, in bytes, by indexing requests in the coordinating, primary, or replica stage.", |
| 1625 | + defaultIndexingPressureLabels, nil, |
| 1626 | + ), |
| 1627 | + Value: func(indexingPressureMem NodeStatsIndexingPressureResponse) float64 { |
| 1628 | + return float64(indexingPressureMem.Current.AllInBytes) |
| 1629 | + }, |
| 1630 | + Labels: func(cluster string, node NodeStatsNodeResponse, indexingPressure string) []string { |
| 1631 | + return []string{ |
| 1632 | + cluster, |
| 1633 | + node.Host, |
| 1634 | + node.Name, |
| 1635 | + indexingPressure, |
| 1636 | + } |
| 1637 | + }, |
| 1638 | + }, |
| 1639 | + { |
| 1640 | + Type: prometheus.GaugeValue, |
| 1641 | + Desc: prometheus.NewDesc( |
| 1642 | + prometheus.BuildFQName(namespace, "indexing_pressure", "limit_in_bytes"), |
| 1643 | + "Configured memory limit, in bytes, for the indexing requests", |
| 1644 | + defaultIndexingPressureLabels, nil, |
| 1645 | + ), |
| 1646 | + Value: func(indexingPressureStats NodeStatsIndexingPressureResponse) float64 { |
| 1647 | + return float64(indexingPressureStats.LimitInBytes) |
| 1648 | + }, |
| 1649 | + Labels: func(cluster string, node NodeStatsNodeResponse, indexingPressure string) []string { |
| 1650 | + return []string{ |
| 1651 | + cluster, |
| 1652 | + node.Host, |
| 1653 | + node.Name, |
| 1654 | + indexingPressure, |
| 1655 | + } |
| 1656 | + }, |
| 1657 | + }, |
| 1658 | + }, |
1610 | 1659 | threadPoolMetrics: []*threadPoolMetric{
|
1611 | 1660 | {
|
1612 | 1661 | Type: prometheus.CounterValue,
|
@@ -1919,6 +1968,18 @@ func (c *Nodes) Collect(ch chan<- prometheus.Metric) {
|
1919 | 1968 | }
|
1920 | 1969 | }
|
1921 | 1970 |
|
| 1971 | + // Indexing Pressure stats |
| 1972 | + for indexingPressure, ipstats := range node.IndexingPressure { |
| 1973 | + for _, metric := range c.indexingPressureMetrics { |
| 1974 | + ch <- prometheus.MustNewConstMetric( |
| 1975 | + metric.Desc, |
| 1976 | + metric.Type, |
| 1977 | + metric.Value(ipstats), |
| 1978 | + metric.Labels(nodeStatsResp.ClusterName, node, indexingPressure)..., |
| 1979 | + ) |
| 1980 | + } |
| 1981 | + } |
| 1982 | + |
1922 | 1983 | // Thread Pool stats
|
1923 | 1984 | for pool, pstats := range node.ThreadPool {
|
1924 | 1985 | for _, metric := range c.threadPoolMetrics {
|
|
0 commit comments