@@ -171,6 +171,13 @@ type filesystemIODeviceMetric struct {
171171	Labels  func (cluster  string , node  NodeStatsNodeResponse , device  string ) []string 
172172}
173173
174+ type  indexingPressureMetric  struct  {
175+ 	Type    prometheus.ValueType 
176+ 	Desc    * prometheus.Desc 
177+ 	Value   func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64 
178+ 	Labels  func (cluster  string , node  NodeStatsNodeResponse ) []string 
179+ }
180+ 
174181// Nodes information struct 
175182type  Nodes  struct  {
176183	logger  log.Logger 
@@ -188,6 +195,7 @@ type Nodes struct {
188195	threadPoolMetrics          []* threadPoolMetric 
189196	filesystemDataMetrics      []* filesystemDataMetric 
190197	filesystemIODeviceMetrics  []* filesystemIODeviceMetric 
198+ 	indexingPressureMetrics    []* indexingPressureMetric 
191199}
192200
193201// NewNodes defines Nodes Prometheus metrics 
@@ -1781,6 +1789,176 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no
17811789				Labels : defaultFilesystemIODeviceLabelValues ,
17821790			},
17831791		},
1792+ 		indexingPressureMetrics : []* indexingPressureMetric {
1793+ 			{
1794+ 				Type : prometheus .GaugeValue ,
1795+ 				Desc : prometheus .NewDesc (
1796+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "current_combined_coordinating_and_primary_in_bytes" ),
1797+ 					"Memory consumed, in bytes, by indexing requests in the coordinating or primary stage." ,
1798+ 					defaultNodeLabels , nil ,
1799+ 				),
1800+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1801+ 					return  float64 (indexingPressureMem .Current .CombinedCoordinatingAndPrimaryInBytes )
1802+ 				},
1803+ 				Labels : defaultNodeLabelValues ,
1804+ 			},
1805+ 			{
1806+ 				Type : prometheus .GaugeValue ,
1807+ 				Desc : prometheus .NewDesc (
1808+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "current_coordinating_in_bytes" ),
1809+ 					"Memory consumed, in bytes, by indexing requests in the coordinating stage." ,
1810+ 					defaultNodeLabels , nil ,
1811+ 				),
1812+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1813+ 					return  float64 (indexingPressureMem .Current .CoordinatingInBytes )
1814+ 				},
1815+ 				Labels : defaultNodeLabelValues ,
1816+ 			},
1817+ 			{
1818+ 				Type : prometheus .GaugeValue ,
1819+ 				Desc : prometheus .NewDesc (
1820+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "current_primary_in_bytes" ),
1821+ 					"Memory consumed, in bytes, by indexing requests in the primary stage." ,
1822+ 					defaultNodeLabels , nil ,
1823+ 				),
1824+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1825+ 					return  float64 (indexingPressureMem .Current .PrimaryInBytes )
1826+ 				},
1827+ 				Labels : defaultNodeLabelValues ,
1828+ 			},
1829+ 			{
1830+ 				Type : prometheus .GaugeValue ,
1831+ 				Desc : prometheus .NewDesc (
1832+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "current_replica_in_bytes" ),
1833+ 					"Memory consumed, in bytes, by indexing requests in the replica stage." ,
1834+ 					defaultNodeLabels , nil ,
1835+ 				),
1836+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1837+ 					return  float64 (indexingPressureMem .Current .ReplicaInBytes )
1838+ 				},
1839+ 				Labels : defaultNodeLabelValues ,
1840+ 			},
1841+ 			{
1842+ 				Type : prometheus .GaugeValue ,
1843+ 				Desc : prometheus .NewDesc (
1844+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "current_all_in_bytes" ),
1845+ 					"Memory consumed, in bytes, by indexing requests in the coordinating, primary, or replica stage." ,
1846+ 					defaultNodeLabels , nil ,
1847+ 				),
1848+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1849+ 					return  float64 (indexingPressureMem .Current .ReplicaInBytes )
1850+ 				},
1851+ 				Labels : defaultNodeLabelValues ,
1852+ 			},
1853+ 			{
1854+ 				Type : prometheus .CounterValue ,
1855+ 				Desc : prometheus .NewDesc (
1856+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_combined_coordinating_and_primary_in_bytes" ),
1857+ 					"Memory consumed, in bytes, by indexing requests in the coordinating or primary stage." ,
1858+ 					defaultNodeLabels , nil ,
1859+ 				),
1860+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1861+ 					return  float64 (indexingPressureMem .Total .CombinedCoordinatingAndPrimaryInBytes )
1862+ 				},
1863+ 				Labels : defaultNodeLabelValues ,
1864+ 			},
1865+ 			{
1866+ 				Type : prometheus .CounterValue ,
1867+ 				Desc : prometheus .NewDesc (
1868+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_coordinating_in_bytes" ),
1869+ 					"Memory consumed, in bytes, by indexing requests in the coordinating stage." ,
1870+ 					defaultNodeLabels , nil ,
1871+ 				),
1872+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1873+ 					return  float64 (indexingPressureMem .Total .CoordinatingInBytes )
1874+ 				},
1875+ 				Labels : defaultNodeLabelValues ,
1876+ 			},
1877+ 			{
1878+ 				Type : prometheus .CounterValue ,
1879+ 				Desc : prometheus .NewDesc (
1880+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_primary_in_bytes" ),
1881+ 					"Memory consumed, in bytes, by indexing requests in the primary stage." ,
1882+ 					defaultNodeLabels , nil ,
1883+ 				),
1884+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1885+ 					return  float64 (indexingPressureMem .Total .PrimaryInBytes )
1886+ 				},
1887+ 				Labels : defaultNodeLabelValues ,
1888+ 			},
1889+ 			{
1890+ 				Type : prometheus .CounterValue ,
1891+ 				Desc : prometheus .NewDesc (
1892+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_replica_in_bytes" ),
1893+ 					"Memory consumed, in bytes, by indexing requests in the replica stage." ,
1894+ 					defaultNodeLabels , nil ,
1895+ 				),
1896+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1897+ 					return  float64 (indexingPressureMem .Total .ReplicaInBytes )
1898+ 				},
1899+ 				Labels : defaultNodeLabelValues ,
1900+ 			},
1901+ 			{
1902+ 				Type : prometheus .CounterValue ,
1903+ 				Desc : prometheus .NewDesc (
1904+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_all_in_bytes" ),
1905+ 					"Memory consumed, in bytes, by indexing requests in the coordinating, primary, or replica stage." ,
1906+ 					defaultNodeLabels , nil ,
1907+ 				),
1908+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1909+ 					return  float64 (indexingPressureMem .Total .AllInBytes )
1910+ 				},
1911+ 				Labels : defaultNodeLabelValues ,
1912+ 			},
1913+ 			{
1914+ 				Type : prometheus .CounterValue ,
1915+ 				Desc : prometheus .NewDesc (
1916+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_coordinating_rejections" ),
1917+ 					"Number of indexing requests rejected in the coordinating stage." ,
1918+ 					defaultNodeLabels , nil ,
1919+ 				),
1920+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1921+ 					return  float64 (indexingPressureMem .Total .CoordinatingRejections )
1922+ 				},
1923+ 				Labels : defaultNodeLabelValues ,
1924+ 			},
1925+ 			{
1926+ 				Type : prometheus .CounterValue ,
1927+ 				Desc : prometheus .NewDesc (
1928+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_primary_rejections" ),
1929+ 					"Number of indexing requests rejected in the primary stage." ,
1930+ 					defaultNodeLabels , nil ,
1931+ 				),
1932+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1933+ 					return  float64 (indexingPressureMem .Total .PrimaryRejections )
1934+ 				},
1935+ 				Labels : defaultNodeLabelValues ,
1936+ 			},
1937+ 			{
1938+ 				Type : prometheus .CounterValue ,
1939+ 				Desc : prometheus .NewDesc (
1940+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "total_replica_rejections" ),
1941+ 					"Number of indexing requests rejected in the replica stage." ,
1942+ 					defaultNodeLabels , nil ,
1943+ 				),
1944+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1945+ 					return  float64 (indexingPressureMem .Total .ReplicaRejections )
1946+ 				},
1947+ 				Labels : defaultNodeLabelValues ,
1948+ 			},
1949+ 			{
1950+ 				Type : prometheus .CounterValue ,
1951+ 				Desc : prometheus .NewDesc (
1952+ 					prometheus .BuildFQName (namespace , "indexing_pressure" , "limit_in_bytes" ),
1953+ 					"Configured memory limit, in bytes, for the indexing requests. Replica requests have an automatic limit that is 1.5x this value." ,
1954+ 					defaultNodeLabels , nil ,
1955+ 				),
1956+ 				Value : func (indexingPressureMem  NodestatsIndexingPressureMemoryResponse ) float64  {
1957+ 					return  float64 (indexingPressureMem .LimitInBytes )
1958+ 				},
1959+ 				Labels : defaultNodeLabelValues ,
1960+ 			},
1961+ 		},
17841962	}
17851963}
17861964
@@ -1801,6 +1979,9 @@ func (c *Nodes) Describe(ch chan<- *prometheus.Desc) {
18011979	for  _ , metric  :=  range  c .filesystemIODeviceMetrics  {
18021980		ch  <-  metric .Desc 
18031981	}
1982+ 	for  _ , metric  :=  range  c .indexingPressureMetrics  {
1983+ 		ch  <-  metric .Desc 
1984+ 	}
18041985	ch  <-  c .up .Desc ()
18051986	ch  <-  c .totalScrapes .Desc ()
18061987	ch  <-  c .jsonParseFailures .Desc ()
@@ -1955,5 +2136,18 @@ func (c *Nodes) Collect(ch chan<- prometheus.Metric) {
19552136			}
19562137		}
19572138
2139+ 		// indexing_pressure Stats  https://github.com/prometheus-community/elasticsearch_exporter/issues/638 
2140+ 		// https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-indexing-pressure.html 
2141+ 		for  _ , indexingPressureMem  :=  range  node .IndexingPressure  {
2142+ 			for  _ , metric  :=  range  c .indexingPressureMetrics  {
2143+ 				ch  <-  prometheus .MustNewConstMetric (
2144+ 					metric .Desc ,
2145+ 					metric .Type ,
2146+ 					metric .Value (indexingPressureMem ),
2147+ 					metric .Labels (nodeStatsResp .ClusterName , node )... ,
2148+ 				)
2149+ 			}
2150+ 		}
2151+ 
19582152	}
19592153}
0 commit comments