fix: IIS Collector fails, when Application has more than one worker processes (#132)

* fix collecting error with multiple IIS application worker processes
This commit is contained in:
Yuriy Revich
2017-11-13 12:41:35 +03:00
committed by Calle Pettersson
parent 69c1d0faad
commit 105a1c866b

View File

@@ -415,223 +415,223 @@ func NewIISCollector() (Collector, error) {
ActiveFlushedEntries: prometheus.NewDesc( ActiveFlushedEntries: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_cache_active_flushed_entries"), prometheus.BuildFQName(Namespace, subsystem, "worker_cache_active_flushed_entries"),
"Number of file handles cached in user-mode that will be closed when all current transfers complete.", "Number of file handles cached in user-mode that will be closed when all current transfers complete.",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
FileCacheMemoryUsage: prometheus.NewDesc( FileCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_memory_bytes"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_memory_bytes"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
MaximumFileCacheMemoryUsage: prometheus.NewDesc( MaximumFileCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_max_memory_bytes"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_max_memory_bytes"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
FileCacheFlushesTotal: prometheus.NewDesc( FileCacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_flushes_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_flushes_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
FileCacheQueriesTotal: prometheus.NewDesc( FileCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_queries_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_queries_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
FileCacheHitsTotal: prometheus.NewDesc( FileCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_hits_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_hits_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
FilesCached: prometheus.NewDesc( FilesCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
FilesCachedTotal: prometheus.NewDesc( FilesCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
FilesFlushedTotal: prometheus.NewDesc( FilesFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items_flushed_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items_flushed_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
URICacheFlushesTotal: prometheus.NewDesc( URICacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_flushes_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_flushes_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
URICacheQueriesTotal: prometheus.NewDesc( URICacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_queries_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_queries_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
URICacheHitsTotal: prometheus.NewDesc( URICacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_hits_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_hits_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
URIsCached: prometheus.NewDesc( URIsCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items"), prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
URIsCachedTotal: prometheus.NewDesc( URIsCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
URIsFlushedTotal: prometheus.NewDesc( URIsFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items_flushed_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items_flushed_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
MetadataCached: prometheus.NewDesc( MetadataCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items"), prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
MetadataCacheFlushes: prometheus.NewDesc( MetadataCacheFlushes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_flushes_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_flushes_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
MetadataCacheQueriesTotal: prometheus.NewDesc( MetadataCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_queries_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_queries_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
MetadataCacheHitsTotal: prometheus.NewDesc( MetadataCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_hits_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_hits_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
MetadataCachedTotal: prometheus.NewDesc( MetadataCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items_cached_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items_cached_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
MetadataFlushedTotal: prometheus.NewDesc( MetadataFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items_flushed_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items_flushed_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
OutputCacheActiveFlushedItems: prometheus.NewDesc( OutputCacheActiveFlushedItems: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_active_flushed_items"), prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_active_flushed_items"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
OutputCacheItems: prometheus.NewDesc( OutputCacheItems: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_items"), prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_items"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
OutputCacheMemoryUsage: prometheus.NewDesc( OutputCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_memory_bytes"), prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_memory_bytes"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
OutputCacheQueriesTotal: prometheus.NewDesc( OutputCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_queries_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_output_queries_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
OutputCacheHitsTotal: prometheus.NewDesc( OutputCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_hits_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_hits_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
OutputCacheFlushedItemsTotal: prometheus.NewDesc( OutputCacheFlushedItemsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_items_flushed_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_items_flushed_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
OutputCacheFlushesTotal: prometheus.NewDesc( OutputCacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_flushes_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_flushes_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
Threads: prometheus.NewDesc( Threads: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_threads"), prometheus.BuildFQName(Namespace, subsystem, "worker_threads"),
"", "",
[]string{"app", "state"}, []string{"app", "pid", "state"},
nil, nil,
), ),
MaximumThreads: prometheus.NewDesc( MaximumThreads: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_max_threads"), prometheus.BuildFQName(Namespace, subsystem, "worker_max_threads"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
RequestsTotal: prometheus.NewDesc( RequestsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_requests_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_requests_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
RequestsActive: prometheus.NewDesc( RequestsActive: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_current_requests"), prometheus.BuildFQName(Namespace, subsystem, "worker_current_requests"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
RequestErrorsTotal: prometheus.NewDesc( RequestErrorsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_request_errors_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_request_errors_total"),
"", "",
[]string{"app", "status_code"}, []string{"app", "pid", "status_code"},
nil, nil,
), ),
WebSocketRequestsActive: prometheus.NewDesc( WebSocketRequestsActive: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_current_websocket_requests"), prometheus.BuildFQName(Namespace, subsystem, "worker_current_websocket_requests"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
WebSocketConnectionAttempts: prometheus.NewDesc( WebSocketConnectionAttempts: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_attempts_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_attempts_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
WebSocketConnectionsAccepted: prometheus.NewDesc( WebSocketConnectionsAccepted: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_accepted_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_accepted_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
WebSocketConnectionsRejected: prometheus.NewDesc( WebSocketConnectionsRejected: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_rejected_total"), prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_rejected_total"),
"", "",
[]string{"app"}, []string{"app", "pid"},
nil, nil,
), ),
@@ -991,7 +991,7 @@ var ApplicationStates = map[uint32]string{
} }
// W3SVCW3WPCounterProvider_W3SVCW3WP returns names prefixed with pid // W3SVCW3WPCounterProvider_W3SVCW3WP returns names prefixed with pid
var workerProcessNameExtractor = regexp.MustCompile(`^\d+_(.+)$`) var workerProcessNameExtractor = regexp.MustCompile(`^(\d+)_(.+)$`)
func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) { func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_W3SVC_WebService var dst []Win32_PerfRawData_W3SVC_WebService
@@ -1371,18 +1371,21 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
} }
for _, app := range dst_worker { for _, app := range dst_worker {
// Extract the apppool name from the format <PID>_<NAME> // Extract the apppool name from the format <PID>_<NAME>
name := workerProcessNameExtractor.ReplaceAllString(app.Name, "$1") name := workerProcessNameExtractor.ReplaceAllString(app.Name, "$2")
if name == "_Total" || if name == "_Total" ||
c.appBlacklistPattern.MatchString(name) || c.appBlacklistPattern.MatchString(name) ||
!c.appWhitelistPattern.MatchString(name) { !c.appWhitelistPattern.MatchString(name) {
continue continue
} }
pid := workerProcessNameExtractor.ReplaceAllString(app.Name, "$1")
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ActiveFlushedEntries, c.ActiveFlushedEntries,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(app.ActiveFlushedEntries), float64(app.ActiveFlushedEntries),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1390,6 +1393,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.GaugeValue, prometheus.GaugeValue,
float64(app.CurrentFileCacheMemoryUsage), float64(app.CurrentFileCacheMemoryUsage),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1397,6 +1401,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.MaximumFileCacheMemoryUsage), float64(app.MaximumFileCacheMemoryUsage),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1404,6 +1409,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalFlushedFiles), float64(app.TotalFlushedFiles),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1411,12 +1417,14 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.FileCacheHits+app.FileCacheMisses), float64(app.FileCacheHits+app.FileCacheMisses),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FileCacheHitsTotal, c.FileCacheHitsTotal,
prometheus.CounterValue, prometheus.CounterValue,
float64(app.FileCacheHits), float64(app.FileCacheHits),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1424,6 +1432,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.GaugeValue, prometheus.GaugeValue,
float64(app.CurrentFilesCached), float64(app.CurrentFilesCached),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1431,6 +1440,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalFilesCached), float64(app.TotalFilesCached),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1438,6 +1448,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalFlushedFiles), float64(app.TotalFlushedFiles),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1445,12 +1456,14 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalFlushedURIs), float64(app.TotalFlushedURIs),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.URICacheQueriesTotal, c.URICacheQueriesTotal,
prometheus.CounterValue, prometheus.CounterValue,
float64(app.URICacheHits+app.URICacheMisses), float64(app.URICacheHits+app.URICacheMisses),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1458,6 +1471,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.URICacheHits), float64(app.URICacheHits),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1465,6 +1479,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.GaugeValue, prometheus.GaugeValue,
float64(app.CurrentURIsCached), float64(app.CurrentURIsCached),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1472,6 +1487,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalURIsCached), float64(app.TotalURIsCached),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1479,6 +1495,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalFlushedURIs), float64(app.TotalFlushedURIs),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1486,6 +1503,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.GaugeValue, prometheus.GaugeValue,
float64(app.CurrentMetadataCached), float64(app.CurrentMetadataCached),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1493,6 +1511,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalFlushedMetadata), float64(app.TotalFlushedMetadata),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1500,6 +1519,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.MetadataCacheHits+app.MetadataCacheMisses), float64(app.MetadataCacheHits+app.MetadataCacheMisses),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1507,6 +1527,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.MetadataCacheHits), float64(app.MetadataCacheHits),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1514,6 +1535,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalMetadataCached), float64(app.TotalMetadataCached),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1521,6 +1543,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalFlushedMetadata), float64(app.TotalFlushedMetadata),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1528,6 +1551,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.OutputCacheCurrentFlushedItems), float64(app.OutputCacheCurrentFlushedItems),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1535,6 +1559,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.OutputCacheCurrentItems), float64(app.OutputCacheCurrentItems),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1542,6 +1567,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.OutputCacheCurrentMemoryUsage), float64(app.OutputCacheCurrentMemoryUsage),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1549,6 +1575,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.OutputCacheTotalHits+app.OutputCacheTotalMisses), float64(app.OutputCacheTotalHits+app.OutputCacheTotalMisses),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1556,6 +1583,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.OutputCacheTotalHits), float64(app.OutputCacheTotalHits),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1563,6 +1591,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.OutputCacheTotalFlushedItems), float64(app.OutputCacheTotalFlushedItems),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1570,6 +1599,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.OutputCacheTotalFlushes), float64(app.OutputCacheTotalFlushes),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1577,6 +1607,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.GaugeValue, prometheus.GaugeValue,
float64(app.ActiveThreadsCount), float64(app.ActiveThreadsCount),
name, name,
pid,
"busy", "busy",
) )
@@ -1585,6 +1616,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.GaugeValue, prometheus.GaugeValue,
float64(app.TotalThreads), float64(app.TotalThreads),
name, name,
pid,
"idle", "idle",
) )
@@ -1593,6 +1625,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.MaximumThreadsCount), float64(app.MaximumThreadsCount),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1600,6 +1633,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.TotalHTTPRequestsServed), float64(app.TotalHTTPRequestsServed),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1607,6 +1641,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.ActiveRequests), float64(app.ActiveRequests),
name, name,
pid,
) )
} }
@@ -1618,18 +1653,21 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
} }
for _, app := range dst_worker_iis8 { for _, app := range dst_worker_iis8 {
// Extract the apppool name from the format <PID>_<NAME> // Extract the apppool name from the format <PID>_<NAME>
name := workerProcessNameExtractor.ReplaceAllString(app.Name, "$1") name := workerProcessNameExtractor.ReplaceAllString(app.Name, "$2")
if name == "_Total" || if name == "_Total" ||
c.appBlacklistPattern.MatchString(name) || c.appBlacklistPattern.MatchString(name) ||
!c.appWhitelistPattern.MatchString(name) { !c.appWhitelistPattern.MatchString(name) {
continue continue
} }
pid := workerProcessNameExtractor.ReplaceAllString(app.Name, "$1")
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RequestErrorsTotal, c.RequestErrorsTotal,
prometheus.CounterValue, prometheus.CounterValue,
float64(app.Percent401HTTPResponseSent), float64(app.Percent401HTTPResponseSent),
name, name,
pid,
"401", "401",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1637,6 +1675,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.Percent403HTTPResponseSent), float64(app.Percent403HTTPResponseSent),
name, name,
pid,
"403", "403",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1644,6 +1683,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.Percent404HTTPResponseSent), float64(app.Percent404HTTPResponseSent),
name, name,
pid,
"404", "404",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1651,6 +1691,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.Percent500HTTPResponseSent), float64(app.Percent500HTTPResponseSent),
name, name,
pid,
"500", "500",
) )
@@ -1659,6 +1700,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.WebSocketActiveRequests), float64(app.WebSocketActiveRequests),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1666,6 +1708,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.WebSocketConnectionAttemptsPerSec), float64(app.WebSocketConnectionAttemptsPerSec),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1673,6 +1716,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.WebSocketConnectionsAcceptedPerSec), float64(app.WebSocketConnectionsAcceptedPerSec),
name, name,
pid,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -1680,6 +1724,7 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
prometheus.CounterValue, prometheus.CounterValue,
float64(app.WebSocketConnectionsRejectedPerSec), float64(app.WebSocketConnectionsRejectedPerSec),
name, name,
pid,
) )
} }
} }