chore: Remove registry based perfdata collector (#1742)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2024-11-17 21:51:12 +01:00
committed by GitHub
parent 6206b695c6
commit e6a15d4ec4
213 changed files with 8079 additions and 12405 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,265 @@
//go:build windows
package iis
import (
"fmt"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)
type collectorAppPoolWAS struct {
perfDataCollectorAppPoolWAS *perfdata.Collector
currentApplicationPoolState *prometheus.Desc
currentApplicationPoolUptime *prometheus.Desc
currentWorkerProcesses *prometheus.Desc
maximumWorkerProcesses *prometheus.Desc
recentWorkerProcessFailures *prometheus.Desc
timeSinceLastWorkerProcessFailure *prometheus.Desc
totalApplicationPoolRecycles *prometheus.Desc
totalApplicationPoolUptime *prometheus.Desc
totalWorkerProcessesCreated *prometheus.Desc
totalWorkerProcessFailures *prometheus.Desc
totalWorkerProcessPingFailures *prometheus.Desc
totalWorkerProcessShutdownFailures *prometheus.Desc
totalWorkerProcessStartupFailures *prometheus.Desc
}
const (
CurrentApplicationPoolState = "Current Application Pool State"
CurrentApplicationPoolUptime = "Current Application Pool Uptime"
CurrentWorkerProcesses = "Current Worker Processes"
MaximumWorkerProcesses = "Maximum Worker Processes"
RecentWorkerProcessFailures = "Recent Worker Process Failures"
TimeSinceLastWorkerProcessFailure = "Time Since Last Worker Process Failure"
TotalApplicationPoolRecycles = "Total Application Pool Recycles"
TotalApplicationPoolUptime = "Total Application Pool Uptime"
TotalWorkerProcessesCreated = "Total Worker Processes Created"
TotalWorkerProcessFailures = "Total Worker Process Failures"
TotalWorkerProcessPingFailures = "Total Worker Process Ping Failures"
TotalWorkerProcessShutdownFailures = "Total Worker Process Shutdown Failures"
TotalWorkerProcessStartupFailures = "Total Worker Process Startup Failures"
)
var applicationStates = map[uint32]string{
1: "Uninitialized",
2: "Initialized",
3: "Running",
4: "Disabling",
5: "Disabled",
6: "Shutdown Pending",
7: "Delete Pending",
}
func (c *Collector) buildAppPoolWAS() error {
var err error
c.perfDataCollectorAppPoolWAS, err = perfdata.NewCollector("APP_POOL_WAS", perfdata.InstanceAll, []string{
CurrentApplicationPoolState,
CurrentApplicationPoolUptime,
CurrentWorkerProcesses,
MaximumWorkerProcesses,
RecentWorkerProcessFailures,
TimeSinceLastWorkerProcessFailure,
TotalApplicationPoolRecycles,
TotalApplicationPoolUptime,
TotalWorkerProcessesCreated,
TotalWorkerProcessFailures,
TotalWorkerProcessPingFailures,
TotalWorkerProcessShutdownFailures,
TotalWorkerProcessStartupFailures,
})
if err != nil {
return fmt.Errorf("failed to create APP_POOL_WAS collector: %w", err)
}
// APP_POOL_WAS
c.currentApplicationPoolState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_application_pool_state"),
"The current status of the application pool (1 - Uninitialized, 2 - Initialized, 3 - Running, 4 - Disabling, 5 - Disabled, 6 - Shutdown Pending, 7 - Delete Pending) (CurrentApplicationPoolState)",
[]string{"app", "state"},
nil,
)
c.currentApplicationPoolUptime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_application_pool_start_time"),
"The unix timestamp for the application pool start time (CurrentApplicationPoolUptime)",
[]string{"app"},
nil,
)
c.currentWorkerProcesses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_worker_processes"),
"The current number of worker processes that are running in the application pool (CurrentWorkerProcesses)",
[]string{"app"},
nil,
)
c.maximumWorkerProcesses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "maximum_worker_processes"),
"The maximum number of worker processes that have been created for the application pool since Windows Process Activation Service (WAS) started (MaximumWorkerProcesses)",
[]string{"app"},
nil,
)
c.recentWorkerProcessFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recent_worker_process_failures"),
"The number of times that worker processes for the application pool failed during the rapid-fail protection interval (RecentWorkerProcessFailures)",
[]string{"app"},
nil,
)
c.timeSinceLastWorkerProcessFailure = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "time_since_last_worker_process_failure"),
"The length of time, in seconds, since the last worker process failure occurred for the application pool (TimeSinceLastWorkerProcessFailure)",
[]string{"app"},
nil,
)
c.totalApplicationPoolRecycles = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_application_pool_recycles"),
"The number of times that the application pool has been recycled since Windows Process Activation Service (WAS) started (TotalApplicationPoolRecycles)",
[]string{"app"},
nil,
)
c.totalApplicationPoolUptime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_application_pool_start_time"),
"The unix timestamp for the application pool of when the Windows Process Activation Service (WAS) started (TotalApplicationPoolUptime)",
[]string{"app"},
nil,
)
c.totalWorkerProcessesCreated = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_processes_created"),
"The number of worker processes created for the application pool since Windows Process Activation Service (WAS) started (TotalWorkerProcessesCreated)",
[]string{"app"},
nil,
)
c.totalWorkerProcessFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_failures"),
"The number of times that worker processes have crashed since the application pool was started (TotalWorkerProcessFailures)",
[]string{"app"},
nil,
)
c.totalWorkerProcessPingFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_ping_failures"),
"The number of times that Windows Process Activation Service (WAS) did not receive a response to ping messages sent to a worker process (TotalWorkerProcessPingFailures)",
[]string{"app"},
nil,
)
c.totalWorkerProcessShutdownFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_shutdown_failures"),
"The number of times that Windows Process Activation Service (WAS) failed to shut down a worker process (TotalWorkerProcessShutdownFailures)",
[]string{"app"},
nil,
)
c.totalWorkerProcessStartupFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_startup_failures"),
"The number of times that Windows Process Activation Service (WAS) failed to start a worker process (TotalWorkerProcessStartupFailures)",
[]string{"app"},
nil,
)
return nil
}
func (c *Collector) collectAppPoolWAS(ch chan<- prometheus.Metric) error {
perfData, err := c.perfDataCollectorWebService.Collect()
if err != nil {
return fmt.Errorf("failed to collect APP_POOL_WAS metrics: %w", err)
}
deduplicateIISNames(perfData)
for name, app := range perfData {
if c.config.AppExclude.MatchString(name) || !c.config.AppInclude.MatchString(name) {
continue
}
for key, label := range applicationStates {
isCurrentState := 0.0
if key == uint32(app[CurrentApplicationPoolState].FirstValue) {
isCurrentState = 1.0
}
ch <- prometheus.MustNewConstMetric(
c.currentApplicationPoolState,
prometheus.GaugeValue,
isCurrentState,
name,
label,
)
}
ch <- prometheus.MustNewConstMetric(
c.currentApplicationPoolUptime,
prometheus.GaugeValue,
app[CurrentApplicationPoolUptime].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.currentWorkerProcesses,
prometheus.GaugeValue,
app[CurrentWorkerProcesses].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.maximumWorkerProcesses,
prometheus.GaugeValue,
app[MaximumWorkerProcesses].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.recentWorkerProcessFailures,
prometheus.GaugeValue,
app[RecentWorkerProcessFailures].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.timeSinceLastWorkerProcessFailure,
prometheus.GaugeValue,
app[TimeSinceLastWorkerProcessFailure].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalApplicationPoolRecycles,
prometheus.CounterValue,
app[TotalApplicationPoolRecycles].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalApplicationPoolUptime,
prometheus.CounterValue,
app[TotalApplicationPoolUptime].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalWorkerProcessesCreated,
prometheus.CounterValue,
app[TotalWorkerProcessesCreated].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalWorkerProcessFailures,
prometheus.CounterValue,
app[TotalWorkerProcessFailures].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalWorkerProcessPingFailures,
prometheus.CounterValue,
app[TotalWorkerProcessPingFailures].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalWorkerProcessShutdownFailures,
prometheus.CounterValue,
app[TotalWorkerProcessShutdownFailures].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalWorkerProcessStartupFailures,
prometheus.CounterValue,
app[TotalWorkerProcessStartupFailures].FirstValue,
name,
)
}
return nil
}

View File

@@ -1,10 +1,12 @@
//go:build windows
package iis_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/internal/collector/iis"
"github.com/prometheus-community/windows_exporter/internal/testutils"
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -1,47 +0,0 @@
package iis
import (
"reflect"
"testing"
)
func TestIISDeduplication(t *testing.T) {
t.Parallel()
start := []perflibAPP_POOL_WAS{
{
Name: "foo",
Frequency_Object: 1,
},
{
Name: "foo1#999",
Frequency_Object: 2,
},
{
Name: "foo#2",
Frequency_Object: 3,
},
{
Name: "bar$2",
Frequency_Object: 4,
},
{
Name: "bar_2",
Frequency_Object: 5,
},
}
expected := make(map[string]perflibAPP_POOL_WAS)
// Should be deduplicated from "foo#2"
expected["foo"] = perflibAPP_POOL_WAS{Name: "foo#2", Frequency_Object: 3}
// Map key should have suffix stripped, but struct name field should be unchanged
expected["foo1"] = perflibAPP_POOL_WAS{Name: "foo1#999", Frequency_Object: 2}
// Map key and Name should be identical, as there is no suffix starting with "#"
expected["bar$2"] = perflibAPP_POOL_WAS{Name: "bar$2", Frequency_Object: 4}
// Map key and Name should be identical, as there is no suffix starting with "#"
expected["bar_2"] = perflibAPP_POOL_WAS{Name: "bar_2", Frequency_Object: 5}
deduplicated := dedupIISNames(start)
if !reflect.DeepEqual(expected, deduplicated) {
t.Errorf("Flattened values do not match!\nExpected result: %+v\nActual result: %+v", expected, deduplicated)
}
}

View File

@@ -0,0 +1,745 @@
//go:build windows
package iis
import (
"fmt"
"regexp"
"strings"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)
type collectorW3SVCW3WP struct {
perfDataCollectorW3SVCW3WP *perfdata.Collector
// W3SVC_W3WP
threads *prometheus.Desc
maximumThreads *prometheus.Desc
requestsTotal *prometheus.Desc
requestsActive *prometheus.Desc
activeFlushedEntries *prometheus.Desc
currentFileCacheMemoryUsage *prometheus.Desc
maximumFileCacheMemoryUsage *prometheus.Desc
fileCacheFlushesTotal *prometheus.Desc
fileCacheQueriesTotal *prometheus.Desc
fileCacheHitsTotal *prometheus.Desc
filesCached *prometheus.Desc
filesCachedTotal *prometheus.Desc
filesFlushedTotal *prometheus.Desc
uriCacheFlushesTotal *prometheus.Desc
uriCacheQueriesTotal *prometheus.Desc
uriCacheHitsTotal *prometheus.Desc
urisCached *prometheus.Desc
urisCachedTotal *prometheus.Desc
urisFlushedTotal *prometheus.Desc
metadataCached *prometheus.Desc
metadataCacheFlushes *prometheus.Desc
metadataCacheQueriesTotal *prometheus.Desc
metadataCacheHitsTotal *prometheus.Desc
metadataCachedTotal *prometheus.Desc
metadataFlushedTotal *prometheus.Desc
outputCacheActiveFlushedItems *prometheus.Desc
outputCacheItems *prometheus.Desc
outputCacheMemoryUsage *prometheus.Desc
outputCacheQueriesTotal *prometheus.Desc
outputCacheHitsTotal *prometheus.Desc
outputCacheFlushedItemsTotal *prometheus.Desc
outputCacheFlushesTotal *prometheus.Desc
// IIS 8+ Only
requestErrorsTotal *prometheus.Desc
webSocketRequestsActive *prometheus.Desc
webSocketConnectionAttempts *prometheus.Desc
webSocketConnectionsAccepted *prometheus.Desc
webSocketConnectionsRejected *prometheus.Desc
}
var workerProcessNameExtractor = regexp.MustCompile(`^(\d+)_(.+)$`)
const (
Threads = "Active Threads Count"
MaximumThreads = "Maximum Threads Count"
RequestsTotal = "Total HTTP Requests Served"
RequestsActive = "Active Requests"
ActiveFlushedEntries = "Active Flushed Entries"
CurrentFileCacheMemoryUsage = "Current File Cache Memory Usage"
MaximumFileCacheMemoryUsage = "Maximum File Cache Memory Usage"
FileCacheFlushesTotal = "File Cache Flushes"
FileCacheHitsTotal = "File Cache Hits"
FileCacheMissesTotal = "File Cache Misses"
FilesCached = "Current Files Cached"
FilesCachedTotal = "Total Files Cached"
FilesFlushedTotal = "Total Flushed Files"
URICacheFlushesTotal = "Total Flushed URIs"
URICacheFlushesTotalKernel = "Total Flushed URIs"
URIsFlushedTotalKernel = "Kernel: Total Flushed URIs"
URICacheHitsTotal = "URI Cache Hits"
URICacheHitsTotalKernel = "Kernel: URI Cache Hits"
URICacheMissesTotal = "URI Cache Misses"
URICacheMissesTotalKernel = "Kernel: URI Cache Misses"
URIsCached = "Current URIs Cached"
URIsCachedKernel = "Kernel: Current URIs Cached"
URIsCachedTotal = "Total URIs Cached"
URIsCachedTotalKernel = "Total URIs Cached"
URIsFlushedTotal = "Total Flushed URIs"
MetaDataCacheHits = "Metadata Cache Hits"
MetaDataCacheMisses = "Metadata Cache Misses"
MetadataCached = "Current Metadata Cached"
MetadataCacheFlushes = "Metadata Cache Flushes"
MetadataCachedTotal = "Total Metadata Cached"
MetadataFlushedTotal = "Total Flushed Metadata"
OutputCacheActiveFlushedItems = "Output Cache Current Flushed Items"
OutputCacheItems = "Output Cache Current Items"
OutputCacheMemoryUsage = "Output Cache Current Memory Usage"
OutputCacheHitsTotal = "Output Cache Total Hits"
OutputCacheMissesTotal = "Output Cache Total Misses"
OutputCacheFlushedItemsTotal = "Output Cache Total Flushed Items"
OutputCacheFlushesTotal = "Output Cache Total Flushes"
// IIS8
RequestErrors500 = "% 500 HTTP Response Sent"
RequestErrors503 = "% 503 HTTP Response Sent"
RequestErrors404 = "% 404 HTTP Response Sent"
RequestErrors403 = "% 403 HTTP Response Sent"
RequestErrors401 = "% 401 HTTP Response Sent"
WebSocketRequestsActive = "WebSocket Active Requests"
WebSocketConnectionAttempts = "WebSocket Connection Attempts / Sec"
WebSocketConnectionsAccepted = "WebSocket Connections Accepted / Sec"
WebSocketConnectionsRejected = "WebSocket Connections Rejected / Sec"
)
func (c *Collector) buildW3SVCW3WP() error {
counters := []string{
Threads,
MaximumThreads,
RequestsTotal,
RequestsActive,
ActiveFlushedEntries,
CurrentFileCacheMemoryUsage,
MaximumFileCacheMemoryUsage,
FileCacheFlushesTotal,
FileCacheHitsTotal,
FileCacheMissesTotal,
FilesCached,
FilesCachedTotal,
FilesFlushedTotal,
URICacheFlushesTotal,
URICacheFlushesTotalKernel,
URIsFlushedTotalKernel,
URICacheHitsTotal,
URICacheHitsTotalKernel,
URICacheMissesTotal,
URICacheMissesTotalKernel,
URIsCached,
URIsCachedKernel,
URIsCachedTotal,
URIsCachedTotalKernel,
URIsFlushedTotal,
MetaDataCacheHits,
MetaDataCacheMisses,
MetadataCached,
MetadataCacheFlushes,
MetadataCachedTotal,
MetadataFlushedTotal,
OutputCacheActiveFlushedItems,
OutputCacheItems,
OutputCacheMemoryUsage,
OutputCacheHitsTotal,
OutputCacheMissesTotal,
OutputCacheFlushedItemsTotal,
OutputCacheFlushesTotal,
}
if c.iisVersion.major >= 8 {
counters = append(counters, []string{
RequestErrors500,
RequestErrors503,
RequestErrors404,
RequestErrors403,
RequestErrors401,
WebSocketRequestsActive,
WebSocketConnectionAttempts,
WebSocketConnectionsAccepted,
WebSocketConnectionsRejected,
}...)
}
var err error
c.perfDataCollectorW3SVCW3WP, err = perfdata.NewCollector("W3SVC_W3WP", perfdata.InstanceAll, counters)
if err != nil {
return fmt.Errorf("failed to create W3SVC_W3WP collector: %w", err)
}
// W3SVC_W3WP
c.threads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_threads"),
"Number of threads actively processing requests in the worker process",
[]string{"app", "pid", "state"},
nil,
)
c.maximumThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_max_threads"),
"Maximum number of threads to which the thread pool can grow as needed",
[]string{"app", "pid"},
nil,
)
c.requestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_requests_total"),
"Total number of HTTP requests served by the worker process",
[]string{"app", "pid"},
nil,
)
c.requestsActive = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_current_requests"),
"Current number of requests being processed by the worker process",
[]string{"app", "pid"},
nil,
)
c.activeFlushedEntries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_cache_active_flushed_entries"),
"Number of file handles cached in user-mode that will be closed when all current transfers complete.",
[]string{"app", "pid"},
nil,
)
c.currentFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_memory_bytes"),
"Current number of bytes used by user-mode file cache",
[]string{"app", "pid"},
nil,
)
c.maximumFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_max_memory_bytes"),
"Maximum number of bytes used by user-mode file cache",
[]string{"app", "pid"},
nil,
)
c.fileCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_flushes_total"),
"Total number of files removed from the user-mode cache",
[]string{"app", "pid"},
nil,
)
c.fileCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_queries_total"),
"Total file cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.fileCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_hits_total"),
"Total number of successful lookups in the user-mode file cache",
[]string{"app", "pid"},
nil,
)
c.filesCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items"),
"Current number of files whose contents are present in user-mode cache",
[]string{"app", "pid"},
nil,
)
c.filesCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_total"),
"Total number of files whose contents were ever added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.filesFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_flushed_total"),
"Total number of file handles that have been removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.uriCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_flushes_total"),
"Total number of URI cache flushes (since service startup)",
[]string{"app", "pid"},
nil,
)
c.uriCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_queries_total"),
"Total number of uri cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.uriCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_hits_total"),
"Total number of successful lookups in the user-mode URI cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.urisCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items"),
"Number of URI information blocks currently in the user-mode cache",
[]string{"app", "pid"},
nil,
)
c.urisCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_total"),
"Total number of URI information blocks added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.urisFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_flushed_total"),
"The number of URI information blocks that have been removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items"),
"Number of metadata information blocks currently present in user-mode cache",
[]string{"app", "pid"},
nil,
)
c.metadataCacheFlushes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_flushes_total"),
"Total number of user-mode metadata cache flushes (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_queries_total"),
"Total metadata cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.metadataCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_hits_total"),
"Total number of successful lookups in the user-mode metadata cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_cached_total"),
"Total number of metadata information blocks added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_flushed_total"),
"Total number of metadata information blocks removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.outputCacheActiveFlushedItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_active_flushed_items"),
"",
[]string{"app", "pid"},
nil,
)
c.outputCacheItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items"),
"Number of items current present in output cache",
[]string{"app", "pid"},
nil,
)
c.outputCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_memory_bytes"),
"Current number of bytes used by output cache",
[]string{"app", "pid"},
nil,
)
c.outputCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_queries_total"),
"Total number of output cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.outputCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_hits_total"),
"Total number of successful lookups in output cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.outputCacheFlushedItemsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items_flushed_total"),
"Total number of items flushed from output cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.outputCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_flushes_total"),
"Total number of flushes of output cache (since service startup)",
[]string{"app", "pid"},
nil,
)
// W3SVC_W3WP_IIS8
c.requestErrorsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_request_errors_total"),
"Total number of requests that returned an error",
[]string{"app", "pid", "status_code"},
nil,
)
c.webSocketRequestsActive = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_current_websocket_requests"),
"",
[]string{"app", "pid"},
nil,
)
c.webSocketConnectionAttempts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_attempts_total"),
"",
[]string{"app", "pid"},
nil,
)
c.webSocketConnectionsAccepted = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_accepted_total"),
"",
[]string{"app", "pid"},
nil,
)
c.webSocketConnectionsRejected = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_rejected_total"),
"",
[]string{"app", "pid"},
nil,
)
return nil
}
func (c *Collector) collectW3SVCW3WP(ch chan<- prometheus.Metric) error {
perfData, err := c.perfDataCollectorW3SVCW3WP.Collect()
if err != nil {
return fmt.Errorf("failed to collect APP_POOL_WAS metrics: %w", err)
}
deduplicateIISNames(perfData)
for name, app := range perfData {
if c.config.AppExclude.MatchString(name) || !c.config.AppInclude.MatchString(name) {
continue
}
// Extract the apppool name from the format <PID>_<NAME>
pid := workerProcessNameExtractor.ReplaceAllString(name, "$1")
name := workerProcessNameExtractor.ReplaceAllString(name, "$2")
if name == "" || name == "_Total" ||
c.config.AppExclude.MatchString(name) ||
!c.config.AppInclude.MatchString(name) {
continue
}
// Duplicate instances are suffixed # with an index number. These should be ignored
if strings.Contains(name, "#") {
continue
}
ch <- prometheus.MustNewConstMetric(
c.threads,
prometheus.GaugeValue,
app[Threads].FirstValue,
name,
pid,
"busy",
)
ch <- prometheus.MustNewConstMetric(
c.maximumThreads,
prometheus.CounterValue,
app[MaximumThreads].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.requestsTotal,
prometheus.CounterValue,
app[RequestsTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.requestsActive,
prometheus.CounterValue,
app[RequestsActive].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.activeFlushedEntries,
prometheus.GaugeValue,
app[ActiveFlushedEntries].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.currentFileCacheMemoryUsage,
prometheus.GaugeValue,
app[CurrentFileCacheMemoryUsage].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.maximumFileCacheMemoryUsage,
prometheus.CounterValue,
app[MaximumFileCacheMemoryUsage].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.fileCacheFlushesTotal,
prometheus.CounterValue,
app[FileCacheFlushesTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.fileCacheQueriesTotal,
prometheus.CounterValue,
app[FileCacheHitsTotal].FirstValue+app[FileCacheMissesTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.fileCacheHitsTotal,
prometheus.CounterValue,
app[FileCacheHitsTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.filesCached,
prometheus.GaugeValue,
app[FilesCached].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.filesCachedTotal,
prometheus.CounterValue,
app[FilesCachedTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.filesFlushedTotal,
prometheus.CounterValue,
app[FilesFlushedTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.uriCacheFlushesTotal,
prometheus.CounterValue,
app[URICacheFlushesTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.uriCacheQueriesTotal,
prometheus.CounterValue,
app[URICacheHitsTotal].FirstValue+app[URICacheMissesTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.uriCacheHitsTotal,
prometheus.CounterValue,
app[URICacheHitsTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.urisCached,
prometheus.GaugeValue,
app[URIsCached].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.urisCachedTotal,
prometheus.CounterValue,
app[URIsCachedTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.urisFlushedTotal,
prometheus.CounterValue,
app[URIsFlushedTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.metadataCached,
prometheus.GaugeValue,
app[MetadataCached].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.metadataCacheFlushes,
prometheus.CounterValue,
app[MetadataCacheFlushes].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.metadataCacheQueriesTotal,
prometheus.CounterValue,
app[MetaDataCacheHits].FirstValue+app[MetaDataCacheMisses].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.metadataCacheHitsTotal,
prometheus.CounterValue,
app[MetaDataCacheHits].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.metadataCachedTotal,
prometheus.CounterValue,
app[MetadataCachedTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.metadataFlushedTotal,
prometheus.CounterValue,
app[MetadataFlushedTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.outputCacheActiveFlushedItems,
prometheus.CounterValue,
app[OutputCacheActiveFlushedItems].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.outputCacheItems,
prometheus.CounterValue,
app[OutputCacheItems].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.outputCacheMemoryUsage,
prometheus.CounterValue,
app[OutputCacheMemoryUsage].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.outputCacheQueriesTotal,
prometheus.CounterValue,
app[OutputCacheHitsTotal].FirstValue+app[OutputCacheMissesTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.outputCacheHitsTotal,
prometheus.CounterValue,
app[OutputCacheHitsTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.outputCacheFlushedItemsTotal,
prometheus.CounterValue,
app[OutputCacheFlushedItemsTotal].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.outputCacheFlushesTotal,
prometheus.CounterValue,
app[OutputCacheFlushesTotal].FirstValue,
name,
pid,
)
if c.iisVersion.major >= 8 {
ch <- prometheus.MustNewConstMetric(
c.requestErrorsTotal,
prometheus.CounterValue,
app[RequestErrors401].FirstValue,
name,
pid,
"401",
)
ch <- prometheus.MustNewConstMetric(
c.requestErrorsTotal,
prometheus.CounterValue,
app[RequestErrors403].FirstValue,
name,
pid,
"403",
)
ch <- prometheus.MustNewConstMetric(
c.requestErrorsTotal,
prometheus.CounterValue,
app[RequestErrors404].FirstValue,
name,
pid,
"404",
)
ch <- prometheus.MustNewConstMetric(
c.requestErrorsTotal,
prometheus.CounterValue,
app[RequestErrors500].FirstValue,
name,
pid,
"500",
)
ch <- prometheus.MustNewConstMetric(
c.requestErrorsTotal,
prometheus.CounterValue,
app[RequestErrors503].FirstValue,
name,
pid,
"503",
)
ch <- prometheus.MustNewConstMetric(
c.webSocketRequestsActive,
prometheus.CounterValue,
app[WebSocketRequestsActive].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.webSocketConnectionAttempts,
prometheus.CounterValue,
app[WebSocketConnectionAttempts].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.webSocketConnectionsAccepted,
prometheus.CounterValue,
app[WebSocketConnectionsAccepted].FirstValue,
name,
pid,
)
ch <- prometheus.MustNewConstMetric(
c.webSocketConnectionsRejected,
prometheus.CounterValue,
app[WebSocketConnectionsRejected].FirstValue,
name,
pid,
)
}
}
return nil
}

View File

@@ -0,0 +1,516 @@
//go:build windows
package iis
import (
"fmt"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)
type collectorWebService struct {
perfDataCollectorWebService *perfdata.Collector
currentAnonymousUsers *prometheus.Desc
currentBlockedAsyncIORequests *prometheus.Desc
currentCGIRequests *prometheus.Desc
currentConnections *prometheus.Desc
currentISAPIExtensionRequests *prometheus.Desc
currentNonAnonymousUsers *prometheus.Desc
serviceUptime *prometheus.Desc
totalBytesReceived *prometheus.Desc
totalBytesSent *prometheus.Desc
totalAnonymousUsers *prometheus.Desc
totalBlockedAsyncIORequests *prometheus.Desc
totalCGIRequests *prometheus.Desc
totalConnectionAttemptsAllInstances *prometheus.Desc
totalRequests *prometheus.Desc
totalFilesReceived *prometheus.Desc
totalFilesSent *prometheus.Desc
totalISAPIExtensionRequests *prometheus.Desc
totalLockedErrors *prometheus.Desc
totalLogonAttempts *prometheus.Desc
totalNonAnonymousUsers *prometheus.Desc
totalNotFoundErrors *prometheus.Desc
totalRejectedAsyncIORequests *prometheus.Desc
}
const (
CurrentAnonymousUsers = "Current Anonymous Users"
CurrentBlockedAsyncIORequests = "Current Blocked Async I/O Requests"
CurrentCGIRequests = "Current CGI Requests"
CurrentConnections = "Current Connections"
CurrentISAPIExtensionRequests = "Current ISAPI Extension Requests"
CurrentNonAnonymousUsers = "Current NonAnonymous Users"
ServiceUptime = "Service Uptime"
TotalBytesReceived = "Total Bytes Received"
TotalBytesSent = "Total Bytes Sent"
TotalAnonymousUsers = "Total Anonymous Users"
TotalBlockedAsyncIORequests = "Total Blocked Async I/O Requests"
TotalCGIRequests = "Total CGI Requests"
TotalConnectionAttemptsAllInstances = "Total Connection Attempts (all instances)"
TotalFilesReceived = "Total Files Received"
TotalFilesSent = "Total Files Sent"
TotalISAPIExtensionRequests = "Total ISAPI Extension Requests"
TotalLockedErrors = "Total Locked Errors"
TotalLogonAttempts = "Total Logon Attempts"
TotalNonAnonymousUsers = "Total NonAnonymous Users"
TotalNotFoundErrors = "Total Not Found Errors"
TotalRejectedAsyncIORequests = "Total Rejected Async I/O Requests"
TotalCopyRequests = "Total Copy Requests"
TotalDeleteRequests = "Total Delete Requests"
TotalGetRequests = "Total Get Requests"
TotalHeadRequests = "Total Head Requests"
TotalLockRequests = "Total Lock Requests"
TotalMkcolRequests = "Total Mkcol Requests"
TotalMoveRequests = "Total Move Requests"
TotalOptionsRequests = "Total Options Requests"
TotalOtherRequests = "Total Other Request Methods"
TotalPostRequests = "Total Post Requests"
TotalPropfindRequests = "Total Propfind Requests"
TotalProppatchRequests = "Total Proppatch Requests"
TotalPutRequests = "Total Put Requests"
TotalSearchRequests = "Total Search Requests"
TotalTraceRequests = "Total Trace Requests"
TotalUnlockRequests = "Total Unlock Requests"
)
func (c *Collector) buildWebService() error {
var err error
c.perfDataCollectorWebService, err = perfdata.NewCollector("Web Service", perfdata.InstanceAll, []string{
CurrentAnonymousUsers,
CurrentBlockedAsyncIORequests,
CurrentCGIRequests,
CurrentConnections,
CurrentISAPIExtensionRequests,
CurrentNonAnonymousUsers,
ServiceUptime,
TotalBytesReceived,
TotalBytesSent,
TotalAnonymousUsers,
TotalBlockedAsyncIORequests,
TotalCGIRequests,
TotalConnectionAttemptsAllInstances,
TotalFilesReceived,
TotalFilesSent,
TotalISAPIExtensionRequests,
TotalLockedErrors,
TotalLogonAttempts,
TotalNonAnonymousUsers,
TotalNotFoundErrors,
TotalRejectedAsyncIORequests,
TotalCopyRequests,
TotalDeleteRequests,
TotalGetRequests,
TotalHeadRequests,
TotalLockRequests,
TotalMkcolRequests,
TotalMoveRequests,
TotalOptionsRequests,
TotalOtherRequests,
TotalPostRequests,
TotalPropfindRequests,
TotalProppatchRequests,
TotalPutRequests,
TotalSearchRequests,
TotalTraceRequests,
TotalUnlockRequests,
})
if err != nil {
return fmt.Errorf("failed to create Web Service collector: %w", err)
}
c.currentAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_anonymous_users"),
"Number of users who currently have an anonymous connection using the Web service (WebService.CurrentAnonymousUsers)",
[]string{"site"},
nil,
)
c.currentBlockedAsyncIORequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_blocked_async_io_requests"),
"Current requests temporarily blocked due to bandwidth throttling settings (WebService.CurrentBlockedAsyncIORequests)",
[]string{"site"},
nil,
)
c.currentCGIRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_cgi_requests"),
"Current number of CGI requests being simultaneously processed by the Web service (WebService.CurrentCGIRequests)",
[]string{"site"},
nil,
)
c.currentConnections = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_connections"),
"Current number of connections established with the Web service (WebService.CurrentConnections)",
[]string{"site"},
nil,
)
c.currentISAPIExtensionRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_isapi_extension_requests"),
"Current number of ISAPI requests being simultaneously processed by the Web service (WebService.CurrentISAPIExtensionRequests)",
[]string{"site"},
nil,
)
c.currentNonAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_non_anonymous_users"),
"Number of users who currently have a non-anonymous connection using the Web service (WebService.CurrentNonAnonymousUsers)",
[]string{"site"},
nil,
)
c.serviceUptime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "service_uptime"),
"Number of seconds the WebService is up (WebService.ServiceUptime)",
[]string{"site"},
nil,
)
c.totalBytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "received_bytes_total"),
"Number of data bytes that have been received by the Web service (WebService.TotalBytesReceived)",
[]string{"site"},
nil,
)
c.totalBytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sent_bytes_total"),
"Number of data bytes that have been sent by the Web service (WebService.TotalBytesSent)",
[]string{"site"},
nil,
)
c.totalAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "anonymous_users_total"),
"Total number of users who established an anonymous connection with the Web service (WebService.TotalAnonymousUsers)",
[]string{"site"},
nil,
)
c.totalBlockedAsyncIORequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "blocked_async_io_requests_total"),
"Total requests temporarily blocked due to bandwidth throttling settings (WebService.TotalBlockedAsyncIORequests)",
[]string{"site"},
nil,
)
c.totalCGIRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cgi_requests_total"),
"Total CGI requests is the total number of CGI requests (WebService.TotalCGIRequests)",
[]string{"site"},
nil,
)
c.totalConnectionAttemptsAllInstances = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_attempts_all_instances_total"),
"Number of connections that have been attempted using the Web service (WebService.TotalConnectionAttemptsAllInstances)",
[]string{"site"},
nil,
)
c.totalRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
"Number of HTTP requests (WebService.TotalRequests)",
[]string{"site", "method"},
nil,
)
c.totalFilesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "files_received_total"),
"Number of files received by the Web service (WebService.TotalFilesReceived)",
[]string{"site"},
nil,
)
c.totalFilesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "files_sent_total"),
"Number of files sent by the Web service (WebService.TotalFilesSent)",
[]string{"site"},
nil,
)
c.totalISAPIExtensionRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ipapi_extension_requests_total"),
"ISAPI Extension Requests received (WebService.TotalISAPIExtensionRequests)",
[]string{"site"},
nil,
)
c.totalLockedErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "locked_errors_total"),
"Number of requests that couldn't be satisfied by the server because the requested resource was locked (WebService.TotalLockedErrors)",
[]string{"site"},
nil,
)
c.totalLogonAttempts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logon_attempts_total"),
"Number of logons attempts to the Web Service (WebService.TotalLogonAttempts)",
[]string{"site"},
nil,
)
c.totalNonAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "non_anonymous_users_total"),
"Number of users who established a non-anonymous connection with the Web service (WebService.TotalNonAnonymousUsers)",
[]string{"site"},
nil,
)
c.totalNotFoundErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "not_found_errors_total"),
"Number of requests that couldn't be satisfied by the server because the requested document could not be found (WebService.TotalNotFoundErrors)",
[]string{"site"},
nil,
)
c.totalRejectedAsyncIORequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rejected_async_io_requests_total"),
"Requests rejected due to bandwidth throttling settings (WebService.TotalRejectedAsyncIORequests)",
[]string{"site"},
nil,
)
return nil
}
func (c *Collector) collectWebService(ch chan<- prometheus.Metric) error {
perfData, err := c.perfDataCollectorWebService.Collect()
if err != nil {
return fmt.Errorf("failed to collect Web Service metrics: %w", err)
}
deduplicateIISNames(perfData)
for name, app := range perfData {
if c.config.SiteExclude.MatchString(name) || !c.config.SiteInclude.MatchString(name) {
continue
}
ch <- prometheus.MustNewConstMetric(
c.currentAnonymousUsers,
prometheus.GaugeValue,
app[CurrentAnonymousUsers].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.currentBlockedAsyncIORequests,
prometheus.GaugeValue,
app[CurrentBlockedAsyncIORequests].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.currentCGIRequests,
prometheus.GaugeValue,
app[CurrentCGIRequests].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.currentConnections,
prometheus.GaugeValue,
app[CurrentConnections].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.currentISAPIExtensionRequests,
prometheus.GaugeValue,
app[CurrentISAPIExtensionRequests].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.currentNonAnonymousUsers,
prometheus.GaugeValue,
app[CurrentNonAnonymousUsers].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.serviceUptime,
prometheus.GaugeValue,
app[ServiceUptime].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalBytesReceived,
prometheus.CounterValue,
app[TotalBytesReceived].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalBytesSent,
prometheus.CounterValue,
app[TotalBytesSent].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalAnonymousUsers,
prometheus.CounterValue,
app[TotalAnonymousUsers].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalBlockedAsyncIORequests,
prometheus.CounterValue,
app[TotalBlockedAsyncIORequests].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalCGIRequests,
prometheus.CounterValue,
app[TotalCGIRequests].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalConnectionAttemptsAllInstances,
prometheus.CounterValue,
app[TotalConnectionAttemptsAllInstances].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalFilesReceived,
prometheus.CounterValue,
app[TotalFilesReceived].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalFilesSent,
prometheus.CounterValue,
app[TotalFilesSent].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalISAPIExtensionRequests,
prometheus.CounterValue,
app[TotalISAPIExtensionRequests].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalLockedErrors,
prometheus.CounterValue,
app[TotalLockedErrors].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalLogonAttempts,
prometheus.CounterValue,
app[TotalLogonAttempts].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalNonAnonymousUsers,
prometheus.CounterValue,
app[TotalNonAnonymousUsers].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalNotFoundErrors,
prometheus.CounterValue,
app[TotalNotFoundErrors].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalRejectedAsyncIORequests,
prometheus.CounterValue,
app[TotalRejectedAsyncIORequests].FirstValue,
name,
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalOtherRequests].FirstValue,
name,
"other",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalCopyRequests].FirstValue,
name,
"COPY",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalDeleteRequests].FirstValue,
name,
"DELETE",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalGetRequests].FirstValue,
name,
"GET",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalHeadRequests].FirstValue,
name,
"HEAD",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalLockRequests].FirstValue,
name,
"LOCK",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalMkcolRequests].FirstValue,
name,
"MKCOL",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalMoveRequests].FirstValue,
name,
"MOVE",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalOptionsRequests].FirstValue,
name,
"OPTIONS",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalPostRequests].FirstValue,
name,
"POST",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalPropfindRequests].FirstValue,
name,
"PROPFIND",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalProppatchRequests].FirstValue,
name,
"PROPPATCH",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalPutRequests].FirstValue,
name,
"PUT",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalSearchRequests].FirstValue,
name,
"SEARCH",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalTraceRequests].FirstValue,
name,
"TRACE",
)
ch <- prometheus.MustNewConstMetric(
c.totalRequests,
prometheus.CounterValue,
app[TotalUnlockRequests].FirstValue,
name,
"UNLOCK",
)
}
return nil
}

View File

@@ -0,0 +1,501 @@
//go:build windows
package iis
import (
"fmt"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)
type collectorWebServiceCache struct {
perfDataCollectorWebServiceCache *perfdata.Collector
serviceCacheActiveFlushedEntries *prometheus.Desc
serviceCacheCurrentFileCacheMemoryUsage *prometheus.Desc
serviceCacheMaximumFileCacheMemoryUsage *prometheus.Desc
serviceCacheFileCacheFlushesTotal *prometheus.Desc
serviceCacheFileCacheQueriesTotal *prometheus.Desc
serviceCacheFileCacheHitsTotal *prometheus.Desc
serviceCacheFilesCached *prometheus.Desc
serviceCacheFilesCachedTotal *prometheus.Desc
serviceCacheFilesFlushedTotal *prometheus.Desc
serviceCacheURICacheFlushesTotal *prometheus.Desc
serviceCacheURICacheQueriesTotal *prometheus.Desc
serviceCacheURICacheHitsTotal *prometheus.Desc
serviceCacheURIsCached *prometheus.Desc
serviceCacheURIsCachedTotal *prometheus.Desc
serviceCacheURIsFlushedTotal *prometheus.Desc
serviceCacheMetadataCached *prometheus.Desc
serviceCacheMetadataCacheFlushes *prometheus.Desc
serviceCacheMetadataCacheQueriesTotal *prometheus.Desc
serviceCacheMetadataCacheHitsTotal *prometheus.Desc
serviceCacheMetadataCachedTotal *prometheus.Desc
serviceCacheMetadataFlushedTotal *prometheus.Desc
serviceCacheOutputCacheActiveFlushedItems *prometheus.Desc
serviceCacheOutputCacheItems *prometheus.Desc
serviceCacheOutputCacheMemoryUsage *prometheus.Desc
serviceCacheOutputCacheQueriesTotal *prometheus.Desc
serviceCacheOutputCacheHitsTotal *prometheus.Desc
serviceCacheOutputCacheFlushedItemsTotal *prometheus.Desc
serviceCacheOutputCacheFlushesTotal *prometheus.Desc
}
const (
ServiceCacheActiveFlushedEntries = "Active Flushed Entries"
ServiceCacheCurrentFileCacheMemoryUsage = "Current File Cache Memory Usage"
ServiceCacheMaximumFileCacheMemoryUsage = "Maximum File Cache Memory Usage"
ServiceCacheFileCacheFlushesTotal = "File Cache Flushes"
ServiceCacheFileCacheHitsTotal = "File Cache Hits"
ServiceCacheFileCacheMissesTotal = "File Cache Misses"
ServiceCacheFilesCached = "Current Files Cached"
ServiceCacheFilesCachedTotal = "Total Files Cached"
ServiceCacheFilesFlushedTotal = "Total Flushed Files"
ServiceCacheURICacheFlushesTotal = "Total Flushed URIs"
ServiceCacheURICacheFlushesTotalKernel = "Total Flushed URIs"
ServiceCacheURIsFlushedTotalKernel = "Kernel: Total Flushed URIs"
ServiceCacheURICacheHitsTotal = "URI Cache Hits"
ServiceCacheURICacheHitsTotalKernel = "Kernel: URI Cache Hits"
ServiceCacheURICacheMissesTotal = "URI Cache Misses"
ServiceCacheURICacheMissesTotalKernel = "Kernel: URI Cache Misses"
ServiceCacheURIsCached = "Current URIs Cached"
ServiceCacheURIsCachedKernel = "Kernel: Current URIs Cached"
ServiceCacheURIsCachedTotal = "Total URIs Cached"
ServiceCacheURIsCachedTotalKernel = "Total URIs Cached"
ServiceCacheURIsFlushedTotal = "Total Flushed URIs"
ServiceCacheMetaDataCacheHits = "Metadata Cache Hits"
ServiceCacheMetaDataCacheMisses = "Metadata Cache Misses"
ServiceCacheMetadataCached = "Current Metadata Cached"
ServiceCacheMetadataCacheFlushes = "Metadata Cache Flushes"
ServiceCacheMetadataCachedTotal = "Total Metadata Cached"
ServiceCacheMetadataFlushedTotal = "Total Flushed Metadata"
ServiceCacheOutputCacheActiveFlushedItems = "Output Cache Current Flushed Items"
ServiceCacheOutputCacheItems = "Output Cache Current Items"
ServiceCacheOutputCacheMemoryUsage = "Output Cache Current Memory Usage"
ServiceCacheOutputCacheHitsTotal = "Output Cache Total Hits"
ServiceCacheOutputCacheMissesTotal = "Output Cache Total Misses"
ServiceCacheOutputCacheFlushedItemsTotal = "Output Cache Total Flushed Items"
ServiceCacheOutputCacheFlushesTotal = "Output Cache Total Flushes"
)
func (c *Collector) buildWebServiceCache() error {
var err error
c.perfDataCollectorWebService, err = perfdata.NewCollector("Web Service Cache", perfdata.InstanceAll, []string{
ServiceCacheActiveFlushedEntries,
ServiceCacheCurrentFileCacheMemoryUsage,
ServiceCacheMaximumFileCacheMemoryUsage,
ServiceCacheFileCacheFlushesTotal,
ServiceCacheFileCacheHitsTotal,
ServiceCacheFileCacheMissesTotal,
ServiceCacheFilesCached,
ServiceCacheFilesCachedTotal,
ServiceCacheFilesFlushedTotal,
ServiceCacheURICacheFlushesTotal,
ServiceCacheURICacheFlushesTotalKernel,
ServiceCacheURIsFlushedTotalKernel,
ServiceCacheURICacheHitsTotal,
ServiceCacheURICacheHitsTotalKernel,
ServiceCacheURICacheMissesTotal,
ServiceCacheURICacheMissesTotalKernel,
ServiceCacheURIsCached,
ServiceCacheURIsCachedKernel,
ServiceCacheURIsCachedTotal,
ServiceCacheURIsCachedTotalKernel,
ServiceCacheURIsFlushedTotal,
ServiceCacheMetaDataCacheHits,
ServiceCacheMetaDataCacheMisses,
ServiceCacheMetadataCached,
ServiceCacheMetadataCacheFlushes,
ServiceCacheMetadataCachedTotal,
ServiceCacheMetadataFlushedTotal,
ServiceCacheOutputCacheActiveFlushedItems,
ServiceCacheOutputCacheItems,
ServiceCacheOutputCacheMemoryUsage,
ServiceCacheOutputCacheHitsTotal,
ServiceCacheOutputCacheMissesTotal,
ServiceCacheOutputCacheFlushedItemsTotal,
ServiceCacheOutputCacheFlushesTotal,
})
if err != nil {
return fmt.Errorf("failed to create Web Service Cache collector: %w", err)
}
// Web Service Cache
c.serviceCacheActiveFlushedEntries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_cache_active_flushed_entries"),
"Number of file handles cached that will be closed when all current transfers complete.",
nil,
nil,
)
c.serviceCacheCurrentFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_memory_bytes"),
"Current number of bytes used by file cache",
nil,
nil,
)
c.serviceCacheMaximumFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_max_memory_bytes"),
"Maximum number of bytes used by file cache",
nil,
nil,
)
c.serviceCacheFileCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_flushes_total"),
"Total number of file cache flushes (since service startup)",
nil,
nil,
)
c.serviceCacheFileCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_queries_total"),
"Total number of file cache queries (hits + misses)",
nil,
nil,
)
c.serviceCacheFileCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_hits_total"),
"Total number of successful lookups in the user-mode file cache",
nil,
nil,
)
c.serviceCacheFilesCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_items"),
"Current number of files whose contents are present in cache",
nil,
nil,
)
c.serviceCacheFilesCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_items_total"),
"Total number of files whose contents were ever added to the cache (since service startup)",
nil,
nil,
)
c.serviceCacheFilesFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_items_flushed_total"),
"Total number of file handles that have been removed from the cache (since service startup)",
nil,
nil,
)
c.serviceCacheURICacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_flushes_total"),
"Total number of URI cache flushes (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheURICacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_queries_total"),
"Total number of uri cache queries (hits + misses)",
[]string{"mode"},
nil,
)
c.serviceCacheURICacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_hits_total"),
"Total number of successful lookups in the URI cache (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheURIsCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_items"),
"Number of URI information blocks currently in the cache",
[]string{"mode"},
nil,
)
c.serviceCacheURIsCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_items_total"),
"Total number of URI information blocks added to the cache (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheURIsFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_items_flushed_total"),
"The number of URI information blocks that have been removed from the cache (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheMetadataCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_items"),
"Number of metadata information blocks currently present in cache",
nil,
nil,
)
c.serviceCacheMetadataCacheFlushes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_flushes_total"),
"Total number of metadata cache flushes (since service startup)",
nil,
nil,
)
c.serviceCacheMetadataCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_queries_total"),
"Total metadata cache queries (hits + misses)",
nil,
nil,
)
c.serviceCacheMetadataCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_hits_total"),
"Total number of successful lookups in the metadata cache (since service startup)",
nil,
nil,
)
c.serviceCacheMetadataCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_items_cached_total"),
"Total number of metadata information blocks added to the cache (since service startup)",
nil,
nil,
)
c.serviceCacheMetadataFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_items_flushed_total"),
"Total number of metadata information blocks removed from the cache (since service startup)",
nil,
nil,
)
c.serviceCacheOutputCacheActiveFlushedItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_active_flushed_items"),
"",
nil,
nil,
)
c.serviceCacheOutputCacheItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_items"),
"Number of items current present in output cache",
nil,
nil,
)
c.serviceCacheOutputCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_memory_bytes"),
"Current number of bytes used by output cache",
nil,
nil,
)
c.serviceCacheOutputCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_queries_total"),
"Total output cache queries (hits + misses)",
nil,
nil,
)
c.serviceCacheOutputCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_hits_total"),
"Total number of successful lookups in output cache (since service startup)",
nil,
nil,
)
c.serviceCacheOutputCacheFlushedItemsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_items_flushed_total"),
"Total number of items flushed from output cache (since service startup)",
nil,
nil,
)
c.serviceCacheOutputCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_flushes_total"),
"Total number of flushes of output cache (since service startup)",
nil,
nil,
)
return nil
}
func (c *Collector) collectWebServiceCache(ch chan<- prometheus.Metric) error {
perfData, err := c.perfDataCollectorWebService.Collect()
if err != nil {
return fmt.Errorf("failed to collect Web Service Cache metrics: %w", err)
}
deduplicateIISNames(perfData)
for name, app := range perfData {
if c.config.SiteExclude.MatchString(name) || !c.config.SiteInclude.MatchString(name) {
continue
}
ch <- prometheus.MustNewConstMetric(
c.serviceCacheActiveFlushedEntries,
prometheus.GaugeValue,
app[ServiceCacheActiveFlushedEntries].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheCurrentFileCacheMemoryUsage,
prometheus.GaugeValue,
app[ServiceCacheCurrentFileCacheMemoryUsage].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheMaximumFileCacheMemoryUsage,
prometheus.CounterValue,
app[ServiceCacheMaximumFileCacheMemoryUsage].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheFileCacheFlushesTotal,
prometheus.CounterValue,
app[ServiceCacheFileCacheFlushesTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheFileCacheQueriesTotal,
prometheus.CounterValue,
app[ServiceCacheFileCacheHitsTotal].FirstValue+app[ServiceCacheFileCacheMissesTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheFileCacheHitsTotal,
prometheus.CounterValue,
app[ServiceCacheFileCacheHitsTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheFilesCached,
prometheus.GaugeValue,
app[ServiceCacheFilesCached].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheFilesCachedTotal,
prometheus.CounterValue,
app[ServiceCacheFilesCachedTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheFilesFlushedTotal,
prometheus.CounterValue,
app[ServiceCacheFilesFlushedTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURICacheFlushesTotal,
prometheus.CounterValue,
app[ServiceCacheURICacheFlushesTotal].FirstValue,
"user",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURICacheFlushesTotal,
prometheus.CounterValue,
app[ServiceCacheURICacheFlushesTotalKernel].FirstValue,
"kernel",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURICacheQueriesTotal,
prometheus.CounterValue,
app[ServiceCacheURICacheHitsTotal].FirstValue+app[ServiceCacheURICacheMissesTotal].FirstValue,
"user",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURICacheQueriesTotal,
prometheus.CounterValue,
app[ServiceCacheURICacheHitsTotalKernel].FirstValue+app[ServiceCacheURICacheMissesTotalKernel].FirstValue,
"kernel",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURICacheHitsTotal,
prometheus.CounterValue,
app[ServiceCacheURICacheHitsTotal].FirstValue,
"user",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURICacheHitsTotal,
prometheus.CounterValue,
app[ServiceCacheURICacheHitsTotalKernel].FirstValue,
"kernel",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURIsCached,
prometheus.GaugeValue,
app[ServiceCacheURIsCached].FirstValue,
"user",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURIsCached,
prometheus.GaugeValue,
app[ServiceCacheURIsCachedKernel].FirstValue,
"kernel",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURIsCachedTotal,
prometheus.CounterValue,
app[ServiceCacheURIsCachedTotal].FirstValue,
"user",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURIsCachedTotal,
prometheus.CounterValue,
app[ServiceCacheURIsCachedTotalKernel].FirstValue,
"kernel",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURIsFlushedTotal,
prometheus.CounterValue,
app[ServiceCacheURIsFlushedTotal].FirstValue,
"user",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheURIsFlushedTotal,
prometheus.CounterValue,
app[ServiceCacheURIsFlushedTotalKernel].FirstValue,
"kernel",
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheMetadataCached,
prometheus.GaugeValue,
app[ServiceCacheMetadataCached].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheMetadataCacheFlushes,
prometheus.CounterValue,
app[ServiceCacheMetadataCacheFlushes].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheMetadataCacheQueriesTotal,
prometheus.CounterValue,
app[ServiceCacheMetaDataCacheHits].FirstValue+app[ServiceCacheMetaDataCacheMisses].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheMetadataCacheHitsTotal,
prometheus.CounterValue,
0, // app[ServiceCacheMetadataCacheHitsTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheMetadataCachedTotal,
prometheus.CounterValue,
app[ServiceCacheMetadataCachedTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheMetadataFlushedTotal,
prometheus.CounterValue,
app[ServiceCacheMetadataFlushedTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheOutputCacheActiveFlushedItems,
prometheus.CounterValue,
app[ServiceCacheOutputCacheActiveFlushedItems].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheOutputCacheItems,
prometheus.CounterValue,
app[ServiceCacheOutputCacheItems].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheOutputCacheMemoryUsage,
prometheus.CounterValue,
app[ServiceCacheOutputCacheMemoryUsage].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheOutputCacheQueriesTotal,
prometheus.CounterValue,
app[ServiceCacheOutputCacheHitsTotal].FirstValue+app[ServiceCacheOutputCacheMissesTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheOutputCacheHitsTotal,
prometheus.CounterValue,
app[ServiceCacheOutputCacheHitsTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheOutputCacheFlushedItemsTotal,
prometheus.CounterValue,
app[ServiceCacheOutputCacheFlushedItemsTotal].FirstValue,
)
ch <- prometheus.MustNewConstMetric(
c.serviceCacheOutputCacheFlushesTotal,
prometheus.CounterValue,
app[ServiceCacheOutputCacheFlushesTotal].FirstValue,
)
}
return nil
}