mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-17 10:09:05 +02:00
collector: publish base units and _total counter names (#2743)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -207,7 +207,7 @@ func (c *Collector) buildDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.replicationHighestUsn = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "replication_highest_usn"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "replication_highest_usn_total"),
|
||||
"Highest update sequence number (USN) committed or issued by this domain controller (DRA Highest USN Committed/Issued).",
|
||||
[]string{"state"},
|
||||
nil,
|
||||
|
||||
Vendored
-13
@@ -53,7 +53,6 @@ type Collector struct {
|
||||
copyReadsTotal *prometheus.Desc
|
||||
dataFlushesTotal *prometheus.Desc
|
||||
dataFlushPagesTotal *prometheus.Desc
|
||||
dataMapHitsPercent *prometheus.Desc
|
||||
dataMapHitsTotal *prometheus.Desc
|
||||
dataMapPinsTotal *prometheus.Desc
|
||||
dataMapsTotal *prometheus.Desc
|
||||
@@ -164,12 +163,6 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
"Number of data-map requests that hit the cache.",
|
||||
nil, nil,
|
||||
)
|
||||
c.dataMapHitsPercent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "data_map_hits_percent"),
|
||||
"Deprecated: raw data-map hit count, not a percentage. Use windows_cache_data_map_hits_total.",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.dataMapPinsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "data_map_pins_total"),
|
||||
"(DataMapPinsTotal)",
|
||||
@@ -364,12 +357,6 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, _ time.Duration) error
|
||||
c.perfDataObject[0].DataMapHitsTotal,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataMapHitsPercent,
|
||||
prometheus.GaugeValue,
|
||||
c.perfDataObject[0].DataMapHitsTotal,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataMapPinsTotal,
|
||||
prometheus.CounterValue,
|
||||
|
||||
+2
-3
@@ -62,12 +62,11 @@ func TestDataMapHitCounterWireFormats(t *testing.T) {
|
||||
require.Contains(t, openMetrics.String(), "# TYPE windows_cache_data_map_hits counter")
|
||||
require.Contains(t, openMetrics.String(), "windows_cache_data_map_hits_total 1000")
|
||||
case "windows_cache_data_map_hits_percent":
|
||||
found[family.GetName()] = true
|
||||
require.InDelta(t, 1000, family.GetMetric()[0].GetGauge().GetValue(), 1e-9)
|
||||
t.Fatalf("removed metric %s is still exported", family.GetName())
|
||||
}
|
||||
}
|
||||
|
||||
require.Len(t, found, 2)
|
||||
require.Len(t, found, 1)
|
||||
}
|
||||
|
||||
type dataMapFixture struct{}
|
||||
|
||||
@@ -281,7 +281,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.containersCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "count"),
|
||||
prometheus.BuildFQName(types.Namespace, "", "containers"),
|
||||
"Number of containers",
|
||||
nil,
|
||||
nil,
|
||||
@@ -329,13 +329,13 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.runtimeUser = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_usermode"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_usermode_seconds_total"),
|
||||
"Run Time in User mode in Seconds",
|
||||
[]string{"container_id", "namespace", "pod", "container"},
|
||||
nil,
|
||||
)
|
||||
c.runtimeKernel = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_kernelmode"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_kernelmode_seconds_total"),
|
||||
"Run time in Kernel mode in Seconds",
|
||||
[]string{"container_id", "namespace", "pod", "container"},
|
||||
nil,
|
||||
|
||||
@@ -28,7 +28,8 @@ Hyper-V guest with 12 logical processors in one processor group.
|
||||
- `Interrupts/sec`, `DPCs Queued/sec` and `Clock Interrupts/sec`
|
||||
(`PERF_COUNTER_COUNTER`) and `C1/C2/C3 Transitions/sec`,
|
||||
`Idle Break Events/sec` (`PERF_COUNTER_BULK_COUNT`) are cumulative counts.
|
||||
- `Processor Frequency` is a gauge in MHz (3700 here). `Parking Status` is a
|
||||
- `Processor Frequency` is a gauge in MHz (3700 here); the collector multiplies
|
||||
it by 1e6 for `windows_cpu_core_frequency_hertz`. `Parking Status` is a
|
||||
gauge, 0 when the processor is not parked. `% Performance Limit` is a gauge
|
||||
percentage (100 here). `% C3 Time` and `C3 Transitions/sec` stayed 0 on this
|
||||
virtual machine.
|
||||
|
||||
@@ -57,7 +57,7 @@ type Collector struct {
|
||||
clockInterruptsTotal *prometheus.Desc
|
||||
idleBreakEventsTotal *prometheus.Desc
|
||||
parkingStatus *prometheus.Desc
|
||||
processorFrequencyMHz *prometheus.Desc
|
||||
processorFrequencyHertz *prometheus.Desc
|
||||
processorPerformance *prometheus.Desc
|
||||
processorMPerf *prometheus.Desc
|
||||
processorRTC *prometheus.Desc
|
||||
@@ -107,7 +107,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.timeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "time_seconds_total"),
|
||||
"Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)",
|
||||
[]string{"core", "mode"},
|
||||
nil,
|
||||
@@ -142,9 +142,9 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.processorFrequencyMHz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "core_frequency_mhz"),
|
||||
"Core frequency in megahertz",
|
||||
c.processorFrequencyHertz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "core_frequency_hertz"),
|
||||
"Core frequency in hertz",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
@@ -321,9 +321,9 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, _ time.Duration) error
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.processorFrequencyMHz,
|
||||
c.processorFrequencyHertz,
|
||||
prometheus.GaugeValue,
|
||||
coreData.ProcessorFrequencyMHz,
|
||||
coreData.ProcessorFrequencyMHz*1e6,
|
||||
core,
|
||||
)
|
||||
|
||||
|
||||
@@ -123,16 +123,16 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.cpuL2CacheSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "l2_cache_size"),
|
||||
"Size of L2 cache per CPU",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "l2_cache_size_bytes"),
|
||||
"Size of L2 cache per CPU in bytes",
|
||||
[]string{
|
||||
"device_id",
|
||||
},
|
||||
nil,
|
||||
)
|
||||
c.cpuL3CacheSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "l3_cache_size"),
|
||||
"Size of L3 cache per CPU",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "l3_cache_size_bytes"),
|
||||
"Size of L3 cache per CPU in bytes",
|
||||
[]string{
|
||||
"device_id",
|
||||
},
|
||||
@@ -225,14 +225,14 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, maxScrapeDuration time.
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.cpuL2CacheSize,
|
||||
prometheus.GaugeValue,
|
||||
float64(processor.L2CacheSize),
|
||||
float64(processor.L2CacheSize)*1024,
|
||||
strings.TrimRight(processor.DeviceID, " "),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.cpuL3CacheSize,
|
||||
prometheus.GaugeValue,
|
||||
float64(processor.L3CacheSize),
|
||||
float64(processor.L3CacheSize)*1024,
|
||||
strings.TrimRight(processor.DeviceID, " "),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func (c *Collector) Build(logger *slog.Logger, miSession *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.size = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "size"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "size_bytes"),
|
||||
"Size of the disk drive. It is calculated by multiplying the total number of cylinders, tracks in each cylinder, sectors in each track, and bytes in each sector.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
|
||||
@@ -65,8 +65,8 @@ func (c *Collector) buildADAccessProcesses() error {
|
||||
}
|
||||
|
||||
c.ldapReadTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_read_time_sec"),
|
||||
"Time (sec) to send an LDAP read request and receive a response",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_read_time_seconds_total"),
|
||||
"Total time in seconds to send an LDAP read request and receive a response",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -77,8 +77,8 @@ func (c *Collector) buildADAccessProcesses() error {
|
||||
nil,
|
||||
)
|
||||
c.ldapSearchTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_search_time_sec"),
|
||||
"Time (sec) to send an LDAP search request and receive a response",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_search_time_seconds_total"),
|
||||
"Total time in seconds to send an LDAP search request and receive a response",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -89,8 +89,8 @@ func (c *Collector) buildADAccessProcesses() error {
|
||||
nil,
|
||||
)
|
||||
c.ldapWriteTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_write_time_sec"),
|
||||
"Time (sec) to send an LDAP Add/Modify/Delete request and receive a response",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_write_time_seconds_total"),
|
||||
"Total time in seconds to send an LDAP Add/Modify/Delete request and receive a response",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -107,8 +107,8 @@ func (c *Collector) buildADAccessProcesses() error {
|
||||
nil,
|
||||
)
|
||||
c.longRunningLDAPOperationsPerMin = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_long_running_ops_per_sec"),
|
||||
"Long Running LDAP operations per second",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_long_running_operations_per_second"),
|
||||
"Long running LDAP operations per second, averaged over the last minute. Exchange reports the per-minute value as a raw count (Windows has no per-minute counter type); the collector divides it by 60",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -185,8 +185,8 @@ func (c *Collector) collectADAccessProcesses(ch chan<- prometheus.Metric) error
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.longRunningLDAPOperationsPerMin,
|
||||
prometheus.CounterValue,
|
||||
data.LongRunningLDAPOperationsPerMin*60,
|
||||
prometheus.GaugeValue,
|
||||
data.LongRunningLDAPOperationsPerMin/60,
|
||||
labelName,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ func (c *Collector) buildAvailabilityService() error {
|
||||
}
|
||||
|
||||
c.availabilityRequestsSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availability_service_requests_per_sec"),
|
||||
"Number of requests serviced per second",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availability_service_requests_total"),
|
||||
"Total number of requests serviced",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
@@ -58,14 +58,14 @@ func (c *Collector) buildHTTPProxy() error {
|
||||
}
|
||||
|
||||
c.mailboxServerLocatorAverageLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_mailbox_server_locator_avg_latency_sec"),
|
||||
"Average latency (sec) of MailboxServerLocator web service calls",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_mailbox_server_locator_avg_latency_seconds"),
|
||||
"Average latency in seconds of MailboxServerLocator web service calls",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.averageAuthenticationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_avg_auth_latency"),
|
||||
"Average time spent authenticating CAS requests over the last 200 samples",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_avg_auth_latency_seconds"),
|
||||
"Average time in seconds spent authenticating CAS requests over the last 200 samples",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -82,14 +82,14 @@ func (c *Collector) buildHTTPProxy() error {
|
||||
nil,
|
||||
)
|
||||
c.averageCASProcessingLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_avg_cas_processing_latency_sec"),
|
||||
"Average latency (sec) of CAS processing time over the last 200 reqs",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_avg_cas_processing_latency_seconds"),
|
||||
"Average latency in seconds of CAS processing time over the last 200 reqs",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.mailboxServerProxyFailureRate = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_mailbox_proxy_failure_rate"),
|
||||
"% of failures between this CAS and MBX servers over the last 200 samples",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_mailbox_proxy_failure_ratio"),
|
||||
"Ratio (0-1) of failures between this CAS and MBX servers over the last 200 samples",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -115,7 +115,7 @@ func (c *Collector) collectHTTPProxy(ch chan<- prometheus.Metric) error {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.averageAuthenticationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.AverageAuthenticationLatency,
|
||||
utils.MilliSecToSec(data.AverageAuthenticationLatency),
|
||||
labelName,
|
||||
)
|
||||
|
||||
@@ -129,7 +129,7 @@ func (c *Collector) collectHTTPProxy(ch chan<- prometheus.Metric) error {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.mailboxServerProxyFailureRate,
|
||||
prometheus.GaugeValue,
|
||||
data.MailboxServerProxyFailureRate,
|
||||
data.MailboxServerProxyFailureRate/100,
|
||||
labelName,
|
||||
)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ func (c *Collector) buildMapiHTTPEmsMDB() error {
|
||||
}
|
||||
|
||||
c.activeUserCountMapiHTTPEmsMDB = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "mapihttp_emsmdb_active_user_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "mapihttp_emsmdb_active_users"),
|
||||
"Number of unique outlook users that have shown some kind of activity in the last 2 minutes",
|
||||
nil,
|
||||
nil,
|
||||
|
||||
@@ -56,8 +56,8 @@ func (c *Collector) buildRpcClientAccess() error {
|
||||
}
|
||||
|
||||
c.rpcAveragedLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_avg_latency_sec"),
|
||||
"The latency (sec) averaged for the past 1024 packets",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_avg_latency_seconds"),
|
||||
"The latency in seconds averaged for the past 1024 packets",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
@@ -68,13 +68,13 @@ func (c *Collector) buildRpcClientAccess() error {
|
||||
nil,
|
||||
)
|
||||
c.activeUserCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_active_user_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_active_users"),
|
||||
"Number of unique users that have shown some kind of activity in the last 2 minutes",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.connectionCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_connection_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_connections"),
|
||||
"Total number of client connections maintained",
|
||||
nil,
|
||||
nil,
|
||||
@@ -86,7 +86,7 @@ func (c *Collector) buildRpcClientAccess() error {
|
||||
nil,
|
||||
)
|
||||
c.userCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_user_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_users"),
|
||||
"Number of users",
|
||||
nil,
|
||||
nil,
|
||||
|
||||
@@ -61,7 +61,7 @@ func (c *Collector) buildWorkloadManagementWorkloads() error {
|
||||
nil,
|
||||
)
|
||||
c.completedTasks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_completed_tasks"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_completed_tasks_total"),
|
||||
"Number of workload management tasks that have been completed",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
@@ -73,7 +73,7 @@ func (c *Collector) buildWorkloadManagementWorkloads() error {
|
||||
nil,
|
||||
)
|
||||
c.yieldedTasks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_yielded_tasks"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_yielded_tasks_total"),
|
||||
"The total number of tasks that have been yielded by a workload",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
@@ -113,7 +113,7 @@ func (c *Collector) collectWorkloadManagementWorkloads(ch chan<- prometheus.Metr
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.queuedTasks,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
data.QueuedTasks,
|
||||
labelName,
|
||||
)
|
||||
|
||||
@@ -204,7 +204,7 @@ func (c *Collector) emitQuotas(ch chan<- prometheus.Metric, dst []msftFSRMQuota)
|
||||
|
||||
func (c *Collector) buildDescriptors() {
|
||||
c.quotasCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "quotas"),
|
||||
"Number of Quotas",
|
||||
nil,
|
||||
nil,
|
||||
|
||||
@@ -194,7 +194,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
)
|
||||
|
||||
c.gpuEngineRunningTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "engine_time_seconds"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "engine_time_seconds_total"),
|
||||
"Total running time of the GPU engine in seconds.",
|
||||
[]string{"process_id", "luid", "device_id", "phys", "eng", "engtype"},
|
||||
nil,
|
||||
|
||||
@@ -44,7 +44,8 @@ memory) on a host with 12 logical processors.
|
||||
`... count` counters are cumulative. The `... latency microseconds`
|
||||
counters are not cumulative: `Commit operation latency microseconds` of the
|
||||
configuration file dropped from 6659 to 5213 while `Commit operation count`
|
||||
stayed 1.
|
||||
stayed 1. The collector converts the latencies to seconds
|
||||
(`..._latency_seconds`) and publishes the counts as `_total` counters.
|
||||
- `Hyper-V VM Vid Partition`: pages are 4 KiB. The 2 GiB VM had 526336
|
||||
`Physical Pages Allocated`.
|
||||
- `Hyper-V Virtual Storage Device`: instances are the disk path with `\`
|
||||
|
||||
@@ -229,187 +229,187 @@ func (c *Collector) buildDataStore() error {
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReconnectLatencyMicro = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_reconnect_latency_microseconds"),
|
||||
"Represents the reconnect latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_reconnect_latency_seconds"),
|
||||
"Represents the reconnect latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreDisconnectCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_disconnect_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_disconnects_total"),
|
||||
"Represents the disconnect count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToFileByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_byte_latency_microseconds"),
|
||||
"Represents the write to file byte latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_byte_latency_seconds"),
|
||||
"Represents the write to file byte latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToFileByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_byte_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_bytes_total"),
|
||||
"Represents the write to file byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToFileCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_operations_total"),
|
||||
"Represents the write to file count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromFileByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_byte_latency_microseconds"),
|
||||
"Represents the read from file byte latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_byte_latency_seconds"),
|
||||
"Represents the read from file byte latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromFileByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_byte_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_bytes_total"),
|
||||
"Represents the read from file byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromFileCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_operations_total"),
|
||||
"Represents the read from file count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToStorageByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_byte_latency_microseconds"),
|
||||
"Represents the write to storage byte latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_byte_latency_seconds"),
|
||||
"Represents the write to storage byte latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToStorageByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_byte_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_bytes_total"),
|
||||
"Represents the write to storage byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToStorageCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_operations_total"),
|
||||
"Represents the write to storage count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromStorageByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_byte_latency_microseconds"),
|
||||
"Represents the read from storage byte latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_byte_latency_seconds"),
|
||||
"Represents the read from storage byte latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromStorageByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_byte_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_bytes_total"),
|
||||
"Represents the read from storage byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromStorageCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_operations_total"),
|
||||
"Represents the read from storage count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_byte_latency_microseconds"),
|
||||
"Represents the commit byte latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_byte_latency_seconds"),
|
||||
"Represents the commit byte latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_byte_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_bytes_total"),
|
||||
"Represents the commit byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commits_total"),
|
||||
"Represents the commit count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCacheUpdateOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_cache_update_operation_latency_microseconds"),
|
||||
"Represents the cache update operation latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_cache_update_operation_latency_seconds"),
|
||||
"Represents the cache update operation latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCacheUpdateOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_cache_update_operation_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_cache_update_operations_total"),
|
||||
"Represents the cache update operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_operation_latency_microseconds"),
|
||||
"Represents the commit operation latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_operation_latency_seconds"),
|
||||
"Represents the commit operation latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_operation_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_operations_total"),
|
||||
"Represents the commit operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCompactOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_compact_operation_latency_microseconds"),
|
||||
"Represents the compact operation latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_compact_operation_latency_seconds"),
|
||||
"Represents the compact operation latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCompactOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_compact_operation_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_compact_operations_total"),
|
||||
"Represents the compact operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreLoadFileOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_load_file_operation_latency_microseconds"),
|
||||
"Represents the load file operation latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_load_file_operation_latency_seconds"),
|
||||
"Represents the load file operation latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreLoadFileOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_load_file_operation_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_load_file_operations_total"),
|
||||
"Represents the load file operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreRemoveOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_remove_operation_latency_microseconds"),
|
||||
"Represents the remove operation latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_remove_operation_latency_seconds"),
|
||||
"Represents the remove operation latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreRemoveOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_remove_operation_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_remove_operations_total"),
|
||||
"Represents the remove operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreQuerySizeOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_query_size_operation_latency_microseconds"),
|
||||
"Represents the query size operation latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_query_size_operation_latency_seconds"),
|
||||
"Represents the query size operation latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreQuerySizeOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_query_size_operation_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_query_size_operations_total"),
|
||||
"Represents the query size operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreSetOperationLatencyMicro = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_set_operation_latency_microseconds"),
|
||||
"Represents the set operation latency in microseconds of the DataStore.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_set_operation_latency_seconds"),
|
||||
"Represents the set operation latency in seconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreSetOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_set_operation_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_set_operations_total"),
|
||||
"Represents the set operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
@@ -533,7 +533,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreReconnectLatencyMicro,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreReconnectLatencyMicro,
|
||||
data.DataStoreReconnectLatencyMicro*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -547,7 +547,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreWriteToFileByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreWriteToFileByteLatency,
|
||||
data.DataStoreWriteToFileByteLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -568,7 +568,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreReadFromFileByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreReadFromFileByteLatency,
|
||||
data.DataStoreReadFromFileByteLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -589,7 +589,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreWriteToStorageByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreWriteToStorageByteLatency,
|
||||
data.DataStoreWriteToStorageByteLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -610,7 +610,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreReadFromStorageByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreReadFromStorageByteLatency,
|
||||
data.DataStoreReadFromStorageByteLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -631,7 +631,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreCommitByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreCommitByteLatency,
|
||||
data.DataStoreCommitByteLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -652,7 +652,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreCacheUpdateOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreCacheUpdateOperationLatency,
|
||||
data.DataStoreCacheUpdateOperationLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -666,7 +666,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreCommitOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreCommitOperationLatency,
|
||||
data.DataStoreCommitOperationLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -680,7 +680,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreCompactOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreCompactOperationLatency,
|
||||
data.DataStoreCompactOperationLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -694,7 +694,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreLoadFileOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreLoadFileOperationLatency,
|
||||
data.DataStoreLoadFileOperationLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -708,7 +708,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreRemoveOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreRemoveOperationLatency,
|
||||
data.DataStoreRemoveOperationLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -722,7 +722,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreQuerySizeOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreQuerySizeOperationLatency,
|
||||
data.DataStoreQuerySizeOperationLatency*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -736,7 +736,7 @@ func (c *Collector) collectDataStore(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.dataStoreSetOperationLatencyMicro,
|
||||
prometheus.GaugeValue,
|
||||
data.DataStoreSetOperationLatencyMicro,
|
||||
data.DataStoreSetOperationLatencyMicro*1e-6,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
|
||||
@@ -87,21 +87,21 @@ func (c *Collector) buildHost() error {
|
||||
}
|
||||
|
||||
c.vmProcessorCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "vm_processor_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "vm_processors"),
|
||||
"Number of virtual processors assigned to the VM",
|
||||
[]string{"vm_id", "vm"},
|
||||
nil,
|
||||
)
|
||||
|
||||
c.hostLogicalProcessorCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "host_logical_processor_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "host_logical_processors"),
|
||||
"Number of logical processors on the host",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
c.totalVMProcessorCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "total_vm_processor_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "assigned_vm_processors"),
|
||||
"Total number of virtual processors assigned to all VMs",
|
||||
nil,
|
||||
nil,
|
||||
|
||||
@@ -59,13 +59,13 @@ func (c *Collector) buildHypervisorLogicalProcessor() error {
|
||||
}
|
||||
|
||||
c.hypervisorLogicalProcessorTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_logical_processor_time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_logical_processor_time_seconds_total"),
|
||||
"Time that processor spent in different modes (hypervisor, guest, idle)",
|
||||
[]string{"core", "state"},
|
||||
nil,
|
||||
)
|
||||
c.hypervisorLogicalProcessorTotalRunTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_logical_processor_total_run_time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_logical_processor_total_run_time_seconds_total"),
|
||||
"Time that processor spent",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
|
||||
@@ -174,37 +174,37 @@ func (c *Collector) buildHypervisorRootPartitionDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition1GDevicePages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_1G_device_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_1g_device_pages"),
|
||||
"The number of 1G pages present in the device space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition1GGPAPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_1G_gpa_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_1g_gpa_pages"),
|
||||
"The number of 1G pages present in the GPA space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition2MDevicePages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_2M_device_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_2m_device_pages"),
|
||||
"The number of 2M pages present in the device space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition2MGPAPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_2M_gpa_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_2m_gpa_pages"),
|
||||
"The number of 2M pages present in the GPA space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition4KDevicePages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_4K_device_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_4k_device_pages"),
|
||||
"The number of 4K pages present in the device space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition4KGPAPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_4K_gpa_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_4k_gpa_pages"),
|
||||
"The number of 4K pages present in the GPA space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
|
||||
@@ -71,14 +71,14 @@ func (c *Collector) buildHypervisorRootVirtualProcessor() error {
|
||||
|
||||
func (c *Collector) buildHypervisorRootVirtualProcessorDescriptors() {
|
||||
c.hypervisorRootVirtualProcessorTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_root_virtual_processor_time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_root_virtual_processor_time_seconds_total"),
|
||||
"Time in seconds that processor spent in different modes (guest_run, hypervisor, remote)",
|
||||
[]string{"core", "state"},
|
||||
nil,
|
||||
)
|
||||
|
||||
c.hypervisorRootVirtualProcessorTotalRunTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_root_virtual_processor_total_run_time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_root_virtual_processor_total_run_time_seconds_total"),
|
||||
"Time in seconds that processor spent running",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
|
||||
@@ -35,12 +35,10 @@ type collectorHypervisorVirtualProcessor struct {
|
||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Guest Run Time
|
||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Hypervisor Run Time
|
||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Remote Run Time
|
||||
hypervisorVirtualProcessorTimeTotal *prometheus.Desc
|
||||
hypervisorVirtualProcessorModeTimeTotal *prometheus.Desc // New name for better clarity
|
||||
hypervisorVirtualProcessorTotalRunTimeTotal *prometheus.Desc // \Hyper-V Hypervisor Virtual Processor(*)\% Total Run Time
|
||||
hypervisorVirtualProcessorRunTimeTotal *prometheus.Desc // New name for better clarity
|
||||
hypervisorVirtualProcessorCPUWaitSeconds *prometheus.Desc // \Hyper-V Hypervisor Virtual Processor(*)\CPU Wait Time Per Dispatch
|
||||
hypervisorVirtualProcessorDispatches *prometheus.Desc // \Hyper-V Hypervisor Virtual Processor(*)\Logical Processor Dispatches/sec
|
||||
hypervisorVirtualProcessorModeTimeTotal *prometheus.Desc
|
||||
hypervisorVirtualProcessorRunTimeTotal *prometheus.Desc
|
||||
hypervisorVirtualProcessorCPUWaitSeconds *prometheus.Desc // \Hyper-V Hypervisor Virtual Processor(*)\CPU Wait Time Per Dispatch
|
||||
hypervisorVirtualProcessorDispatches *prometheus.Desc // \Hyper-V Hypervisor Virtual Processor(*)\Logical Processor Dispatches/sec
|
||||
}
|
||||
|
||||
type perfDataCounterValuesHypervisorVirtualProcessor struct {
|
||||
@@ -72,34 +70,18 @@ func (c *Collector) buildHypervisorVirtualProcessor() error {
|
||||
}
|
||||
|
||||
func (c *Collector) buildHypervisorVirtualProcessorDescriptors() {
|
||||
c.hypervisorVirtualProcessorTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_time_total"),
|
||||
"DEPRECATED: use hypervisor_virtual_processor_mode_time_total. Time in seconds that processor spent in different modes (hypervisor, guest, remote)",
|
||||
[]string{"vm", "core", "state"},
|
||||
nil,
|
||||
)
|
||||
// New metric with better name for clarity, old one is kept for backward compatibility
|
||||
c.hypervisorVirtualProcessorModeTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_mode_time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_mode_time_seconds_total"),
|
||||
"Time in seconds that processor spent in different modes (hypervisor, guest, remote)",
|
||||
[]string{"vm", "core", "state"},
|
||||
nil,
|
||||
)
|
||||
// end same metric
|
||||
c.hypervisorVirtualProcessorTotalRunTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_total_run_time_total"),
|
||||
"DEPRECATED: use hypervisor_virtual_processor_run_time_total. Time in seconds that processor spent running",
|
||||
[]string{"vm", "core"},
|
||||
nil,
|
||||
)
|
||||
// New metric with better name for clarity, old one is kept for backward compatibility
|
||||
c.hypervisorVirtualProcessorRunTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_run_time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_run_time_seconds_total"),
|
||||
"Time in seconds that processor spent running",
|
||||
[]string{"vm", "core"},
|
||||
nil,
|
||||
)
|
||||
// end same metric
|
||||
c.hypervisorVirtualProcessorCPUWaitSeconds = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_cpu_wait_seconds_total"),
|
||||
"The time spent waiting for a virtual processor to be dispatched onto a logical processor. "+
|
||||
@@ -175,27 +157,6 @@ func (c *Collector) publishHypervisorVirtualProcessor(ch chan<- prometheus.Metri
|
||||
vmName := data.Name
|
||||
coreID := coreIDs[i]
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
data.HypervisorVirtualProcessorHypervisorRunTimePercent,
|
||||
vmName, coreID, "hypervisor",
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
data.HypervisorVirtualProcessorGuestRunTimePercent,
|
||||
vmName, coreID, "guest",
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
data.HypervisorVirtualProcessorRemoteRunTimePercent,
|
||||
vmName, coreID, "remote",
|
||||
)
|
||||
// Same metric with new name for better clarity, old one is kept for backward compatibility
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorModeTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
@@ -216,21 +177,14 @@ func (c *Collector) publishHypervisorVirtualProcessor(ch chan<- prometheus.Metri
|
||||
data.HypervisorVirtualProcessorRemoteRunTimePercent,
|
||||
vmName, coreID, "remote",
|
||||
)
|
||||
// end same metric
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTotalRunTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
data.HypervisorVirtualProcessorTotalRunTimePercent,
|
||||
vmName, coreID,
|
||||
)
|
||||
// Same metric with new name for better clarity, old one is kept for backward compatibility
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorRunTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
data.HypervisorVirtualProcessorTotalRunTimePercent,
|
||||
vmName, coreID,
|
||||
)
|
||||
// end same metric
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorCPUWaitSeconds,
|
||||
prometheus.CounterValue,
|
||||
|
||||
@@ -38,7 +38,7 @@ func BenchmarkCollector(b *testing.B) {
|
||||
func TestCollector(t *testing.T) {
|
||||
metrics := testutils.TestCollector(t, hyperv.New, nil)
|
||||
testutils.RequireFixtureMetric(t, metrics, hyperv.Name, "windows_hyperv_dynamic_memory_vm_physical_bytes", prometheus.Labels{"vm": "GitHubActions"})
|
||||
testutils.RequireFixtureMetric(t, metrics, hyperv.Name, "windows_hyperv_vm_processor_count", prometheus.Labels{"vm": "GitHubActions"})
|
||||
testutils.RequireFixtureMetric(t, metrics, hyperv.Name, "windows_hyperv_vm_processors", prometheus.Labels{"vm": "GitHubActions"})
|
||||
|
||||
// An empty "Hyper-V DataStore" counter set is tolerated as an optional
|
||||
// instance group, so require a series explicitly (#2328).
|
||||
@@ -58,28 +58,33 @@ func TestCollector(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestCollectorVirtualStorageDeviceLatency checks that the deprecated latency gauges
|
||||
// expose the raw cumulative value in 100ns ticks of the *_io_latency_seconds_total counters.
|
||||
// TestCollectorVirtualStorageDeviceLatency checks that the latencies are published
|
||||
// as counters in seconds for every device, and that the removed gauges, which
|
||||
// exposed the same raw value in 100ns ticks, are gone.
|
||||
func TestCollectorVirtualStorageDeviceLatency(t *testing.T) {
|
||||
metrics := testutils.TestCollector(t, hyperv.New, &hyperv.Config{CollectorsEnabled: []string{"virtual_storage_device"}})
|
||||
|
||||
for deprecated, replacement := range map[string]string{
|
||||
"windows_hyperv_virtual_storage_device_latency_seconds": "windows_hyperv_virtual_storage_device_io_latency_seconds_total",
|
||||
"windows_hyperv_virtual_storage_device_lower_latency_seconds": "windows_hyperv_virtual_storage_device_lower_io_latency_seconds_total",
|
||||
} {
|
||||
want := testutils.MetricValuesByLabel(metrics, deprecated, "device")
|
||||
got := testutils.MetricValuesByLabel(metrics, replacement, "device")
|
||||
devices := testutils.MetricValuesByLabel(metrics, "windows_hyperv_virtual_storage_device_throughput_total", "device")
|
||||
|
||||
require.Len(t, got, len(want))
|
||||
for _, name := range []string{
|
||||
"windows_hyperv_virtual_storage_device_io_latency_seconds_total",
|
||||
"windows_hyperv_virtual_storage_device_lower_io_latency_seconds_total",
|
||||
} {
|
||||
got := testutils.MetricValuesByLabel(metrics, name, "device")
|
||||
require.Len(t, got, len(devices), name)
|
||||
|
||||
if len(got) > 0 {
|
||||
require.Equal(t, dto.MetricType_COUNTER, metrics[replacement].GetType())
|
||||
require.Equal(t, dto.MetricType_COUNTER, metrics[name].GetType())
|
||||
}
|
||||
}
|
||||
|
||||
for device, ticks := range want {
|
||||
require.Contains(t, got, device)
|
||||
require.InDelta(t, ticks*pdh.TicksToSecondScaleFactor, got[device], 1e-6, "%s{device=%q}", replacement, device)
|
||||
}
|
||||
for _, removed := range []string{
|
||||
"windows_hyperv_virtual_storage_device_latency_seconds",
|
||||
"windows_hyperv_virtual_storage_device_lower_latency_seconds",
|
||||
"windows_hyperv_virtual_storage_device_queue_length",
|
||||
"windows_hyperv_virtual_storage_device_lower_queue_length",
|
||||
} {
|
||||
require.NotContains(t, metrics, removed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +123,7 @@ func TestCollectorVirtualHardDisk(t *testing.T) {
|
||||
if metric := testutils.RequireFixtureMetric(t, metrics, hyperv.Name, "windows_hyperv_virtual_hard_disk_size_bytes", labels); metric != nil {
|
||||
device := labelValue(metric, "device")
|
||||
require.NotEmpty(t, device, "the running VM's disk has no device")
|
||||
require.Contains(t, testutils.MetricValuesByLabel(metrics, "windows_hyperv_virtual_storage_device_queue_length", "device"), device,
|
||||
require.Contains(t, testutils.MetricValuesByLabel(metrics, "windows_hyperv_virtual_storage_device_throughput_total", "device"), device,
|
||||
"device %q is not a virtual_storage_device instance", device)
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ func (c *Collector) buildVirtualMachineHealthSummary() error {
|
||||
}
|
||||
|
||||
c.health = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_machine_health_total_count"),
|
||||
"Represents the number of virtual machines with critical health",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_machines"),
|
||||
"Number of virtual machines by health state",
|
||||
[]string{"state"},
|
||||
nil,
|
||||
)
|
||||
|
||||
@@ -174,8 +174,8 @@ func (c *Collector) buildVirtualNetworkAdapterDropReasons() error {
|
||||
}
|
||||
|
||||
c.virtualNetworkAdapterDropReasons = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_drop_reasons"),
|
||||
"Hyper-V Virtual Network Adapter Drop Reasons",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_drop_reasons_total"),
|
||||
"Number of packets dropped by a Hyper-V virtual network adapter, by drop reason and direction",
|
||||
[]string{"adapter", "reason", "direction"},
|
||||
nil,
|
||||
)
|
||||
|
||||
@@ -93,56 +93,56 @@ func (c *Collector) buildVirtualSMB() error {
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBWriteBytesRDMA = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_write_bytes_rdma"),
|
||||
"Represents the number of bytes written per second using RDMA in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_rdma_write_bytes_total"),
|
||||
"Represents the total number of bytes written using RDMA in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBWriteBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_write_bytes"),
|
||||
"Represents the number of bytes written per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_write_bytes_total"),
|
||||
"Represents the total number of bytes written in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBReadBytesRDMA = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_read_bytes_rdma"),
|
||||
"Represents the number of bytes read per second using RDMA in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_rdma_read_bytes_total"),
|
||||
"Represents the total number of bytes read using RDMA in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBReadBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_read_bytes"),
|
||||
"Represents the number of bytes read per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_read_bytes_total"),
|
||||
"Represents the total number of bytes read in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBFlushRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_flush_requests"),
|
||||
"Represents the number of flush requests per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_flush_requests_total"),
|
||||
"Represents the total number of flush requests in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBWriteRequestsRDMA = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_write_requests_rdma"),
|
||||
"Represents the number of write requests per second using RDMA in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_rdma_write_requests_total"),
|
||||
"Represents the total number of write requests using RDMA in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBWriteRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_write_requests"),
|
||||
"Represents the number of write requests per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_write_requests_total"),
|
||||
"Represents the total number of write requests in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBReadRequestsRDMA = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_read_requests_rdma"),
|
||||
"Represents the number of read requests per second using RDMA in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_rdma_read_requests_total"),
|
||||
"Represents the total number of read requests using RDMA in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBReadRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_read_requests"),
|
||||
"Represents the number of read requests per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_read_requests_total"),
|
||||
"Represents the total number of read requests in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
@@ -153,32 +153,32 @@ func (c *Collector) buildVirtualSMB() error {
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBCurrentOpenFileCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_current_open_file_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_open_files"),
|
||||
"Represents the current number of open files in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBTreeConnectCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_tree_connect_count"),
|
||||
"Represents the number of tree connects in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_tree_connects_total"),
|
||||
"Represents the total number of tree connects in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_requests"),
|
||||
"Represents the number of requests per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_requests_total"),
|
||||
"Represents the total number of requests in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBSentBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_sent_bytes"),
|
||||
"Represents the number of bytes sent per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_sent_bytes_total"),
|
||||
"Represents the total number of bytes sent in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
c.virtualSMBReceivedBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_received_bytes"),
|
||||
"Represents the number of bytes received per second in the virtual SMB",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_smb_received_bytes_total"),
|
||||
"Represents the total number of bytes received in the virtual SMB",
|
||||
[]string{"instance"},
|
||||
nil,
|
||||
)
|
||||
@@ -286,7 +286,7 @@ func (c *Collector) collectVirtualSMB(ch chan<- prometheus.Metric, scrape *label
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualSMBTreeConnectCount,
|
||||
prometheus.GaugeValue,
|
||||
prometheus.CounterValue,
|
||||
data.VirtualSMBTreeConnectCount,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
@@ -32,16 +32,12 @@ type collectorVirtualStorageDevice struct {
|
||||
perfDataObjectVirtualStorageDevice []perfDataCounterValuesVirtualStorageDevice
|
||||
|
||||
virtualStorageDeviceErrorCount *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Error Count
|
||||
virtualStorageDeviceQueueLength *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Queue Length
|
||||
virtualStorageDeviceReadBytes *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Read Bytes/sec
|
||||
virtualStorageDeviceReadOperations *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Read Operations/Sec
|
||||
virtualStorageDeviceWriteBytes *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Write Bytes/sec
|
||||
virtualStorageDeviceWriteOperations *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Write Operations/Sec
|
||||
virtualStorageDeviceLatency *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Latency
|
||||
virtualStorageDeviceThroughput *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Throughput
|
||||
virtualStorageDeviceNormalizedThroughput *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Normalized Throughput
|
||||
virtualStorageDeviceLowerQueueLength *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Lower Queue Length
|
||||
virtualStorageDeviceLowerLatency *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Lower Latency
|
||||
virtualStorageDeviceIOQuotaReplenishmentRate *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\IO Quota Replenishment Rate
|
||||
virtualStorageDeviceIOLatency *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Latency
|
||||
virtualStorageDeviceLowerIOLatency *prometheus.Desc // \Hyper-V Virtual Storage Device(*)\Lower Latency
|
||||
@@ -51,7 +47,6 @@ type perfDataCounterValuesVirtualStorageDevice struct {
|
||||
Name string
|
||||
|
||||
VirtualStorageDeviceErrorCount float64 `perfdata:"Error Count"`
|
||||
VirtualStorageDeviceQueueLength float64 `perfdata:"Queue Length"`
|
||||
VirtualStorageDeviceReadBytes float64 `perfdata:"Read Bytes/sec"`
|
||||
VirtualStorageDeviceReadOperations float64 `perfdata:"Read Count"`
|
||||
VirtualStorageDeviceWriteBytes float64 `perfdata:"Write Bytes/sec"`
|
||||
@@ -59,7 +54,6 @@ type perfDataCounterValuesVirtualStorageDevice struct {
|
||||
VirtualStorageDeviceLatency float64 `perfdata:"Latency"`
|
||||
VirtualStorageDeviceThroughput float64 `perfdata:"Throughput"`
|
||||
VirtualStorageDeviceNormalizedThroughput float64 `perfdata:"Normalized Throughput"`
|
||||
VirtualStorageDeviceLowerQueueLength float64 `perfdata:"Lower Queue Length"`
|
||||
VirtualStorageDeviceLowerLatency float64 `perfdata:"Lower Latency"`
|
||||
VirtualStorageDeviceIOQuotaReplenishmentRate float64 `perfdata:"IO Quota Replenishment Rate"`
|
||||
}
|
||||
@@ -79,20 +73,13 @@ func (c *Collector) buildVirtualStorageDevice() error {
|
||||
|
||||
func (c *Collector) buildVirtualStorageDeviceDescriptors() {
|
||||
c.virtualStorageDeviceErrorCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_error_count_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_errors_total"),
|
||||
"Represents the total number of errors that have occurred on this virtual device.",
|
||||
[]string{"device"},
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_queue_length"),
|
||||
"DEPRECATED: use rate(windows_hyperv_virtual_storage_device_io_latency_seconds_total). "+
|
||||
"Cumulative queue length in 100ns ticks, identical to the raw latency.",
|
||||
[]string{"device"},
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceReadBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_bytes_read"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_read_bytes_total"),
|
||||
"Represents the total number of bytes that have been read on this virtual device.",
|
||||
[]string{"device"},
|
||||
nil,
|
||||
@@ -104,7 +91,7 @@ func (c *Collector) buildVirtualStorageDeviceDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceWriteBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_bytes_written"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_written_bytes_total"),
|
||||
"Represents the total number of bytes that have been written on this virtual device.",
|
||||
[]string{"device"},
|
||||
nil,
|
||||
@@ -115,13 +102,6 @@ func (c *Collector) buildVirtualStorageDeviceDescriptors() {
|
||||
[]string{"device"},
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_latency_seconds"),
|
||||
"DEPRECATED: use windows_hyperv_virtual_storage_device_io_latency_seconds_total. "+
|
||||
"Cumulative IO transfer latency in 100ns ticks for this virtual device.",
|
||||
[]string{"device"},
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceThroughput = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_throughput_total"),
|
||||
"Represents the total number of IO transfers completed by this virtual device.",
|
||||
@@ -134,20 +114,6 @@ func (c *Collector) buildVirtualStorageDeviceDescriptors() {
|
||||
[]string{"device"},
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceLowerQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_lower_queue_length"),
|
||||
"DEPRECATED: use rate(windows_hyperv_virtual_storage_device_lower_io_latency_seconds_total). "+
|
||||
"Cumulative queue length in 100ns ticks on the underlying storage subsystem, identical to the raw lower latency.",
|
||||
[]string{"device"},
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceLowerLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_lower_latency_seconds"),
|
||||
"DEPRECATED: use windows_hyperv_virtual_storage_device_lower_io_latency_seconds_total. "+
|
||||
"Cumulative IO transfer latency in 100ns ticks on the underlying storage subsystem for this virtual device.",
|
||||
[]string{"device"},
|
||||
nil,
|
||||
)
|
||||
c.virtualStorageDeviceIOLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_storage_device_io_latency_seconds_total"),
|
||||
"Represents the total IO transfer latency for this virtual device. "+
|
||||
@@ -190,13 +156,6 @@ func (c *Collector) publishVirtualStorageDevice(ch chan<- prometheus.Metric, scr
|
||||
data.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualStorageDeviceQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data.VirtualStorageDeviceQueueLength,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualStorageDeviceReadBytes,
|
||||
prometheus.CounterValue,
|
||||
@@ -225,13 +184,6 @@ func (c *Collector) publishVirtualStorageDevice(ch chan<- prometheus.Metric, scr
|
||||
data.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualStorageDeviceLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.VirtualStorageDeviceLatency,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualStorageDeviceThroughput,
|
||||
prometheus.CounterValue,
|
||||
@@ -246,20 +198,6 @@ func (c *Collector) publishVirtualStorageDevice(ch chan<- prometheus.Metric, scr
|
||||
data.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualStorageDeviceLowerQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data.VirtualStorageDeviceLowerQueueLength,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualStorageDeviceLowerLatency,
|
||||
prometheus.GaugeValue,
|
||||
data.VirtualStorageDeviceLowerLatency,
|
||||
data.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualStorageDeviceIOQuotaReplenishmentRate,
|
||||
prometheus.CounterValue,
|
||||
|
||||
@@ -130,7 +130,7 @@ func (c *Collector) buildAppPoolWASDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.totalApplicationPoolRecycles = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "total_application_pool_recycles"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "application_pool_recycles_total"),
|
||||
"The number of times that the application pool has been recycled since Windows Process Activation Service (WAS) started (TotalApplicationPoolRecycles)",
|
||||
[]string{"app"},
|
||||
nil,
|
||||
@@ -142,31 +142,31 @@ func (c *Collector) buildAppPoolWASDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.totalWorkerProcessesCreated = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "total_worker_processes_created"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "worker_processes_created_total"),
|
||||
"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"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "worker_process_failures_total"),
|
||||
"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"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "worker_process_ping_failures_total"),
|
||||
"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"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "worker_process_shutdown_failures_total"),
|
||||
"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"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "worker_process_startup_failures_total"),
|
||||
"The number of times that Windows Process Activation Service (WAS) failed to start a worker process (TotalWorkerProcessStartupFailures)",
|
||||
[]string{"app"},
|
||||
nil,
|
||||
|
||||
@@ -573,7 +573,7 @@ func (c *Collector) collectW3SVCW3WPv7(ch chan<- prometheus.Metric) error {
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.w3SVCW3WPMaximumFileCacheMemoryUsage,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
data.W3SVCW3WPMaximumFileCacheMemoryUsage,
|
||||
name,
|
||||
pid,
|
||||
|
||||
@@ -144,7 +144,7 @@ func (c *Collector) buildWebService() error {
|
||||
nil,
|
||||
)
|
||||
c.webServiceServiceUptime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "service_uptime"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "service_uptime_seconds"),
|
||||
"Number of seconds the WebService is up (WebService.ServiceUptime)",
|
||||
[]string{"site"},
|
||||
nil,
|
||||
@@ -204,7 +204,7 @@ func (c *Collector) buildWebService() error {
|
||||
nil,
|
||||
)
|
||||
c.webServiceTotalISAPIExtensionRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ipapi_extension_requests_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "isapi_extension_requests_total"),
|
||||
"ISAPI Extension Requests received (WebService.TotalISAPIExtensionRequests)",
|
||||
[]string{"site"},
|
||||
nil,
|
||||
|
||||
@@ -307,7 +307,7 @@ func (c *Collector) collectWebServiceCache(ch chan<- prometheus.Metric) error {
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.serviceCacheMaximumFileCacheMemoryUsage,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
data.ServiceCacheMaximumFileCacheMemoryUsage,
|
||||
)
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ func TestAppPoolWASUptimeMetrics(t *testing.T) {
|
||||
requireMetric(t, metrics, "windows_iis_current_application_pool_uptime_seconds", dto.MetricType_GAUGE, 298, app)
|
||||
requireMetric(t, metrics, "windows_iis_total_application_pool_uptime_seconds", dto.MetricType_GAUGE, 600, app)
|
||||
requireMetric(t, metrics, "windows_iis_time_since_last_worker_process_failure_seconds", dto.MetricType_GAUGE, 298, app)
|
||||
requireMetric(t, metrics, "windows_iis_total_application_pool_recycles", dto.MetricType_COUNTER, 2, app)
|
||||
requireMetric(t, metrics, "windows_iis_application_pool_recycles_total", dto.MetricType_COUNTER, 2, app)
|
||||
require.NotContains(t, metrics, "windows_iis_current_application_pool_start_time")
|
||||
require.NotContains(t, metrics, "windows_iis_total_application_pool_start_time")
|
||||
}
|
||||
|
||||
@@ -62,3 +62,13 @@
|
||||
build-dependent rules of `objectField`), owner node and node names. Objects
|
||||
with missing fields are not cached, so they report the same errors on every
|
||||
scrape. Shared volume sizes change constantly and are not cached.
|
||||
- Many cluster, group and resource properties are durations or sizes in
|
||||
milliseconds, minutes, hours, KiB or MiB (for example
|
||||
`ClusSvcRegroupTickInMilliseconds`, `ShutdownTimeoutInMinutes`,
|
||||
`FailoverPeriod` in hours, `S2DCachePageSizeKBytes`, `ClusterLogSize` in
|
||||
MiB). Publish them in base units with a unit suffix: set `objectField.scale`
|
||||
for cluster and group fields and `fieldScales` for resources. The parity
|
||||
tests feed WMI values through the same scale, so they cannot catch a wrong
|
||||
factor; check units against a live cluster (`Get-Cluster | Format-List *`).
|
||||
The WMI help texts are not reliable: `QuarantineDuration` is seconds
|
||||
(default 7200), not milliseconds.
|
||||
|
||||
@@ -92,12 +92,10 @@ type collectorCluster struct {
|
||||
clusterQuarantineThreshold *prometheus.Desc
|
||||
clusterQuorumArbitrationTimeMax *prometheus.Desc
|
||||
clusterQuorumArbitrationTimeMin *prometheus.Desc
|
||||
clusterQuorumLogFileSize *prometheus.Desc
|
||||
clusterQuorumTypeValue *prometheus.Desc
|
||||
clusterRequestReplyTimeout *prometheus.Desc
|
||||
clusterResiliencyDefaultPeriod *prometheus.Desc
|
||||
clusterResiliencyLevel *prometheus.Desc
|
||||
clusterResourceDllDeadlockPeriod *prometheus.Desc
|
||||
clusterRootMemoryReserved *prometheus.Desc
|
||||
clusterRouteHistoryLength *prometheus.Desc
|
||||
clusterS2DBusTypes *prometheus.Desc
|
||||
@@ -177,12 +175,10 @@ type msClusterCluster struct {
|
||||
QuarantineThreshold uint `mi:"QuarantineThreshold"`
|
||||
QuorumArbitrationTimeMax uint `mi:"QuorumArbitrationTimeMax"`
|
||||
QuorumArbitrationTimeMin uint `mi:"QuorumArbitrationTimeMin"`
|
||||
QuorumLogFileSize uint `mi:"QuorumLogFileSize"`
|
||||
QuorumTypeValue uint `mi:"QuorumTypeValue"`
|
||||
RequestReplyTimeout uint `mi:"RequestReplyTimeout"`
|
||||
ResiliencyDefaultPeriod uint `mi:"ResiliencyDefaultPeriod"`
|
||||
ResiliencyLevel uint `mi:"ResiliencyLevel"`
|
||||
ResourceDllDeadlockPeriod uint `mi:"ResourceDllDeadlockPeriod"`
|
||||
RootMemoryReserved uint `mi:"RootMemoryReserved"`
|
||||
RouteHistoryLength uint `mi:"RouteHistoryLength"`
|
||||
S2DBusTypes uint `mi:"S2DBusTypes"`
|
||||
@@ -218,8 +214,8 @@ func (c *Collector) buildCluster() error {
|
||||
|
||||
func (c *Collector) buildClusterDescriptors() {
|
||||
c.clusterAddEvictDelay = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "add_evict_delay"),
|
||||
"Provides access to the cluster's AddEvictDelay property, which is the number a seconds that a new node is delayed after an eviction of another node.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "add_evict_delay_seconds"),
|
||||
"Provides access to the cluster's AddEvictDelay property, which is the number of seconds that a new node is delayed after an eviction of another node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -254,38 +250,38 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterBlockCacheSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "block_cache_size"),
|
||||
"CSV BlockCache Size in MB.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "block_cache_size_bytes"),
|
||||
"CSV BlockCache size in bytes.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterClusSvcHangTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_hang_timeout"),
|
||||
"Controls how long the cluster network driver waits between Failover Cluster Service heartbeats before it determines that the Failover Cluster Service has stopped responding.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_hang_timeout_seconds"),
|
||||
"Controls how long, in seconds, the cluster network driver waits between Failover Cluster Service heartbeats before it determines that the Failover Cluster Service has stopped responding.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterClusSvcRegroupOpeningTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_opening_timeout"),
|
||||
"Controls how long a node will wait on other nodes in the opening stage before deciding that they failed.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_opening_timeout_seconds"),
|
||||
"Controls how long, in seconds, a node will wait on other nodes in the opening stage before deciding that they failed.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterClusSvcRegroupPruningTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_pruning_timeout"),
|
||||
"Controls how long the membership leader will wait to reach full connectivity between cluster nodes.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_pruning_timeout_seconds"),
|
||||
"Controls how long, in seconds, the membership leader will wait to reach full connectivity between cluster nodes.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterClusSvcRegroupStageTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_stage_timeout"),
|
||||
"Controls how long a node will wait on other nodes in a membership stage before deciding that they failed.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_stage_timeout_seconds"),
|
||||
"Controls how long, in seconds, a node will wait on other nodes in a membership stage before deciding that they failed.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterClusSvcRegroupTickInMilliseconds = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_tick_in_milliseconds"),
|
||||
"Controls how frequently the membership algorithm is sending periodic membership messages.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "clus_svc_regroup_tick_seconds"),
|
||||
"Controls how frequently, in seconds, the membership algorithm is sending periodic membership messages.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -302,7 +298,7 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterClusterGroupWaitDelay = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cluster_group_wait_delay"),
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cluster_group_wait_delay_seconds"),
|
||||
"Maximum time in seconds that a group waits for its preferred node to come online during cluster startup before coming online on a different node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
@@ -314,8 +310,8 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterClusterLogSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cluster_log_size"),
|
||||
"Controls the maximum size of the cluster log files on each of the nodes.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cluster_log_size_bytes"),
|
||||
"Controls the maximum size, in bytes, of the cluster log files on each of the nodes.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -326,8 +322,8 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterCrossSiteDelay = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cross_site_delay"),
|
||||
"Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats across sites.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cross_site_delay_seconds"),
|
||||
"Controls how long the cluster network driver waits in seconds between sending Cluster Service heartbeats across sites.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -338,8 +334,8 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterCrossSubnetDelay = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cross_subnet_delay"),
|
||||
"Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats across subnets.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "cross_subnet_delay_seconds"),
|
||||
"Controls how long the cluster network driver waits in seconds between sending Cluster Service heartbeats across subnets.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -422,14 +418,14 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterGracePeriodTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "grace_period_timeout"),
|
||||
"The grace period timeout in milliseconds.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "grace_period_timeout_seconds"),
|
||||
"The grace period timeout in seconds.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterGroupDependencyTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "group_dependency_timeout"),
|
||||
"The timeout after which a group will be brought online despite unsatisfied dependencies",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "group_dependency_timeout_seconds"),
|
||||
"The timeout in seconds after which a group will be brought online despite unsatisfied dependencies",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -506,8 +502,8 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterQuarantineDuration = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "quarantine_duration"),
|
||||
"The quarantine period timeout in milliseconds.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "quarantine_duration_seconds"),
|
||||
"The quarantine period timeout in seconds.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -518,20 +514,14 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterQuorumArbitrationTimeMax = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "quorum_arbitration_time_max"),
|
||||
"Controls the maximum time necessary to decide the Quorum owner node.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "quorum_arbitration_time_max_seconds"),
|
||||
"Controls the maximum time, in seconds, necessary to decide the Quorum owner node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterQuorumArbitrationTimeMin = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "quorum_arbitration_time_min"),
|
||||
"Controls the minimum time necessary to decide the Quorum owner node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterQuorumLogFileSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "quorum_log_file_size"),
|
||||
"This property is obsolete.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "quorum_arbitration_time_min_seconds"),
|
||||
"Controls the minimum time, in seconds, necessary to decide the Quorum owner node.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -542,13 +532,13 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterRequestReplyTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "request_reply_timeout"),
|
||||
"Controls the request reply time-out period.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "request_reply_timeout_seconds"),
|
||||
"Controls the request reply time-out period in seconds.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterResiliencyDefaultPeriod = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "resiliency_default_period"),
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "resiliency_default_period_seconds"),
|
||||
"The default resiliency period, in seconds, for the cluster.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
@@ -559,15 +549,9 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterResourceDllDeadlockPeriod = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "resource_dll_deadlock_period"),
|
||||
"This property is obsolete.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterRootMemoryReserved = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "root_memory_reserved"),
|
||||
"Controls the amount of memory reserved for the parent partition on all cluster nodes.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "root_memory_reserved_bytes"),
|
||||
"Controls the amount of memory, in bytes, reserved for the parent partition on all cluster nodes.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -590,14 +574,14 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterS2DCacheFlashReservePercent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "s2d_cache_flash_reserve_percent"),
|
||||
"Percentage of allocated flash space to utilize when caching.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "s2d_cache_flash_reserve_ratio"),
|
||||
"Ratio (0-1) of allocated flash space to utilize when caching.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterS2DCachePageSizeKBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "s2d_cache_page_size_k_bytes"),
|
||||
"Page size in KB used by S2D cache.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "s2d_cache_page_size_bytes"),
|
||||
"Page size in bytes used by S2D cache.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -608,8 +592,8 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterS2DIOLatencyThreshold = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "s2dio_latency_threshold"),
|
||||
"The I/O latency threshold for storage spaces direct.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "s2dio_latency_threshold_seconds"),
|
||||
"The I/O latency threshold in seconds for storage spaces direct.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -620,8 +604,8 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterSameSubnetDelay = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "same_subnet_delay"),
|
||||
"Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats on the same subnet.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "same_subnet_delay_seconds"),
|
||||
"Controls how long the cluster network driver waits in seconds between sending Cluster Service heartbeats on the same subnet.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -644,14 +628,14 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterSharedVolumeVssWriterOperationTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "shared_volume_vss_writer_operation_timeout"),
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "shared_volume_vss_writer_operation_timeout_seconds"),
|
||||
"CSV VSS Writer operation timeout in seconds.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.clusterShutdownTimeoutInMinutes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "shutdown_timeout_in_minutes"),
|
||||
"The maximum time in minutes allowed for cluster resources to come offline during cluster service shutdown.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "shutdown_timeout_seconds"),
|
||||
"The maximum time in seconds allowed for cluster resources to come offline during cluster service shutdown.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -662,7 +646,7 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterWitnessDatabaseWriteTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "witness_database_write_timeout"),
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "witness_database_write_timeout_seconds"),
|
||||
"Controls the maximum time in seconds that a cluster database write to a witness can take before the write is abandoned.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
@@ -674,8 +658,8 @@ func (c *Collector) buildClusterDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.clusterWitnessRestartInterval = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "witness_restart_interval"),
|
||||
"Controls the witness restart interval.",
|
||||
prometheus.BuildFQName(types.Namespace, nameCluster, "witness_restart_interval_seconds"),
|
||||
"Controls the witness restart interval in seconds.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -716,21 +700,21 @@ func (c *Collector) publishCluster(ch chan<- prometheus.Metric, cluster clusapi.
|
||||
{name: "AutoBalancerLevel", desc: c.clusterAutoBalancerLevel, minBuild: ws2016},
|
||||
{name: "AutoBalancerMode", desc: c.clusterAutoBalancerMode, minBuild: ws2016},
|
||||
{name: "BackupInProgress", desc: c.clusterBackupInProgress},
|
||||
{name: "BlockCacheSize", desc: c.clusterBlockCacheSize},
|
||||
{name: "BlockCacheSize", desc: c.clusterBlockCacheSize, scale: 1 << 20},
|
||||
{name: "ClusSvcHangTimeout", desc: c.clusterClusSvcHangTimeout},
|
||||
{name: "ClusSvcRegroupOpeningTimeout", desc: c.clusterClusSvcRegroupOpeningTimeout, absent: zero},
|
||||
{name: "ClusSvcRegroupPruningTimeout", desc: c.clusterClusSvcRegroupPruningTimeout, absent: zero},
|
||||
{name: "ClusSvcRegroupStageTimeout", desc: c.clusterClusSvcRegroupStageTimeout},
|
||||
{name: "ClusSvcRegroupTickInMilliseconds", desc: c.clusterClusSvcRegroupTickInMilliseconds},
|
||||
{name: "ClusSvcRegroupTickInMilliseconds", desc: c.clusterClusSvcRegroupTickInMilliseconds, scale: 1e-3},
|
||||
{name: "ClusterEnforcedAntiAffinity", desc: c.clusterClusterEnforcedAntiAffinity},
|
||||
{name: "ClusterFunctionalLevel", desc: c.clusterClusterFunctionalLevel, minBuild: ws2016},
|
||||
{name: "ClusterGroupWaitDelay", desc: c.clusterClusterGroupWaitDelay},
|
||||
{name: "ClusterLogLevel", desc: c.clusterClusterLogLevel},
|
||||
{name: "ClusterLogSize", desc: c.clusterClusterLogSize},
|
||||
{name: "ClusterLogSize", desc: c.clusterClusterLogSize, scale: 1 << 20},
|
||||
{name: "ClusterUpgradeVersion", desc: c.clusterClusterUpgradeVersion, minBuild: ws2016},
|
||||
{name: "CrossSiteDelay", desc: c.clusterCrossSiteDelay, minBuild: ws2016},
|
||||
{name: "CrossSiteDelay", desc: c.clusterCrossSiteDelay, scale: 1e-3, minBuild: ws2016},
|
||||
{name: "CrossSiteThreshold", desc: c.clusterCrossSiteThreshold, minBuild: ws2016},
|
||||
{name: "CrossSubnetDelay", desc: c.clusterCrossSubnetDelay},
|
||||
{name: "CrossSubnetDelay", desc: c.clusterCrossSubnetDelay, scale: 1e-3},
|
||||
{name: "CrossSubnetThreshold", desc: c.clusterCrossSubnetThreshold},
|
||||
{name: "CsvBalancer", desc: c.clusterCsvBalancer},
|
||||
{name: "DatabaseReadWriteMode", desc: c.clusterDatabaseReadWriteMode},
|
||||
@@ -741,7 +725,7 @@ func (c *Collector) publishCluster(ch chan<- prometheus.Metric, cluster clusapi.
|
||||
{name: "EnableSharedVolumes", desc: c.clusterEnableSharedVolumes},
|
||||
{name: "FixQuorum", desc: c.clusterFixQuorum},
|
||||
{name: "GracePeriodEnabled", desc: c.clusterGracePeriodEnabled, minBuild: ws2016, absent: zero},
|
||||
{name: "GracePeriodTimeout", desc: c.clusterGracePeriodTimeout, minBuild: ws2016, absent: zero},
|
||||
{name: "GracePeriodTimeout", desc: c.clusterGracePeriodTimeout, scale: 1e-3, minBuild: ws2016, absent: zero},
|
||||
{name: "GroupDependencyTimeout", desc: c.clusterGroupDependencyTimeout, minBuild: ws2016},
|
||||
{name: "HangRecoveryAction", desc: c.clusterHangRecoveryAction},
|
||||
{name: "IgnorePersistentStateOnStartup", desc: c.clusterIgnorePersistentStateOnStartup},
|
||||
@@ -758,26 +742,24 @@ func (c *Collector) publishCluster(ch chan<- prometheus.Metric, cluster clusapi.
|
||||
{name: "QuarantineThreshold", desc: c.clusterQuarantineThreshold, minBuild: ws2016},
|
||||
{name: "QuorumArbitrationTimeMax", desc: c.clusterQuorumArbitrationTimeMax},
|
||||
{name: "QuorumArbitrationTimeMin", desc: c.clusterQuorumArbitrationTimeMin, absent: zero},
|
||||
{name: "QuorumLogFileSize", desc: c.clusterQuorumLogFileSize},
|
||||
{name: "QuorumTypeValue", desc: c.clusterQuorumTypeValue},
|
||||
{name: "RequestReplyTimeout", desc: c.clusterRequestReplyTimeout},
|
||||
{name: "ResiliencyDefaultPeriod", desc: c.clusterResiliencyDefaultPeriod, minBuild: ws2016},
|
||||
{name: "ResiliencyLevel", desc: c.clusterResiliencyLevel, minBuild: ws2016},
|
||||
{name: "ResourceDllDeadlockPeriod", desc: c.clusterResourceDllDeadlockPeriod, absent: zero},
|
||||
{name: "RootMemoryReserved", desc: c.clusterRootMemoryReserved, absent: zero},
|
||||
{name: "RootMemoryReserved", desc: c.clusterRootMemoryReserved, scale: 1 << 20, absent: zero},
|
||||
{name: "RouteHistoryLength", desc: c.clusterRouteHistoryLength},
|
||||
{name: "S2DBusTypes", desc: c.clusterS2DBusTypes, minBuild: ws2016},
|
||||
{name: "S2DCacheDesiredState", desc: c.clusterS2DCacheDesiredState, minBuild: ws2016},
|
||||
{name: "S2DCacheFlashReservePercent", desc: c.clusterS2DCacheFlashReservePercent, minBuild: ws2016},
|
||||
{name: "S2DCachePageSizeKBytes", desc: c.clusterS2DCachePageSizeKBytes, minBuild: ws2016},
|
||||
{name: "S2DCacheFlashReservePercent", desc: c.clusterS2DCacheFlashReservePercent, scale: 1e-2, minBuild: ws2016},
|
||||
{name: "S2DCachePageSizeKBytes", desc: c.clusterS2DCachePageSizeKBytes, scale: 1 << 10, minBuild: ws2016},
|
||||
{name: "S2DEnabled", desc: c.clusterS2DEnabled, minBuild: ws2016},
|
||||
{name: "S2DIOLatencyThreshold", desc: c.clusterS2DIOLatencyThreshold, minBuild: ws2016},
|
||||
{name: "S2DIOLatencyThreshold", desc: c.clusterS2DIOLatencyThreshold, scale: 1e-3, minBuild: ws2016},
|
||||
{name: "S2DOptimizations", desc: c.clusterS2DOptimizations, minBuild: ws2016},
|
||||
{name: "SameSubnetDelay", desc: c.clusterSameSubnetDelay},
|
||||
{name: "SameSubnetDelay", desc: c.clusterSameSubnetDelay, scale: 1e-3},
|
||||
{name: "SameSubnetThreshold", desc: c.clusterSameSubnetThreshold},
|
||||
{name: "SecurityLevel", desc: c.clusterSecurityLevel},
|
||||
{name: "SharedVolumeVssWriterOperationTimeout", desc: c.clusterSharedVolumeVssWriterOperationTimeout},
|
||||
{name: "ShutdownTimeoutInMinutes", desc: c.clusterShutdownTimeoutInMinutes},
|
||||
{name: "ShutdownTimeoutInMinutes", desc: c.clusterShutdownTimeoutInMinutes, scale: 60},
|
||||
{name: "UseClientAccessNetworksForSharedVolumes", desc: c.clusterUseClientAccessNetworksForSharedVolumes},
|
||||
{name: "WitnessDatabaseWriteTimeout", desc: c.clusterWitnessDatabaseWriteTimeout},
|
||||
{name: "WitnessDynamicWeight", desc: c.clusterWitnessDynamicWeight},
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"math"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -115,18 +116,26 @@ func TestClusterNativeMetricContract(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
for metric, property := range map[string]string{
|
||||
"add_evict_delay": "AddEvictDelay",
|
||||
"s2dio_latency_threshold": "S2DIOLatencyThreshold",
|
||||
"s2d_cache_page_size_k_bytes": "S2DCachePageSizeKBytes",
|
||||
"netft_ip_sec_enabled": "NetftIPSecEnabled",
|
||||
"detected_cloud_platform": "DetectedCloudPlatform",
|
||||
"lower_quorum_priority_node_id": "LowerQuorumPriorityNodeId",
|
||||
"detect_managed_events_threshold": "DetectManagedEventsThreshold",
|
||||
"quorum_type_value": "QuorumTypeValue",
|
||||
// Scale converts the raw property to the base unit of the metric.
|
||||
for metric, field := range map[string]struct {
|
||||
property string
|
||||
scale float64
|
||||
}{
|
||||
"add_evict_delay_seconds": {"AddEvictDelay", 1},
|
||||
"s2dio_latency_threshold_seconds": {"S2DIOLatencyThreshold", 1e-3},
|
||||
"s2d_cache_page_size_bytes": {"S2DCachePageSizeKBytes", 1024},
|
||||
"s2d_cache_flash_reserve_ratio": {"S2DCacheFlashReservePercent", 1e-2},
|
||||
"clus_svc_regroup_tick_seconds": {"ClusSvcRegroupTickInMilliseconds", 1e-3},
|
||||
"shutdown_timeout_seconds": {"ShutdownTimeoutInMinutes", 60},
|
||||
"cluster_log_size_bytes": {"ClusterLogSize", 1 << 20},
|
||||
"netft_ip_sec_enabled": {"NetftIPSecEnabled", 1},
|
||||
"detected_cloud_platform": {"DetectedCloudPlatform", 1},
|
||||
"lower_quorum_priority_node_id": {"LowerQuorumPriorityNodeId", 1},
|
||||
"detect_managed_events_threshold": {"DetectManagedEventsThreshold", 1},
|
||||
"quorum_type_value": {"QuorumTypeValue", 1},
|
||||
} {
|
||||
got := families["windows_mscluster_cluster_"+metric].GetMetric()[0].GetGauge().GetValue()
|
||||
if want := float64(cluster.Values[property]); got != want {
|
||||
if want := float64(cluster.Values[field.property]) * field.scale; math.Abs(got-want) > 1e-9*math.Max(1, math.Abs(want)) {
|
||||
t.Errorf("%s = %v, want %v", metric, got, want)
|
||||
}
|
||||
}
|
||||
@@ -167,7 +176,7 @@ func TestClusterWMISynthesizedValues(t *testing.T) {
|
||||
cluster := clusterFixture()
|
||||
synthesized := map[string]float64{
|
||||
"ClusSvcRegroupOpeningTimeout": 0, "ClusSvcRegroupPruningTimeout": 0, "DisableGroupPreferredOwnerRandomization": 0,
|
||||
"GracePeriodEnabled": 0, "GracePeriodTimeout": 0, "QuorumArbitrationTimeMin": 0, "ResourceDllDeadlockPeriod": 0,
|
||||
"GracePeriodEnabled": 0, "GracePeriodTimeout": 0, "QuorumArbitrationTimeMin": 0,
|
||||
"RootMemoryReserved": 0, "MaxNumberOfNodes": 64,
|
||||
}
|
||||
|
||||
@@ -180,7 +189,7 @@ func TestClusterWMISynthesizedValues(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, name := range []string{"clus_svc_regroup_opening_timeout", "grace_period_enabled", "root_memory_reserved"} {
|
||||
for _, name := range []string{"clus_svc_regroup_opening_timeout_seconds", "grace_period_enabled", "root_memory_reserved_bytes"} {
|
||||
if got := families["windows_mscluster_cluster_"+name].GetMetric()[0].GetGauge().GetValue(); got != 0 {
|
||||
t.Errorf("%s = %v", name, got)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
// clusterParityQuery is the query of the previous WMI implementation.
|
||||
func clusterParityQuery() string {
|
||||
query := "SELECT Name,AddEvictDelay,AdminAccessPoint,AutoAssignNodeSite,AutoBalancerLevel,AutoBalancerMode,BackupInProgress,BlockCacheSize,ClusSvcHangTimeout,ClusSvcRegroupOpeningTimeout,ClusSvcRegroupPruningTimeout,ClusSvcRegroupStageTimeout,ClusSvcRegroupTickInMilliseconds,ClusterEnforcedAntiAffinity,ClusterFunctionalLevel,ClusterGroupWaitDelay,ClusterLogLevel,ClusterLogSize,ClusterUpgradeVersion,CrossSiteDelay,CrossSiteThreshold,CrossSubnetDelay,CrossSubnetThreshold,CsvBalancer,DatabaseReadWriteMode,DefaultNetworkRole,DisableGroupPreferredOwnerRandomization,DrainOnShutdown,DynamicQuorumEnabled,EnableSharedVolumes,FixQuorum,GracePeriodEnabled,GracePeriodTimeout,GroupDependencyTimeout,HangRecoveryAction,IgnorePersistentStateOnStartup,LogResourceControls,LowerQuorumPriorityNodeId,MessageBufferLength,MinimumNeverPreemptPriority,MinimumPreemptorPriority,NetftIPSecEnabled,PlacementOptions,PlumbAllCrossSubnetRoutes,PreventQuorum,QuarantineDuration,QuarantineThreshold,QuorumArbitrationTimeMax,QuorumArbitrationTimeMin,QuorumLogFileSize,QuorumTypeValue,RequestReplyTimeout,ResiliencyDefaultPeriod,ResiliencyLevel,ResourceDllDeadlockPeriod,RootMemoryReserved,RouteHistoryLength,S2DBusTypes,S2DCacheDesiredState,S2DCacheFlashReservePercent,S2DCachePageSizeKBytes,S2DEnabled,S2DIOLatencyThreshold,S2DOptimizations,SameSubnetDelay,SameSubnetThreshold,SecurityLevel,SharedVolumeVssWriterOperationTimeout,ShutdownTimeoutInMinutes,UseClientAccessNetworksForSharedVolumes,WitnessDatabaseWriteTimeout,WitnessDynamicWeight,WitnessRestartInterval"
|
||||
query := "SELECT Name,AddEvictDelay,AdminAccessPoint,AutoAssignNodeSite,AutoBalancerLevel,AutoBalancerMode,BackupInProgress,BlockCacheSize,ClusSvcHangTimeout,ClusSvcRegroupOpeningTimeout,ClusSvcRegroupPruningTimeout,ClusSvcRegroupStageTimeout,ClusSvcRegroupTickInMilliseconds,ClusterEnforcedAntiAffinity,ClusterFunctionalLevel,ClusterGroupWaitDelay,ClusterLogLevel,ClusterLogSize,ClusterUpgradeVersion,CrossSiteDelay,CrossSiteThreshold,CrossSubnetDelay,CrossSubnetThreshold,CsvBalancer,DatabaseReadWriteMode,DefaultNetworkRole,DisableGroupPreferredOwnerRandomization,DrainOnShutdown,DynamicQuorumEnabled,EnableSharedVolumes,FixQuorum,GracePeriodEnabled,GracePeriodTimeout,GroupDependencyTimeout,HangRecoveryAction,IgnorePersistentStateOnStartup,LogResourceControls,LowerQuorumPriorityNodeId,MessageBufferLength,MinimumNeverPreemptPriority,MinimumPreemptorPriority,NetftIPSecEnabled,PlacementOptions,PlumbAllCrossSubnetRoutes,PreventQuorum,QuarantineDuration,QuarantineThreshold,QuorumArbitrationTimeMax,QuorumArbitrationTimeMin,QuorumTypeValue,RequestReplyTimeout,ResiliencyDefaultPeriod,ResiliencyLevel,RootMemoryReserved,RouteHistoryLength,S2DBusTypes,S2DCacheDesiredState,S2DCacheFlashReservePercent,S2DCachePageSizeKBytes,S2DEnabled,S2DIOLatencyThreshold,S2DOptimizations,SameSubnetDelay,SameSubnetThreshold,SecurityLevel,SharedVolumeVssWriterOperationTimeout,ShutdownTimeoutInMinutes,UseClientAccessNetworksForSharedVolumes,WitnessDatabaseWriteTimeout,WitnessDynamicWeight,WitnessRestartInterval"
|
||||
if osversion.Build() >= osversion.LTSC2022 {
|
||||
query += ",DetectManagedEvents,SecurityLevelForStorage,MaxNumberOfNodes,DetectManagedEventsThreshold,DetectedCloudPlatform"
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ type objectField struct {
|
||||
desc *prometheus.Desc
|
||||
// Signed fields are sint32 in WMI, so 0xFFFFFFFF is published as -1.
|
||||
signed bool
|
||||
// Scale, if set, converts the raw value to the base unit of the metric,
|
||||
// for example 1e-3 for milliseconds to seconds.
|
||||
scale float64
|
||||
// MinBuild is the first Windows build that has the property.
|
||||
minBuild uint16
|
||||
older beforeMinBuild
|
||||
@@ -91,6 +94,10 @@ func (field objectField) metric(raw uint32, name string) prometheus.Metric {
|
||||
value = float64(int32(raw))
|
||||
}
|
||||
|
||||
if field.scale != 0 {
|
||||
value *= field.scale
|
||||
}
|
||||
|
||||
return prometheus.MustNewConstMetric(field.desc, prometheus.GaugeValue, value, name)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ package mscluster
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/clusapi"
|
||||
@@ -109,8 +110,8 @@ func (c *Collector) buildResourceDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.resourceDeadlockTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "deadlock_timeout"),
|
||||
"Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "deadlock_timeout_seconds"),
|
||||
"Indicates the length of time to wait, in seconds, before declaring a deadlock in any call into a resource.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
)
|
||||
@@ -127,14 +128,14 @@ func (c *Collector) buildResourceDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.resourceIsAlivePollInterval = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "is_alive_poll_interval"),
|
||||
"Provides access to the resource's IsAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it is operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the IsAlivePollInterval property for the resource type associated with the resource.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "is_alive_poll_interval_seconds"),
|
||||
"Provides access to the resource's IsAlivePollInterval property, which is the recommended interval in seconds at which the Cluster Service should poll the resource to determine whether it is operational. The series is omitted while the resource uses the interval of its resource type (0xFFFFFFFF).",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
)
|
||||
c.resourceLooksAlivePollInterval = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "looks_alive_poll_interval"),
|
||||
"Provides access to the resource's LooksAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it appears operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the LooksAlivePollInterval property for the resource type associated with the resource.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "looks_alive_poll_interval_seconds"),
|
||||
"Provides access to the resource's LooksAlivePollInterval property, which is the recommended interval in seconds at which the Cluster Service should poll the resource to determine whether it appears operational. The series is omitted while the resource uses the interval of its resource type (0xFFFFFFFF).",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
)
|
||||
@@ -157,8 +158,8 @@ func (c *Collector) buildResourceDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.resourcePendingTimeout = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "pending_timeout"),
|
||||
"Provides access to the resource's PendingTimeout property. If a resource cannot be brought online or taken offline in the number of milliseconds specified by the PendingTimeout property, the resource is forcibly terminated.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "pending_timeout_seconds"),
|
||||
"Provides access to the resource's PendingTimeout property. If a resource cannot be brought online or taken offline in the number of seconds specified by the PendingTimeout property, the resource is forcibly terminated.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
)
|
||||
@@ -175,14 +176,14 @@ func (c *Collector) buildResourceDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.resourceRestartDelay = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "restart_delay"),
|
||||
"Indicates the time delay before a failed resource is restarted.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "restart_delay_seconds"),
|
||||
"Indicates the time delay in seconds before a failed resource is restarted.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
)
|
||||
c.resourceRestartPeriod = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "restart_period"),
|
||||
"Provides access to the resource's RestartPeriod property, which is interval of time, in milliseconds, during which a specified number of restart attempts can be made on a nonresponsive resource.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "restart_period_seconds"),
|
||||
"Provides access to the resource's RestartPeriod property, which is interval of time, in seconds, during which a specified number of restart attempts can be made on a nonresponsive resource.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
)
|
||||
@@ -193,8 +194,8 @@ func (c *Collector) buildResourceDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.resourceRetryPeriodOnFailure = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "retry_period_on_failure"),
|
||||
"Provides access to the resource's RetryPeriodOnFailure property, which is the interval of time (in milliseconds) that a resource should remain in a failed state before the Cluster service attempts to restart it.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResource, "retry_period_on_failure_seconds"),
|
||||
"Provides access to the resource's RetryPeriodOnFailure property, which is the interval of time (in seconds) that a resource should remain in a failed state before the Cluster service attempts to restart it.",
|
||||
[]string{"type", "owner_group", "name"},
|
||||
nil,
|
||||
)
|
||||
@@ -273,6 +274,29 @@ func (c *Collector) publishResources(ch chan<- prometheus.Metric, resources []cl
|
||||
c.resourceRetryPeriodOnFailure,
|
||||
c.resourceState,
|
||||
}
|
||||
// fieldScales converts the millisecond properties to seconds.
|
||||
fieldScales := [resourceFieldCount]float64{
|
||||
1, // Characteristics
|
||||
1e-3, // DeadlockTimeout
|
||||
1, // EmbeddedFailureAction
|
||||
1, // Flags
|
||||
1e-3, // IsAlivePollInterval
|
||||
1e-3, // LooksAlivePollInterval
|
||||
1, // MonitorProcessId
|
||||
1e-3, // PendingTimeout
|
||||
1, // ResourceClass
|
||||
1, // RestartAction
|
||||
1e-3, // RestartDelay
|
||||
1e-3, // RestartPeriod
|
||||
1, // RestartThreshold
|
||||
1e-3, // RetryPeriodOnFailure
|
||||
1, // State
|
||||
}
|
||||
// The poll intervals are 0xFFFFFFFF when the resource uses the interval of its
|
||||
// resource type. That is not a duration, so the series is left out.
|
||||
useTypeDefault := func(index int, raw uint32) bool {
|
||||
return raw == math.MaxUint32 && (fieldNames[index] == "IsAlivePollInterval" || fieldNames[index] == "LooksAlivePollInterval")
|
||||
}
|
||||
|
||||
var nodeNamesKey []byte
|
||||
for _, nodeName := range nodeNames {
|
||||
@@ -318,7 +342,11 @@ func (c *Collector) publishResources(ch chan<- prometheus.Metric, resources []cl
|
||||
continue
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(fieldDescs[index], prometheus.GaugeValue, float64(raw), resource.Type, resource.OwnerGroup, resource.Name)
|
||||
if useTypeDefault(index, raw) {
|
||||
continue
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(fieldDescs[index], prometheus.GaugeValue, float64(raw)*fieldScales[index], resource.Type, resource.OwnerGroup, resource.Name)
|
||||
}
|
||||
|
||||
for _, metric := range c.resourceNodeMetrics(nil, resource, nodeNames) {
|
||||
@@ -330,8 +358,13 @@ func (c *Collector) publishResources(ch chan<- prometheus.Metric, resources []cl
|
||||
|
||||
metrics := scrape.Get(resource.Name, value, func() []prometheus.Metric {
|
||||
metrics := make([]prometheus.Metric, 0, resourceFieldCount+1+len(nodeNames))
|
||||
|
||||
for index, raw := range value.values {
|
||||
metrics = append(metrics, prometheus.MustNewConstMetric(fieldDescs[index], prometheus.GaugeValue, float64(raw), resource.Type, resource.OwnerGroup, resource.Name))
|
||||
if useTypeDefault(index, raw) {
|
||||
continue
|
||||
}
|
||||
|
||||
metrics = append(metrics, prometheus.MustNewConstMetric(fieldDescs[index], prometheus.GaugeValue, float64(raw)*fieldScales[index], resource.Type, resource.OwnerGroup, resource.Name))
|
||||
}
|
||||
|
||||
return c.resourceNodeMetrics(metrics, resource, nodeNames)
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"math"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -134,13 +135,18 @@ func TestResourceNativeMetricContract(t *testing.T) {
|
||||
}
|
||||
|
||||
expected := map[string]float64{
|
||||
"characteristics": 1, "deadlock_timeout": 2, "embedded_failure_action": 3, "flags": 4, "is_alive_poll_interval": 4294967295, "looks_alive_poll_interval": 6, "monitor_process_id": 7, "pending_timeout": 8, "resource_class": 1, "restart_action": 10, "restart_delay": 11, "restart_period": 12, "restart_threshold": 13, "retry_period_on_failure": 14, "state": 4294967295, "subclass": 0,
|
||||
"characteristics": 1, "deadlock_timeout_seconds": 0.002, "embedded_failure_action": 3, "flags": 4, "looks_alive_poll_interval_seconds": 0.006, "monitor_process_id": 7, "pending_timeout_seconds": 0.008, "resource_class": 1, "restart_action": 10, "restart_delay_seconds": 0.011, "restart_period_seconds": 0.012, "restart_threshold": 13, "retry_period_on_failure_seconds": 0.014, "state": 4294967295, "subclass": 0,
|
||||
}
|
||||
|
||||
if len(families) != 17 {
|
||||
if len(families) != 16 {
|
||||
t.Fatalf("families = %d", len(families))
|
||||
}
|
||||
|
||||
// IsAlivePollInterval is 0xFFFFFFFF: the resource uses the interval of its type.
|
||||
if _, exists := families["windows_mscluster_resource_is_alive_poll_interval_seconds"]; exists {
|
||||
t.Fatal("published the resource type default sentinel as a duration")
|
||||
}
|
||||
|
||||
for suffix, value := range expected {
|
||||
family := families["windows_mscluster_resource_"+suffix]
|
||||
if family == nil || family.GetType() != dto.MetricType_GAUGE || len(family.GetMetric()) != 1 {
|
||||
@@ -148,7 +154,7 @@ func TestResourceNativeMetricContract(t *testing.T) {
|
||||
}
|
||||
|
||||
metric := family.GetMetric()[0]
|
||||
if metric.GetGauge().GetValue() != value {
|
||||
if math.Abs(metric.GetGauge().GetValue()-value) > 1e-9*math.Max(1, math.Abs(value)) {
|
||||
t.Errorf("%s value = %v, want %v", suffix, metric.GetGauge().GetValue(), value)
|
||||
}
|
||||
|
||||
@@ -190,11 +196,11 @@ func TestResourcePartialResultsAndJoinedErrors(t *testing.T) {
|
||||
t.Fatalf("lost joined cause: %v", err)
|
||||
}
|
||||
|
||||
if _, exists := families["windows_mscluster_resource_deadlock_timeout"]; exists {
|
||||
if _, exists := families["windows_mscluster_resource_deadlock_timeout_seconds"]; exists {
|
||||
t.Fatal("published missing field as zero")
|
||||
}
|
||||
|
||||
if len(families) != 16 {
|
||||
if len(families) != 15 {
|
||||
t.Fatalf("lost successful properties: %d", len(families))
|
||||
}
|
||||
|
||||
@@ -298,7 +304,7 @@ func BenchmarkResourcePublication(b *testing.B) {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
for range 18 {
|
||||
for range 17 {
|
||||
<-ch
|
||||
}
|
||||
}
|
||||
@@ -336,7 +342,7 @@ func TestResourceMetricCache(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(first) != 18 || len(second) != len(first) || first[0] != second[0] {
|
||||
if len(first) != 17 || len(second) != len(first) || first[0] != second[0] {
|
||||
t.Fatal("did not reuse the metrics of an unchanged resource")
|
||||
}
|
||||
|
||||
@@ -376,7 +382,7 @@ func TestResourceMetricCache(t *testing.T) {
|
||||
|
||||
for range 2 {
|
||||
metrics, err := publish(resource, "nodeA")
|
||||
if err == nil || len(metrics) != 16 {
|
||||
if err == nil || len(metrics) != 15 {
|
||||
t.Fatalf("missing field: %d metrics, %v", len(metrics), err)
|
||||
}
|
||||
}
|
||||
@@ -394,8 +400,8 @@ func TestResourceLargeClusterGather(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(families) != 17 {
|
||||
t.Fatalf("families = %d, want 17", len(families))
|
||||
if len(families) != 16 {
|
||||
t.Fatalf("families = %d, want 16", len(families))
|
||||
}
|
||||
|
||||
for name, family := range families {
|
||||
|
||||
@@ -128,8 +128,8 @@ func (c *Collector) buildResourceGroupDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.resourceGroupFailOverPeriod = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResourceGroup, "failover_period"),
|
||||
"The FailoverPeriod property specifies a number of hours during which a maximum number of failover attempts, specified by the FailoverThreshold property, can occur.",
|
||||
prometheus.BuildFQName(types.Namespace, nameResourceGroup, "failover_period_seconds"),
|
||||
"The FailoverPeriod property specifies a number of seconds during which a maximum number of failover attempts, specified by the FailoverThreshold property, can occur. Windows stores it in hours.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
@@ -164,7 +164,7 @@ func (c *Collector) buildResourceGroupDescriptors() {
|
||||
nil,
|
||||
)
|
||||
c.resourceGroupResiliencyPeriod = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameResourceGroup, "resiliency_period"),
|
||||
prometheus.BuildFQName(types.Namespace, nameResourceGroup, "resiliency_period_seconds"),
|
||||
"The resiliency period for this group, in seconds.",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
@@ -197,7 +197,7 @@ func (c *Collector) publishResourceGroups(ch chan<- prometheus.Metric, groups []
|
||||
{name: "DefaultOwner", desc: c.resourceGroupDefaultOwner},
|
||||
{name: "FailbackWindowEnd", desc: c.resourceGroupFailbackWindowEnd, signed: true},
|
||||
{name: "FailbackWindowStart", desc: c.resourceGroupFailbackWindowStart, signed: true},
|
||||
{name: "FailoverPeriod", desc: c.resourceGroupFailOverPeriod},
|
||||
{name: "FailoverPeriod", desc: c.resourceGroupFailOverPeriod, scale: 3600},
|
||||
{name: "FailoverThreshold", desc: c.resourceGroupFailOverThreshold},
|
||||
{name: "Flags", desc: c.resourceGroupFlags},
|
||||
{name: "GroupType", desc: c.resourceGroupGroupType},
|
||||
|
||||
@@ -135,7 +135,7 @@ func TestResourceGroupNativeMetricContract(t *testing.T) {
|
||||
}
|
||||
|
||||
expected := map[string]float64{
|
||||
"auto_failback_type": 1, "characteristics": 2, "cold_start_setting": 3, "default_owner": 4294967295, "failback_window_end": -1, "failback_window_start": 5, "failover_period": 6, "failover_threshold": 4294967294, "flags": 1, "group_type": 9999, "priority": 3000, "resiliency_period": 240, "state": 4294967295,
|
||||
"auto_failback_type": 1, "characteristics": 2, "cold_start_setting": 3, "default_owner": 4294967295, "failback_window_end": -1, "failback_window_start": 5, "failover_period_seconds": 21600, "failover_threshold": 4294967294, "flags": 1, "group_type": 9999, "priority": 3000, "resiliency_period_seconds": 240, "state": 4294967295,
|
||||
}
|
||||
|
||||
if len(families) != len(expected)+1 {
|
||||
|
||||
@@ -80,13 +80,13 @@ func (c *Collector) Close() error {
|
||||
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
c.bytesInJournalQueue = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bytes_in_journal_queue"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "journal_queue_bytes"),
|
||||
"Size of queue journal in bytes",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.bytesInQueue = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bytes_in_queue"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "queue_bytes"),
|
||||
"Size of queue in bytes",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
|
||||
@@ -121,10 +121,9 @@ func TestCounterUnitConversions(t *testing.T) {
|
||||
GenStatsTempdbRowsetID: 11,
|
||||
}}
|
||||
c.locksPerfDataObject = []perfDataCounterValuesLocks{{
|
||||
Name: "locks",
|
||||
LocksAverageWaitTimeMS: 499,
|
||||
LocksAverageWaitTimeMSBase: 3,
|
||||
LocksLockWaitTimeMS: 499,
|
||||
Name: "locks",
|
||||
LocksAverageWaitTimeMS: 499,
|
||||
LocksLockWaitTimeMS: 499,
|
||||
}}
|
||||
c.transactionsPerfDataObject = []perfDataCounterValuesTransactions{{
|
||||
TransactionsNonSnapshotVersionTransactions: 1,
|
||||
@@ -156,7 +155,7 @@ func TestCounterUnitConversions(t *testing.T) {
|
||||
gauge := dto.MetricType_GAUGE
|
||||
|
||||
want := map[string]wantMetric{
|
||||
"windows_mssql_bufman_read_ahead_issuing_seconds": {counter, 882e-6},
|
||||
"windows_mssql_bufman_read_ahead_issuing_seconds_total": {counter, 882e-6},
|
||||
|
||||
"windows_mssql_databases_log_flush_wait_seconds_total": {counter, 0.004},
|
||||
"windows_mssql_databases_log_flush_write_seconds_total": {counter, 0.003},
|
||||
@@ -189,7 +188,6 @@ func TestCounterUnitConversions(t *testing.T) {
|
||||
"windows_mssql_genstats_tempdb_rowset_ids_generated_total": {counter, 11},
|
||||
|
||||
"windows_mssql_locks_wait_time_seconds_total": {counter, 0.499},
|
||||
"windows_mssql_locks_count_total": {counter, 3},
|
||||
"windows_mssql_locks_lock_wait_seconds_total": {counter, 0.499},
|
||||
|
||||
"windows_mssql_transactions_nonsnapshot_version_active": {gauge, 1},
|
||||
@@ -275,7 +273,7 @@ func TestMetricTypesMatchCounterTypes(t *testing.T) {
|
||||
waitStats := c.waitStatsPerfDataCollectors[instance].MetricType
|
||||
|
||||
checks := []check{
|
||||
{"windows_mssql_bufman_read_ahead_issuing_seconds", "Readahead time/sec", false, bufMan},
|
||||
{"windows_mssql_bufman_read_ahead_issuing_seconds_total", "Readahead time/sec", false, bufMan},
|
||||
{"windows_mssql_databases_log_flush_wait_seconds_total", "Log Flush Wait Time", false, databases},
|
||||
{"windows_mssql_databases_log_flush_write_seconds_total", "Log Flush Write Time (ms)", false, databases},
|
||||
{"windows_mssql_databases_log_growths_total", "Log Growths", true, databases},
|
||||
|
||||
@@ -140,43 +140,43 @@ func (c *Collector) buildAccessMethods() error {
|
||||
|
||||
// Win32_PerfRawData_{instance}_SQLServerAccessMethods
|
||||
c.accessMethodsAUcleanupbatches = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_au_batch_cleanups"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_au_batch_cleanups_total"),
|
||||
"(AccessMethods.AUcleanupbatches)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsAUcleanups = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_au_cleanups"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_au_cleanups_total"),
|
||||
"(AccessMethods.AUcleanups)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsByReferenceLobCreateCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_by_reference_lob_creates"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_by_reference_lob_creates_total"),
|
||||
"(AccessMethods.ByreferenceLobCreateCount)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsByReferenceLobUseCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_by_reference_lob_uses"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_by_reference_lob_uses_total"),
|
||||
"(AccessMethods.ByreferenceLobUseCount)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsCountLobReadahead = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_read_aheads"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_read_aheads_total"),
|
||||
"(AccessMethods.CountLobReadahead)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsCountPullInRow = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_column_value_pulls"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_column_value_pulls_total"),
|
||||
"(AccessMethods.CountPullInRow)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsCountPushOffRow = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_column_value_pushes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_column_value_pushes_total"),
|
||||
"(AccessMethods.CountPushOffRow)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -194,211 +194,211 @@ func (c *Collector) buildAccessMethods() error {
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsDroppedrowsetcleanups = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_dropped_rowset_cleanups"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_dropped_rowset_cleanups_total"),
|
||||
"(AccessMethods.Droppedrowsetcleanups)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsDroppedrowsetsskipped = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_dropped_rowset_skips"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_dropped_rowset_skips_total"),
|
||||
"(AccessMethods.Droppedrowsetsskipped)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsExtentDeallocations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_extent_deallocations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_extent_deallocations_total"),
|
||||
"(AccessMethods.ExtentDeallocations)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsExtentsAllocated = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_extent_allocations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_extent_allocations_total"),
|
||||
"(AccessMethods.ExtentsAllocated)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsFailedAUcleanupbatches = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_au_batch_cleanup_failures"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_au_batch_cleanup_failures_total"),
|
||||
"(AccessMethods.FailedAUcleanupbatches)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsFailedleafpagecookie = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_leaf_page_cookie_failures"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_leaf_page_cookie_failures_total"),
|
||||
"(AccessMethods.Failedleafpagecookie)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsFailedtreepagecookie = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_tree_page_cookie_failures"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_tree_page_cookie_failures_total"),
|
||||
"(AccessMethods.Failedtreepagecookie)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsForwardedRecords = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_forwarded_records"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_forwarded_records_total"),
|
||||
"(AccessMethods.ForwardedRecords)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsFreeSpacePageFetches = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_free_space_page_fetches"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_free_space_page_fetches_total"),
|
||||
"(AccessMethods.FreeSpacePageFetches)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsFreeSpaceScans = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_free_space_scans"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_free_space_scans_total"),
|
||||
"(AccessMethods.FreeSpaceScans)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsFullScans = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_full_scans"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_full_scans_total"),
|
||||
"(AccessMethods.FullScans)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsIndexSearches = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_index_searches"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_index_searches_total"),
|
||||
"(AccessMethods.IndexSearches)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsInSysXactwaits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_insysxact_waits"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_insysxact_waits_total"),
|
||||
"(AccessMethods.InSysXactwaits)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsLobHandleCreateCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_handle_creates"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_handle_creates_total"),
|
||||
"(AccessMethods.LobHandleCreateCount)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsLobHandleDestroyCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_handle_destroys"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_handle_destroys_total"),
|
||||
"(AccessMethods.LobHandleDestroyCount)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsLobSSProviderCreateCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_ss_provider_creates"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_ss_provider_creates_total"),
|
||||
"(AccessMethods.LobSSProviderCreateCount)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsLobSSProviderDestroyCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_ss_provider_destroys"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_ss_provider_destroys_total"),
|
||||
"(AccessMethods.LobSSProviderDestroyCount)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsLobSSProviderTruncationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_ss_provider_truncations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_lob_ss_provider_truncations_total"),
|
||||
"(AccessMethods.LobSSProviderTruncationCount)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsMixedPageAllocations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_mixed_page_allocations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_mixed_page_allocations_total"),
|
||||
"(AccessMethods.MixedpageallocationsPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsPageCompressionAttempts = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_compression_attempts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_compression_attempts_total"),
|
||||
"(AccessMethods.PagecompressionattemptsPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsPageDeallocations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_deallocations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_deallocations_total"),
|
||||
"(AccessMethods.PageDeallocationsPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsPagesAllocated = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_allocations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_allocations_total"),
|
||||
"(AccessMethods.PagesAllocatedPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsPagesCompressed = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_compressions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_compressions_total"),
|
||||
"(AccessMethods.PagescompressedPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsPageSplits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_splits"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_page_splits_total"),
|
||||
"(AccessMethods.PageSplitsPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsProbeScans = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_probe_scans"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_probe_scans_total"),
|
||||
"(AccessMethods.ProbeScansPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsRangeScans = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_range_scans"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_range_scans_total"),
|
||||
"(AccessMethods.RangeScansPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsScanPointRevalidations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_scan_point_revalidations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_scan_point_revalidations_total"),
|
||||
"(AccessMethods.ScanPointRevalidationsPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsSkippedGhostedRecords = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_ghost_record_skips"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_ghost_record_skips_total"),
|
||||
"(AccessMethods.SkippedGhostedRecordsPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsTableLockEscalations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_table_lock_escalations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_table_lock_escalations_total"),
|
||||
"(AccessMethods.TableLockEscalationsPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsUsedleafpagecookie = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_leaf_page_cookie_uses"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_leaf_page_cookie_uses_total"),
|
||||
"(AccessMethods.Usedleafpagecookie)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsUsedtreepagecookie = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_tree_page_cookie_uses"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_tree_page_cookie_uses_total"),
|
||||
"(AccessMethods.Usedtreepagecookie)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsWorkfilesCreated = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_workfile_creates"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_workfile_creates_total"),
|
||||
"(AccessMethods.WorkfilesCreatedPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsWorktablesCreated = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_worktables_creates"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_worktables_creates_total"),
|
||||
"(AccessMethods.WorktablesCreatedPersec)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsWorktablesFromCacheHits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_worktables_from_cache_hits"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_worktables_from_cache_hits_total"),
|
||||
"(AccessMethods.WorktablesFromCacheRatio)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.accessMethodsWorktablesFromCacheLookups = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_worktables_from_cache_lookups"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accessmethods_worktables_from_cache_lookups_total"),
|
||||
"(AccessMethods.WorktablesFromCacheRatio_Base)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
|
||||
@@ -71,55 +71,55 @@ func (c *Collector) buildAvailabilityReplica() error {
|
||||
|
||||
// Win32_PerfRawData_{instance}_SQLServerAvailabilityReplica
|
||||
c.availReplicaBytesReceivedFromReplica = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_received_from_replica_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_received_from_replica_bytes_total"),
|
||||
"(AvailabilityReplica.BytesReceivedfromReplica)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaBytesSentToReplica = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sent_to_replica_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sent_to_replica_bytes_total"),
|
||||
"(AvailabilityReplica.BytesSenttoReplica)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaBytesSentToTransport = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sent_to_transport_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sent_to_transport_bytes_total"),
|
||||
"(AvailabilityReplica.BytesSenttoTransport)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaFlowControl = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_initiated_flow_controls"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_initiated_flow_controls_total"),
|
||||
"(AvailabilityReplica.FlowControl)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaFlowControlTimeMS = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_flow_control_wait_seconds"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_flow_control_wait_seconds_total"),
|
||||
"(AvailabilityReplica.FlowControlTimems)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaReceivesFromReplica = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_receives_from_replica"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_receives_from_replica_total"),
|
||||
"(AvailabilityReplica.ReceivesfromReplica)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaResentMessages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_resent_messages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_resent_messages_total"),
|
||||
"(AvailabilityReplica.ResentMessages)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaSendsToReplica = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sends_to_replica"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sends_to_replica_total"),
|
||||
"(AvailabilityReplica.SendstoReplica)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.availReplicaSendsToTransport = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sends_to_transport"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "availreplica_sends_to_transport_total"),
|
||||
"(AvailabilityReplica.SendstoTransport)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
|
||||
@@ -97,7 +97,7 @@ func (c *Collector) buildBufferManager() error {
|
||||
}
|
||||
|
||||
c.bufManBackgroundwriterpages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_background_writer_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_background_writer_pages_total"),
|
||||
"(BufferManager.Backgroundwriterpages)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -115,7 +115,7 @@ func (c *Collector) buildBufferManager() error {
|
||||
nil,
|
||||
)
|
||||
c.bufManCheckpointpages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_checkpoint_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_checkpoint_pages_total"),
|
||||
"(BufferManager.Checkpointpages)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -139,8 +139,8 @@ func (c *Collector) buildBufferManager() error {
|
||||
nil,
|
||||
)
|
||||
c.bufManExtensioninuseaspercentage = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_in_use_as_percentage"),
|
||||
"(BufferManager.Extensioninuseaspercentage)",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_in_use_ratio"),
|
||||
"(BufferManager.Extensioninuseaspercentage) Ratio (0-1) of the buffer pool extension file in use",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
@@ -151,13 +151,13 @@ func (c *Collector) buildBufferManager() error {
|
||||
nil,
|
||||
)
|
||||
c.bufManExtensionpageevictions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_page_evictions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_page_evictions_total"),
|
||||
"(BufferManager.Extensionpageevictions)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.bufManExtensionpagereads = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_page_reads"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_page_reads_total"),
|
||||
"(BufferManager.Extensionpagereads)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -169,13 +169,13 @@ func (c *Collector) buildBufferManager() error {
|
||||
nil,
|
||||
)
|
||||
c.bufManExtensionpagewrites = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_page_writes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_extension_page_writes_total"),
|
||||
"(BufferManager.Extensionpagewrites)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.bufManFreeliststalls = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_free_list_stalls"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_free_list_stalls_total"),
|
||||
"(BufferManager.Freeliststalls)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -187,7 +187,7 @@ func (c *Collector) buildBufferManager() error {
|
||||
nil,
|
||||
)
|
||||
c.bufManLazywrites = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_lazywrites"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_lazywrites_total"),
|
||||
"(BufferManager.Lazywrites)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -199,31 +199,31 @@ func (c *Collector) buildBufferManager() error {
|
||||
nil,
|
||||
)
|
||||
c.bufManPagelookups = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_page_lookups"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_page_lookups_total"),
|
||||
"(BufferManager.Pagelookups)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.bufManPagereads = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_page_reads"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_page_reads_total"),
|
||||
"(BufferManager.Pagereads)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.bufManPagewrites = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_page_writes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_page_writes_total"),
|
||||
"(BufferManager.Pagewrites)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.bufManReadaheadpages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_read_ahead_pages"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_read_ahead_pages_total"),
|
||||
"(BufferManager.Readaheadpages)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.bufManReadaheadtime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_read_ahead_issuing_seconds"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "bufman_read_ahead_issuing_seconds_total"),
|
||||
"(BufferManager.Readaheadtime) Total time spent issuing read-ahead, in seconds",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -307,7 +307,7 @@ func (c *Collector) emitBufferManagerMetrics(ch chan<- prometheus.Metric, sqlIns
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.bufManExtensioninuseaspercentage,
|
||||
prometheus.GaugeValue,
|
||||
data.BufManExtensionInUseAsPercentage,
|
||||
data.BufManExtensionInUseAsPercentage/100,
|
||||
sqlInstance.name,
|
||||
)
|
||||
|
||||
|
||||
@@ -177,19 +177,19 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesBackupPerRestoreThroughput = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_backup_restore_operations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_backup_restore_operations_total"),
|
||||
"(Databases.BackupPerRestoreThroughput)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesBulkCopyRows = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_bulk_copy_rows"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_bulk_copy_rows_total"),
|
||||
"(Databases.BulkCopyRows)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesBulkCopyThroughput = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_bulk_copy_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_bulk_copy_bytes_total"),
|
||||
"(Databases.BulkCopyThroughput)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
@@ -207,19 +207,19 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesDBCCLogicalScanBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_dbcc_logical_scan_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_dbcc_logical_scan_bytes_total"),
|
||||
"(Databases.DBCCLogicalScanBytes)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesGroupCommitTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_group_commit_stall_seconds"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_group_commit_stall_seconds_total"),
|
||||
"(Databases.GroupCommitTime)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogBytesFlushed = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_flushed_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_flushed_bytes_total"),
|
||||
"(Databases.LogBytesFlushed)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
@@ -237,7 +237,7 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesLogCacheReads = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_cache_reads"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_cache_reads_total"),
|
||||
"(Databases.LogCacheReads)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
@@ -255,13 +255,13 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesLogFlushes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_flushes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_flushes_total"),
|
||||
"(Databases.LogFlushes)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogFlushWaits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_flush_waits"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_flush_waits_total"),
|
||||
"(Databases.LogFlushWaits)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
@@ -285,79 +285,79 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolCacheMisses = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_cache_misses"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_cache_misses_total"),
|
||||
"(Databases.LogPoolCacheMisses)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolDiskReads = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_disk_reads"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_disk_reads_total"),
|
||||
"(Databases.LogPoolDiskReads)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolHashDeletes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_hash_deletes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_hash_deletes_total"),
|
||||
"(Databases.LogPoolHashDeletes)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolHashInserts = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_hash_inserts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_hash_inserts_total"),
|
||||
"(Databases.LogPoolHashInserts)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolInvalidHashEntry = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_invalid_hash_entries"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_invalid_hash_entries_total"),
|
||||
"(Databases.LogPoolInvalidHashEntry)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolLogScanPushes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_log_scan_pushes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_log_scan_pushes_total"),
|
||||
"(Databases.LogPoolLogScanPushes)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolLogWriterPushes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_log_writer_pushes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_log_writer_pushes_total"),
|
||||
"(Databases.LogPoolLogWriterPushes)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolPushEmptyFreePool = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_empty_free_pool_pushes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_empty_free_pool_pushes_total"),
|
||||
"(Databases.LogPoolPushEmptyFreePool)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolPushLowMemory = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_low_memory_pushes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_low_memory_pushes_total"),
|
||||
"(Databases.LogPoolPushLowMemory)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolPushNoFreeBuffer = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_no_free_buffer_pushes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_no_free_buffer_pushes_total"),
|
||||
"(Databases.LogPoolPushNoFreeBuffer)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolReqBehindTrunc = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_req_behind_trunc"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_req_behind_trunc_total"),
|
||||
"(Databases.LogPoolReqBehindTrunc)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolRequestsOldVLF = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_requests_old_vlf"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_requests_old_vlf_total"),
|
||||
"(Databases.LogPoolRequestsOldVLF)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesLogPoolRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_requests"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_pool_requests_total"),
|
||||
"(Databases.LogPoolRequests)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
@@ -387,8 +387,8 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesPercentLogUsed = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_used_percent"),
|
||||
"(Databases.PercentLogUsed)",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_log_used_ratio"),
|
||||
"(Databases.PercentLogUsed) Ratio (0-1) of the transaction log space in use",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
@@ -399,31 +399,31 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesReplTransRate = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_repl_transactions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_repl_transactions_total"),
|
||||
"(Databases.ReplTranactions)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesShrinkDataMovementBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_shrink_data_movement_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_shrink_data_movement_bytes_total"),
|
||||
"(Databases.ShrinkDataMovementBytes)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesTrackedTransactions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_tracked_transactions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_tracked_transactions_total"),
|
||||
"(Databases.Trackedtransactions)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesTransactions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_transactions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_transactions_total"),
|
||||
"(Databases.Transactions)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
)
|
||||
c.databasesWriteTransactions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_write_transactions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_write_transactions_total"),
|
||||
"(Databases.WriteTransactions)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
@@ -447,7 +447,7 @@ func (c *Collector) buildDatabases() error {
|
||||
nil,
|
||||
)
|
||||
c.databasesXTPControllerLogProcessed = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_xtp_controller_log_processed_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "databases_xtp_controller_log_processed_bytes_total"),
|
||||
"(Databases.XTPControllerLogProcessed)",
|
||||
[]string{"mssql_instance", "database"},
|
||||
nil,
|
||||
@@ -737,7 +737,7 @@ func (c *Collector) emitDatabasesMetrics(ch chan<- prometheus.Metric, sqlInstanc
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.databasesPercentLogUsed,
|
||||
prometheus.GaugeValue,
|
||||
data.DatabasesPercentLogUsed,
|
||||
data.DatabasesPercentLogUsed/100,
|
||||
sqlInstance.name, data.Name,
|
||||
)
|
||||
|
||||
|
||||
@@ -106,19 +106,19 @@ func (c *Collector) buildDatabaseReplica() error {
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaDatabaseFlowControls = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_database_initiated_flow_controls"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_database_initiated_flow_controls_total"),
|
||||
"(DatabaseReplica.DatabaseFlowControls)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaFileBytesReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_received_file_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_received_file_bytes_total"),
|
||||
"(DatabaseReplica.FileBytesReceived)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaGroupCommits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_group_commits"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_group_commits_total"),
|
||||
"(DatabaseReplica.GroupCommits)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
@@ -142,43 +142,43 @@ func (c *Collector) buildDatabaseReplica() error {
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaLogBytesCompressed = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compressed_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compressed_bytes_total"),
|
||||
"(DatabaseReplica.LogBytesCompressed)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaLogBytesDecompressed = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_decompressed_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_decompressed_bytes_total"),
|
||||
"(DatabaseReplica.LogBytesDecompressed)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaLogBytesReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_received_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_received_bytes_total"),
|
||||
"(DatabaseReplica.LogBytesReceived)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaLogCompressionCachehits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compression_cachehits"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compression_cachehits_total"),
|
||||
"(DatabaseReplica.LogCompressionCachehits)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaLogCompressionCachemisses = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compression_cachemisses"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compression_cachemisses_total"),
|
||||
"(DatabaseReplica.LogCompressionCachemisses)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaLogCompressions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compressions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_compressions_total"),
|
||||
"(DatabaseReplica.LogCompressions)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaLogDecompressions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_decompressions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_log_decompressions_total"),
|
||||
"(DatabaseReplica.LogDecompressions)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
@@ -196,7 +196,7 @@ func (c *Collector) buildDatabaseReplica() error {
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaMirroredWritetransactions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_mirrored_write_transactions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_mirrored_write_transactions_total"),
|
||||
"(DatabaseReplica.MirroredWriteTransactions)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
@@ -208,7 +208,7 @@ func (c *Collector) buildDatabaseReplica() error {
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaRedoblocked = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_redo_blocks"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_redo_blocks_total"),
|
||||
"(DatabaseReplica.Redoblocked)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
@@ -220,13 +220,13 @@ func (c *Collector) buildDatabaseReplica() error {
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaRedoneBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_redone_bytes"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_redone_bytes_total"),
|
||||
"(DatabaseReplica.RedoneBytes)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
)
|
||||
c.dbReplicaRedones = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_redones"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dbreplica_redones_total"),
|
||||
"(DatabaseReplica.Redones)",
|
||||
[]string{"mssql_instance", "replica"},
|
||||
nil,
|
||||
|
||||
@@ -104,7 +104,7 @@ func (c *Collector) buildGeneralStatistics() error {
|
||||
nil,
|
||||
)
|
||||
c.genStatsConnectionReset = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_connection_resets"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_connection_resets_total"),
|
||||
"(GeneralStatistics.ConnectionReset)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -128,13 +128,13 @@ func (c *Collector) buildGeneralStatistics() error {
|
||||
nil,
|
||||
)
|
||||
c.genStatsLogins = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_logins"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_logins_total"),
|
||||
"(GeneralStatistics.Logins)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.genStatsLogouts = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_logouts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_logouts_total"),
|
||||
"(GeneralStatistics.Logouts)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -146,7 +146,7 @@ func (c *Collector) buildGeneralStatistics() error {
|
||||
nil,
|
||||
)
|
||||
c.genStatsNonAtomicYieldRate = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_non_atomic_yields"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_non_atomic_yields_total"),
|
||||
"(GeneralStatistics.Nonatomicyields)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
@@ -212,7 +212,7 @@ func (c *Collector) buildGeneralStatistics() error {
|
||||
nil,
|
||||
)
|
||||
c.genStatsTempTablesCreationRate = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_temp_tables_creations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "genstats_temp_tables_creations_total"),
|
||||
"(GeneralStatistics.TempTablesCreations)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
|
||||
@@ -32,7 +32,6 @@ type collectorLocks struct {
|
||||
|
||||
// Win32_PerfRawData_{instance}_SQLServerLocks
|
||||
locksWaitTime *prometheus.Desc
|
||||
locksCount *prometheus.Desc
|
||||
locksLockRequests *prometheus.Desc
|
||||
locksLockTimeouts *prometheus.Desc
|
||||
locksLockTimeoutstimeout0 *prometheus.Desc
|
||||
@@ -45,7 +44,6 @@ type perfDataCounterValuesLocks struct {
|
||||
Name string
|
||||
|
||||
LocksAverageWaitTimeMS float64 `perfdata:"Average Wait Time (ms)"`
|
||||
LocksAverageWaitTimeMSBase float64 `perfdata:"Average Wait Time (ms),secondvalue"`
|
||||
LocksLockRequestsPerSec float64 `perfdata:"Lock Requests/sec"`
|
||||
LocksLockTimeoutsPerSec float64 `perfdata:"Lock Timeouts/sec"`
|
||||
LocksLockTimeoutsTimeout0PerSec float64 `perfdata:"Lock Timeouts (timeout > 0)/sec"`
|
||||
@@ -69,36 +67,30 @@ func (c *Collector) buildLocks() error {
|
||||
|
||||
c.locksWaitTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_wait_time_seconds_total"),
|
||||
"(Locks.AverageWaitTimems) Total time lock requests waited, in seconds. Numerator of Average Wait Time (ms)",
|
||||
[]string{"mssql_instance", "resource"},
|
||||
nil,
|
||||
)
|
||||
c.locksCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_count_total"),
|
||||
"(Locks.AverageWaitTimems_Base) Total number of lock requests that waited. Base of Average Wait Time (ms)",
|
||||
"(Locks.AverageWaitTimems) Total time lock requests waited, in seconds. Divide its rate by the rate of windows_mssql_locks_lock_waits_total for the average wait",
|
||||
[]string{"mssql_instance", "resource"},
|
||||
nil,
|
||||
)
|
||||
c.locksLockRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_requests"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_requests_total"),
|
||||
"(Locks.LockRequests)",
|
||||
[]string{"mssql_instance", "resource"},
|
||||
nil,
|
||||
)
|
||||
c.locksLockTimeouts = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_timeouts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_timeouts_total"),
|
||||
"(Locks.LockTimeouts)",
|
||||
[]string{"mssql_instance", "resource"},
|
||||
nil,
|
||||
)
|
||||
c.locksLockTimeoutstimeout0 = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_timeouts_excluding_NOWAIT"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_timeouts_excluding_nowait_total"),
|
||||
"(Locks.LockTimeoutstimeout0)",
|
||||
[]string{"mssql_instance", "resource"},
|
||||
nil,
|
||||
)
|
||||
c.locksLockWaits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_waits"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_lock_waits_total"),
|
||||
"(Locks.LockWaits)",
|
||||
[]string{"mssql_instance", "resource"},
|
||||
nil,
|
||||
@@ -110,7 +102,7 @@ func (c *Collector) buildLocks() error {
|
||||
nil,
|
||||
)
|
||||
c.locksNumberOfDeadlocks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_deadlocks"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "locks_deadlocks_total"),
|
||||
"(Locks.NumberOfDeadlocks)",
|
||||
[]string{"mssql_instance", "resource"},
|
||||
nil,
|
||||
@@ -143,13 +135,6 @@ func (c *Collector) emitLocksMetrics(ch chan<- prometheus.Metric, sqlInstance ms
|
||||
sqlInstance.name, data.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.locksCount,
|
||||
prometheus.CounterValue,
|
||||
data.LocksAverageWaitTimeMSBase,
|
||||
sqlInstance.name, data.Name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.locksLockRequests,
|
||||
prometheus.CounterValue,
|
||||
|
||||
@@ -71,67 +71,67 @@ func (c *Collector) buildSQLStats() error {
|
||||
}
|
||||
|
||||
c.sqlStatsAutoParamAttempts = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_auto_parameterization_attempts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_auto_parameterization_attempts_total"),
|
||||
"(SQLStatistics.AutoParamAttempts)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsBatchRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_batch_requests"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_batch_requests_total"),
|
||||
"(SQLStatistics.BatchRequests)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsFailedAutoParams = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_failed_auto_parameterization_attempts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_failed_auto_parameterization_attempts_total"),
|
||||
"(SQLStatistics.FailedAutoParams)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsForcedParameterizations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_forced_parameterizations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_forced_parameterizations_total"),
|
||||
"(SQLStatistics.ForcedParameterizations)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsGuidedplanexecutions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_guided_plan_executions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_guided_plan_executions_total"),
|
||||
"(SQLStatistics.Guidedplanexecutions)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsMisguidedplanexecutions = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_misguided_plan_executions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_misguided_plan_executions_total"),
|
||||
"(SQLStatistics.Misguidedplanexecutions)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsSafeAutoParams = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_safe_auto_parameterization_attempts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_safe_auto_parameterization_attempts_total"),
|
||||
"(SQLStatistics.SafeAutoParams)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsSQLAttentionrate = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_sql_attentions"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_sql_attentions_total"),
|
||||
"(SQLStatistics.SQLAttentions)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsSQLCompilations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_sql_compilations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_sql_compilations_total"),
|
||||
"(SQLStatistics.SQLCompilations)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsSQLReCompilations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_sql_recompilations"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_sql_recompilations_total"),
|
||||
"(SQLStatistics.SQLReCompilations)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.sqlStatsUnsafeAutoParams = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_unsafe_auto_parameterization_attempts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "sqlstats_unsafe_auto_parameterization_attempts_total"),
|
||||
"(SQLStatistics.UnsafeAutoParams)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
|
||||
@@ -149,13 +149,13 @@ func (c *Collector) buildTransactions() error {
|
||||
nil,
|
||||
)
|
||||
c.transactionsVersionStoreCreationUnits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transactions_version_store_creation_units"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transactions_version_store_creation_units_total"),
|
||||
"(Transactions.VersionStoreUnitCreation)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
)
|
||||
c.transactionsVersionStoreTruncationUnits = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transactions_version_store_truncation_units"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transactions_version_store_truncation_units_total"),
|
||||
"(Transactions.VersionStoreUnitTruncation)",
|
||||
[]string{"mssql_instance"},
|
||||
nil,
|
||||
|
||||
@@ -25,7 +25,6 @@ import (
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/labelcache"
|
||||
@@ -34,7 +33,6 @@ import (
|
||||
"github.com/prometheus-community/windows_exporter/internal/scrapecache"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/recovery"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
type perfCollector[T any] interface {
|
||||
@@ -78,11 +76,10 @@ type Collector struct {
|
||||
// labels keeps the label pairs of the series of the last scrape. The
|
||||
// counters change on every scrape, but their process labels stay the
|
||||
// same while the process runs.
|
||||
labels labelcache.Cache
|
||||
config Config
|
||||
logger *slog.Logger
|
||||
perfFrequency float64
|
||||
closeFns []func()
|
||||
labels labelcache.Cache
|
||||
config Config
|
||||
logger *slog.Logger
|
||||
closeFns []func()
|
||||
// perfQuery samples the counters of all enabled sub-collectors at once.
|
||||
// The .NET CLR counter provider serves one query at a time and walks
|
||||
// every .NET process for each, so separate queries wait for each other.
|
||||
@@ -231,16 +228,6 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
}
|
||||
|
||||
c.logger = logger
|
||||
if slices.Contains(c.config.CollectorsEnabled, collectorClrJIT) || slices.Contains(c.config.CollectorsEnabled, collectorClrSecurity) {
|
||||
var frequency int64
|
||||
|
||||
ret, _, err := windows.NewLazySystemDLL("kernel32.dll").NewProc("QueryPerformanceFrequency").Call(uintptr(unsafe.Pointer(&frequency)))
|
||||
if ret == 0 || frequency <= 0 {
|
||||
return fmt.Errorf("QueryPerformanceFrequency: %w", err)
|
||||
}
|
||||
|
||||
c.perfFrequency = float64(frequency)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ func (c *Collector) describeClrJIT() {
|
||||
nil,
|
||||
)
|
||||
c.timeInJit = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, collectorClrJIT+"_jit_time_percent"),
|
||||
"Displays the percentage of time spent in JIT compilation. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, collectorClrJIT+"_jit_time_ratio"),
|
||||
"Displays the ratio (0-1) of elapsed time spent in JIT compilation since the last JIT compilation phase. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled.",
|
||||
[]string{"process"},
|
||||
nil,
|
||||
)
|
||||
@@ -68,6 +68,7 @@ type perfDataClrJIT struct {
|
||||
Occurrence int
|
||||
NumberofMethodsJitted float64 `perfdata:"# of Methods JITted"`
|
||||
PercentTimeinJit float64 `perfdata:"% Time in Jit"`
|
||||
PercentTimeinJitBase float64 `perfdata:"% Time in Jit,secondvalue"`
|
||||
StandardJitFailures float64 `perfdata:"Standard Jit Failures"`
|
||||
TotalNumberofILBytesJitted float64 `perfdata:"Total # of IL Bytes Jitted"`
|
||||
}
|
||||
@@ -94,16 +95,18 @@ func (c *Collector) collectClrJIT(ch chan<- prometheus.Metric, scrape *labelcach
|
||||
process.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.timeInJit,
|
||||
prometheus.GaugeValue,
|
||||
float64(process.PercentTimeinJit)/c.perfFrequency,
|
||||
process.Name,
|
||||
)
|
||||
if process.PercentTimeinJitBase > 0 {
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.timeInJit,
|
||||
prometheus.GaugeValue,
|
||||
process.PercentTimeinJit/process.PercentTimeinJitBase,
|
||||
process.Name,
|
||||
)
|
||||
}
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.standardJitFailures,
|
||||
prometheus.GaugeValue,
|
||||
prometheus.CounterValue,
|
||||
float64(process.StandardJitFailures),
|
||||
process.Name,
|
||||
)
|
||||
|
||||
@@ -95,8 +95,8 @@ func (c *Collector) describeClrMemory() {
|
||||
nil,
|
||||
)
|
||||
c.timeInGC = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, collectorClrMemory+"_gc_time_percent"),
|
||||
"Displays the percentage of time that was spent performing a garbage collection in the last sample.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, collectorClrMemory+"_gc_time_ratio"),
|
||||
"Displays the ratio (0-1) of elapsed time spent performing a garbage collection since the end of the last garbage collection cycle.",
|
||||
[]string{"process", "process_id"},
|
||||
nil,
|
||||
)
|
||||
@@ -304,7 +304,7 @@ func (c *Collector) collectClrMemory(ch chan<- prometheus.Metric, scrape *labelc
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.timeInGC,
|
||||
prometheus.GaugeValue,
|
||||
100*process.PercentTimeinGC/process.PercentTimeinGC_base,
|
||||
process.PercentTimeinGC/process.PercentTimeinGC_base,
|
||||
process.Name,
|
||||
strconv.FormatUint(uint64(process.ProcessID), 10),
|
||||
)
|
||||
|
||||
@@ -34,8 +34,8 @@ func (c *Collector) describeClrSecurity() {
|
||||
nil,
|
||||
)
|
||||
c.timeInRTChecks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, collectorClrSecurity+"_rt_checks_time_percent"),
|
||||
"Displays the percentage of time spent performing runtime code access security checks in the last sample.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, collectorClrSecurity+"_rt_checks_time_ratio"),
|
||||
"Displays the ratio (0-1) of time spent performing runtime code access security checks in the last sample.",
|
||||
[]string{"process"},
|
||||
nil,
|
||||
)
|
||||
@@ -64,12 +64,13 @@ func (c *Collector) buildClrSecurity() error {
|
||||
}
|
||||
|
||||
type perfDataClrSecurity struct {
|
||||
Name string
|
||||
Occurrence int
|
||||
NumberLinkTimeChecks float64 `perfdata:"# Link Time Checks"`
|
||||
PercentTimeinRTchecks float64 `perfdata:"% Time in RT checks"`
|
||||
StackWalkDepth float64 `perfdata:"Stack Walk Depth"`
|
||||
TotalRuntimeChecks float64 `perfdata:"Total Runtime Checks"`
|
||||
Name string
|
||||
Occurrence int
|
||||
NumberLinkTimeChecks float64 `perfdata:"# Link Time Checks"`
|
||||
PercentTimeinRTchecks float64 `perfdata:"% Time in RT checks"`
|
||||
PercentTimeinRTchecksBase float64 `perfdata:"% Time in RT checks,secondvalue"`
|
||||
StackWalkDepth float64 `perfdata:"Stack Walk Depth"`
|
||||
TotalRuntimeChecks float64 `perfdata:"Total Runtime Checks"`
|
||||
}
|
||||
|
||||
func (p *perfDataClrSecurity) instance() (*string, int) { return &p.Name, p.Occurrence }
|
||||
@@ -94,12 +95,14 @@ func (c *Collector) collectClrSecurity(ch chan<- prometheus.Metric, scrape *labe
|
||||
process.Name,
|
||||
)
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.timeInRTChecks,
|
||||
prometheus.GaugeValue,
|
||||
float64(process.PercentTimeinRTchecks)/c.perfFrequency,
|
||||
process.Name,
|
||||
)
|
||||
if process.PercentTimeinRTchecksBase > 0 {
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.timeInRTChecks,
|
||||
prometheus.GaugeValue,
|
||||
process.PercentTimeinRTchecks/process.PercentTimeinRTchecksBase,
|
||||
process.Name,
|
||||
)
|
||||
}
|
||||
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.stackWalkDepth,
|
||||
|
||||
@@ -60,12 +60,12 @@ func TestClrCounterPaths(t *testing.T) {
|
||||
}{
|
||||
{reflect.TypeFor[perfDataClrExceptions](), []string{"# of Exceps Thrown", "# of Filters / sec", "# of Finallys / sec", "Throw To Catch Depth / sec"}},
|
||||
{reflect.TypeFor[perfDataClrInterop](), []string{"# of CCWs", "# of Stubs", "# of marshalling"}},
|
||||
{reflect.TypeFor[perfDataClrJIT](), []string{"# of Methods Jitted", "% Time in Jit", "Standard Jit Failures", "Total # of IL Bytes Jitted"}},
|
||||
{reflect.TypeFor[perfDataClrJIT](), []string{"# of Methods Jitted", "% Time in Jit", "% Time in Jit,secondvalue", "Standard Jit Failures", "Total # of IL Bytes Jitted"}},
|
||||
{reflect.TypeFor[perfDataClrLoading](), []string{"Bytes in Loader Heap", "Current appdomains", "Current Assemblies", "Current Classes Loaded", "Total Appdomains", "Total appdomains unloaded", "Total Assemblies", "Total Classes Loaded", "Total # of Load Failures"}},
|
||||
{reflect.TypeFor[perfDataClrLocksAndThreads](), []string{"Current Queue Length", "# of current logical Threads", "# of current physical Threads", "# of current recognized threads", "# of total recognized threads", "Queue Length Peak", "Total # of Contentions"}},
|
||||
{reflect.TypeFor[perfDataClrMemory](), []string{"Allocated Bytes/sec", "Finalization Survivors", "Gen 0 heap size", "Gen 0 Promoted Bytes/Sec", "Gen 1 heap size", "Gen 1 Promoted Bytes/Sec", "Gen 2 heap size", "Large Object Heap size", "# GC Handles", "# Gen 0 Collections", "# Gen 1 Collections", "# Gen 2 Collections", "# Induced GC", "# of Pinned Objects", "# of Sink Blocks in use", "# Total committed Bytes", "# Total reserved Bytes", "% Time in GC", "% Time in GC,secondvalue", "Process ID"}},
|
||||
{reflect.TypeFor[perfDataClrRemoting](), []string{"Channels", "Context-Bound Classes Loaded", "Context-Bound Objects Alloc / sec", "Context Proxies", "Contexts", "Total Remote Calls"}},
|
||||
{reflect.TypeFor[perfDataClrSecurity](), []string{"# Link Time Checks", "% Time in RT checks", "Stack Walk Depth", "Total Runtime Checks"}},
|
||||
{reflect.TypeFor[perfDataClrSecurity](), []string{"# Link Time Checks", "% Time in RT checks", "% Time in RT checks,secondvalue", "Stack Walk Depth", "Total Runtime Checks"}},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.rowType.Name(), func(t *testing.T) {
|
||||
|
||||
@@ -136,7 +136,7 @@ func assertFixtureMetrics(t *testing.T, collect func(chan<- prometheus.Metric, *
|
||||
}
|
||||
|
||||
func TestClrExceptionsMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrExceptions()
|
||||
|
||||
row := perfDataClrExceptions{
|
||||
@@ -162,7 +162,7 @@ func TestClrExceptionsMetricCompatibility(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClrInteropMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrInterop()
|
||||
|
||||
row := perfDataClrInterop{
|
||||
@@ -186,12 +186,13 @@ func TestClrInteropMetricCompatibility(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClrJITMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrJIT()
|
||||
|
||||
row := perfDataClrJIT{
|
||||
NumberofMethodsJitted: 11,
|
||||
PercentTimeinJit: 50,
|
||||
PercentTimeinJitBase: 200,
|
||||
StandardJitFailures: 13,
|
||||
TotalNumberofILBytesJitted: 14,
|
||||
}
|
||||
@@ -205,14 +206,14 @@ func TestClrJITMetricCompatibility(t *testing.T) {
|
||||
c.perfClrJIT = &fixturePerfCollector[perfDataClrJIT]{rows: rows}
|
||||
assertFixtureMetrics(t, c.collectClrJIT, []expectedMetric{
|
||||
{"windows_netframework_clrjit_jit_methods_total", dto.MetricType_COUNTER, 11, ""},
|
||||
{"windows_netframework_clrjit_jit_time_percent", dto.MetricType_GAUGE, 0.05, ""},
|
||||
{"windows_netframework_clrjit_jit_standard_failures_total", dto.MetricType_GAUGE, 13, ""},
|
||||
{"windows_netframework_clrjit_jit_time_ratio", dto.MetricType_GAUGE, 0.25, ""},
|
||||
{"windows_netframework_clrjit_jit_standard_failures_total", dto.MetricType_COUNTER, 13, ""},
|
||||
{"windows_netframework_clrjit_jit_il_bytes_total", dto.MetricType_COUNTER, 14, ""},
|
||||
}, false)
|
||||
}
|
||||
|
||||
func TestClrLoadingMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrLoading()
|
||||
|
||||
row := perfDataClrLoading{
|
||||
@@ -248,7 +249,7 @@ func TestClrLoadingMetricCompatibility(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClrLocksAndThreadsMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrLocksAndThreads()
|
||||
|
||||
row := perfDataClrLocksAndThreads{
|
||||
@@ -280,7 +281,7 @@ func TestClrLocksAndThreadsMetricCompatibility(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClrMemoryMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrMemory()
|
||||
|
||||
row := perfDataClrMemory{
|
||||
@@ -331,12 +332,12 @@ func TestClrMemoryMetricCompatibility(t *testing.T) {
|
||||
{"windows_netframework_clrmemory_number_sink_blocksinuse", dto.MetricType_GAUGE, 27, ""},
|
||||
{"windows_netframework_clrmemory_committed_bytes", dto.MetricType_GAUGE, 24, ""},
|
||||
{"windows_netframework_clrmemory_reserved_bytes", dto.MetricType_GAUGE, 25, ""},
|
||||
{"windows_netframework_clrmemory_gc_time_percent", dto.MetricType_GAUGE, 25, ""},
|
||||
{"windows_netframework_clrmemory_gc_time_ratio", dto.MetricType_GAUGE, 0.25, ""},
|
||||
}, true)
|
||||
}
|
||||
|
||||
func TestClrRemotingMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrRemoting()
|
||||
|
||||
row := perfDataClrRemoting{
|
||||
@@ -366,14 +367,15 @@ func TestClrRemotingMetricCompatibility(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClrSecurityMetricCompatibility(t *testing.T) {
|
||||
c := &Collector{perfFrequency: 1000}
|
||||
c := &Collector{}
|
||||
c.describeClrSecurity()
|
||||
|
||||
row := perfDataClrSecurity{
|
||||
NumberLinkTimeChecks: 11,
|
||||
PercentTimeinRTchecks: 50,
|
||||
StackWalkDepth: 13,
|
||||
TotalRuntimeChecks: 14,
|
||||
NumberLinkTimeChecks: 11,
|
||||
PercentTimeinRTchecks: 50,
|
||||
PercentTimeinRTchecksBase: 200,
|
||||
StackWalkDepth: 13,
|
||||
TotalRuntimeChecks: 14,
|
||||
}
|
||||
rows := make([]perfDataClrSecurity, 0, 4)
|
||||
|
||||
@@ -385,7 +387,7 @@ func TestClrSecurityMetricCompatibility(t *testing.T) {
|
||||
c.perfClrSecurity = &fixturePerfCollector[perfDataClrSecurity]{rows: rows}
|
||||
assertFixtureMetrics(t, c.collectClrSecurity, []expectedMetric{
|
||||
{"windows_netframework_clrsecurity_link_time_checks_total", dto.MetricType_COUNTER, 11, ""},
|
||||
{"windows_netframework_clrsecurity_rt_checks_time_percent", dto.MetricType_GAUGE, 0.05, ""},
|
||||
{"windows_netframework_clrsecurity_rt_checks_time_ratio", dto.MetricType_GAUGE, 0.25, ""},
|
||||
{"windows_netframework_clrsecurity_stack_walk_depth", dto.MetricType_GAUGE, 13, ""},
|
||||
{"windows_netframework_clrsecurity_runtime_checks_total", dto.MetricType_COUNTER, 14, ""},
|
||||
}, false)
|
||||
@@ -403,7 +405,7 @@ func TestGCZeroBaseDoesNotPublishInvalidRatio(t *testing.T) {
|
||||
foundAllocated := false
|
||||
|
||||
for _, family := range families {
|
||||
require.NotEqual(t, "windows_netframework_clrmemory_gc_time_percent", family.GetName())
|
||||
require.NotEqual(t, "windows_netframework_clrmemory_gc_time_ratio", family.GetName())
|
||||
|
||||
if family.GetName() == "windows_netframework_clrmemory_allocated_bytes_total" {
|
||||
require.InDelta(t, 99.0, family.GetMetric()[0].GetCounter().GetValue(), 1e-12)
|
||||
@@ -415,6 +417,31 @@ func TestGCZeroBaseDoesNotPublishInvalidRatio(t *testing.T) {
|
||||
require.True(t, foundAllocated)
|
||||
}
|
||||
|
||||
func TestJITAndSecurityZeroBaseDoNotPublishInvalidRatio(t *testing.T) {
|
||||
c := &Collector{}
|
||||
c.describeClrJIT()
|
||||
c.describeClrSecurity()
|
||||
c.perfClrJIT = &fixturePerfCollector[perfDataClrJIT]{rows: []perfDataClrJIT{{Name: "worker", PercentTimeinJit: 50, NumberofMethodsJitted: 7}}}
|
||||
c.perfClrSecurity = &fixturePerfCollector[perfDataClrSecurity]{rows: []perfDataClrSecurity{{Name: "worker", PercentTimeinRTchecks: 50, TotalRuntimeChecks: 7}}}
|
||||
registry := prometheus.NewRegistry()
|
||||
registry.MustRegister(fixturePromCollector{collect: func(ch chan<- prometheus.Metric) {
|
||||
require.NoError(t, c.collectClrJIT(ch, nil, time.Second))
|
||||
require.NoError(t, c.collectClrSecurity(ch, nil, time.Second))
|
||||
}})
|
||||
families, err := registry.Gather()
|
||||
require.NoError(t, err)
|
||||
|
||||
names := make([]string, 0, len(families))
|
||||
for _, family := range families {
|
||||
names = append(names, family.GetName())
|
||||
}
|
||||
|
||||
require.Contains(t, names, "windows_netframework_clrjit_jit_methods_total")
|
||||
require.Contains(t, names, "windows_netframework_clrsecurity_runtime_checks_total")
|
||||
require.NotContains(t, names, "windows_netframework_clrjit_jit_time_ratio")
|
||||
require.NotContains(t, names, "windows_netframework_clrsecurity_rt_checks_time_ratio")
|
||||
}
|
||||
|
||||
// TestDuplicateProcessNames checks that processes with the same name, which
|
||||
// the CLR objects report with the same instance name, are published apart.
|
||||
func TestDuplicateProcessNames(t *testing.T) {
|
||||
|
||||
@@ -11,6 +11,8 @@ recorded on Windows Server 2025 (build 26100) with almost no RADIUS traffic.
|
||||
- `Server Up Time` and `Server Reset Time` are elapsed times. The help text
|
||||
says "in hundredths of a second", but the raw value is seconds: 303 about
|
||||
304 s after the `IAS` service started. Both objects report the same values.
|
||||
The collector publishes them as gauges (`..._time_seconds`); the other
|
||||
counters are counters with a `_total` suffix.
|
||||
- Each `X / sec.` twin (`PERF_COUNTER_COUNTER`, not read) has the same raw
|
||||
value as `X` (`Packets Received / sec.` 1 = `Packets Received` 1).
|
||||
- `No Record` exists only on `NPS Accounting Server`;
|
||||
|
||||
@@ -101,152 +101,152 @@ func (c *Collector) Close() error {
|
||||
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
c.accessAccepts = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_accepts"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_accepts_total"),
|
||||
"(AccessAccepts)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessChallenges = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_challenges"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_challenges_total"),
|
||||
"(AccessChallenges)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessRejects = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_rejects"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_rejects_total"),
|
||||
"(AccessRejects)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_requests"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_requests_total"),
|
||||
"(AccessRequests)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessBadAuthenticators = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_bad_authenticators"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_bad_authenticators_total"),
|
||||
"(BadAuthenticators)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessDroppedPackets = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_dropped_packets"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_dropped_packets_total"),
|
||||
"(DroppedPackets)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessInvalidRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_invalid_requests"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_invalid_requests_total"),
|
||||
"(InvalidRequests)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessMalformedPackets = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_malformed_packets"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_malformed_packets_total"),
|
||||
"(MalformedPackets)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessPacketsReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_packets_received"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_packets_received_total"),
|
||||
"(PacketsReceived)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessPacketsSent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_packets_sent"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_packets_sent_total"),
|
||||
"(PacketsSent)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessServerResetTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_server_reset_time"),
|
||||
"(ServerResetTime)",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_server_reset_time_seconds"),
|
||||
"(ServerResetTime) Elapsed time in seconds since the NPS server counters were last reset",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessServerUpTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_server_up_time"),
|
||||
"(ServerUpTime)",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_server_up_time_seconds"),
|
||||
"(ServerUpTime) Elapsed time in seconds since the NPS service started",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accessUnknownType = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_unknown_type"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "access_unknown_type_total"),
|
||||
"(UnknownType)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
c.accountingRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_requests"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_requests_total"),
|
||||
"(AccountingRequests)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingResponses = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_responses"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_responses_total"),
|
||||
"(AccountingResponses)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingBadAuthenticators = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_bad_authenticators"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_bad_authenticators_total"),
|
||||
"(BadAuthenticators)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingDroppedPackets = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_dropped_packets"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_dropped_packets_total"),
|
||||
"(DroppedPackets)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingInvalidRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_invalid_requests"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_invalid_requests_total"),
|
||||
"(InvalidRequests)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingMalformedPackets = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_malformed_packets"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_malformed_packets_total"),
|
||||
"(MalformedPackets)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingNoRecord = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_no_record"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_no_record_total"),
|
||||
"(NoRecord)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingPacketsReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_received"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_received_total"),
|
||||
"(PacketsReceived)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingPacketsSent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_sent"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_sent_total"),
|
||||
"(PacketsSent)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingServerResetTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_reset_time"),
|
||||
"(ServerResetTime)",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_reset_time_seconds"),
|
||||
"(ServerResetTime) Elapsed time in seconds since the NPS server counters were last reset",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingServerUpTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_up_time"),
|
||||
"(ServerUpTime)",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_up_time_seconds"),
|
||||
"(ServerUpTime) Elapsed time in seconds since the NPS service started",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.accountingUnknownType = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_unknown_type"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "accounting_unknown_type_total"),
|
||||
"(UnknownType)",
|
||||
nil,
|
||||
nil,
|
||||
@@ -355,13 +355,13 @@ func (c *Collector) collectAccept(ch chan<- prometheus.Metric) error {
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.accessServerResetTime,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
c.accessPerfDataObject[0].AccessServerResetTime,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.accessServerUpTime,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
c.accessPerfDataObject[0].AccessServerUpTime,
|
||||
)
|
||||
|
||||
@@ -436,13 +436,13 @@ func (c *Collector) collectAccounting(ch chan<- prometheus.Metric) error {
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.accountingServerResetTime,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
c.accountingPerfDataObject[0].AccountingServerResetTime,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.accountingServerUpTime,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
c.accountingPerfDataObject[0].AccountingServerUpTime,
|
||||
)
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.printerJobCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "job_count"),
|
||||
"Number of jobs processed by the printer since the last reset",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "jobs"),
|
||||
"Number of jobs in the queue of the printer",
|
||||
[]string{"printer"},
|
||||
nil,
|
||||
)
|
||||
@@ -190,7 +190,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, _ time.Duration) error
|
||||
// Win32_Printer JobCountSinceLastReset is PRINTER_INFO_2.cJobs, the number of queued jobs.
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.printerJobCount,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
float64(printer.Jobs),
|
||||
printer.Name,
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ func BenchmarkCollector(b *testing.B) {
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
metrics := testutils.TestCollector(t, printer.New, nil)
|
||||
testutils.RequireFixtureMetric(t, metrics, printer.Name, "windows_printer_job_count", prometheus.Labels{"printer": "CIPrinter"})
|
||||
testutils.RequireFixtureMetric(t, metrics, printer.Name, "windows_printer_jobs", prometheus.Labels{"printer": "CIPrinter"})
|
||||
}
|
||||
|
||||
// TestCollectorWithoutMISession checks that the collector does not depend on WMI.
|
||||
|
||||
@@ -202,7 +202,7 @@ func (c *Collector) Build(logger *slog.Logger, miSession *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.cpuTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_time_total"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_time_seconds_total"),
|
||||
"Returns elapsed time that all of the threads of this process used the processor to execute instructions by mode (privileged, user).",
|
||||
[]string{"process", "process_id", "mode"},
|
||||
nil,
|
||||
|
||||
@@ -68,7 +68,7 @@ func TestCollectorCurrentProcess(t *testing.T) {
|
||||
require.Positive(t, testutils.MetricValuesByLabel(families, name, "process_id")[pid], name)
|
||||
}
|
||||
|
||||
cpu := families["windows_process_cpu_time_total"].GetMetric()
|
||||
cpu := families["windows_process_cpu_time_seconds_total"].GetMetric()
|
||||
require.Len(t, cpu, 2)
|
||||
require.NotNil(t, cpu[0].GetCounter())
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ type Collector struct {
|
||||
config Config
|
||||
logger *slog.Logger
|
||||
|
||||
lastResult *prometheus.Desc
|
||||
lastResultStatus *prometheus.Desc
|
||||
missedRuns *prometheus.Desc
|
||||
state *prometheus.Desc
|
||||
@@ -208,14 +207,6 @@ func (c *Collector) Close() error {
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
c.logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
c.lastResult = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "last_result"),
|
||||
"DEPRECATED: use windows_scheduled_task_last_result_status. "+
|
||||
"1 if the last result code of the registered task is zero, 0 otherwise",
|
||||
[]string{"task"},
|
||||
nil,
|
||||
)
|
||||
|
||||
c.lastResultStatus = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "last_result_status"),
|
||||
"The last result status of a scheduled task, 1 if the current status, 0 otherwise",
|
||||
@@ -370,18 +361,6 @@ func (c *Collector) taskMetrics(task ScheduledTask) []prometheus.Metric {
|
||||
return metrics
|
||||
}
|
||||
|
||||
lastResult := 0.0
|
||||
if task.LastTaskResult == SCHED_S_SUCCESS {
|
||||
lastResult = 1.0
|
||||
}
|
||||
|
||||
metrics = append(metrics, prometheus.MustNewConstMetric(
|
||||
c.lastResult,
|
||||
prometheus.GaugeValue,
|
||||
lastResult,
|
||||
task.Path,
|
||||
))
|
||||
|
||||
if !c.config.MissedRuns {
|
||||
return metrics
|
||||
}
|
||||
|
||||
@@ -167,23 +167,13 @@ func TestCollectMetrics(t *testing.T) {
|
||||
|
||||
if tc.result == 0x41303 {
|
||||
require.Len(t, families, 2)
|
||||
require.NotContains(t, families, "windows_scheduled_task_last_result")
|
||||
require.NotContains(t, families, "windows_scheduled_task_missed_runs")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
require.Len(t, families, 4)
|
||||
lastResult := families["windows_scheduled_task_last_result"]
|
||||
require.NotNil(t, lastResult)
|
||||
require.Len(t, lastResult.GetMetric(), 1)
|
||||
|
||||
wantSuccess := 0.0
|
||||
if tc.result == 0 {
|
||||
wantSuccess = 1
|
||||
}
|
||||
|
||||
require.InDelta(t, wantSuccess, lastResult.GetMetric()[0].GetGauge().GetValue(), 0)
|
||||
require.Len(t, families, 3)
|
||||
require.NotContains(t, families, "windows_scheduled_task_last_result")
|
||||
|
||||
missedRuns := families["windows_scheduled_task_missed_runs"]
|
||||
require.NotNil(t, missedRuns)
|
||||
@@ -252,7 +242,7 @@ func TestCollectMetricsCache(t *testing.T) {
|
||||
|
||||
for i, scrape := range []ScheduledTasks{tasks, tasks, changed, changed} {
|
||||
// Collect once outside the registry, which calls Collect for Describe too.
|
||||
collected := make(chan prometheus.Metric, len(scrape)*19)
|
||||
collected := make(chan prometheus.Metric, len(scrape)*18)
|
||||
cacheScrape := scrapecache.Begin(c)
|
||||
c.collectMetrics(collected, scrape)
|
||||
cacheScrape.End(nil)
|
||||
@@ -283,7 +273,7 @@ func TestCollectMetricsCache(t *testing.T) {
|
||||
current := make(map[string][]prometheus.Metric, len(scrape))
|
||||
|
||||
for _, task := range scrape {
|
||||
n := 19
|
||||
n := 18
|
||||
if task.LastTaskResult == SCHED_S_TASK_HAS_NOT_RUN {
|
||||
n = 17
|
||||
}
|
||||
@@ -359,7 +349,7 @@ func BenchmarkCollectMetrics(b *testing.B) {
|
||||
require.NoError(b, c.Build(slog.New(slog.DiscardHandler), nil))
|
||||
|
||||
tasks := benchmarkTasks(265)
|
||||
ch := make(chan prometheus.Metric, len(tasks)*19)
|
||||
ch := make(chan prometheus.Metric, len(tasks)*18)
|
||||
|
||||
b.ReportAllocs()
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ func TestFetchTasksFilters(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
require.Len(t, families, 4)
|
||||
require.Len(t, families, 3)
|
||||
|
||||
for _, family := range families {
|
||||
paths := make([]string, 0, len(family.GetMetric()))
|
||||
@@ -321,7 +321,7 @@ func TestFetchTasksInFolderSkipsMissedRuns(t *testing.T) {
|
||||
require.Zero(t, task.reads[taskSlotMissedRuns])
|
||||
|
||||
families := gatherTaskMetrics(t, config, tasks)
|
||||
require.Contains(t, families, "windows_scheduled_task_last_result")
|
||||
require.Contains(t, families, "windows_scheduled_task_last_result_status")
|
||||
require.NotContains(t, families, "windows_scheduled_task_missed_runs")
|
||||
}
|
||||
|
||||
|
||||
@@ -103,13 +103,13 @@ func (c *Collector) Close() error {
|
||||
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
c.currentOpenFileCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "server_shares_current_open_file_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "server_shares_open_files"),
|
||||
"Current total count open files on the SMB Server Share",
|
||||
[]string{"share"},
|
||||
nil,
|
||||
)
|
||||
c.treeConnectCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "server_shares_tree_connect_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "server_shares_tree_connects"),
|
||||
"Count of user connections to the SMB Server Share",
|
||||
[]string{"share"},
|
||||
nil,
|
||||
|
||||
@@ -38,8 +38,8 @@ func TestCollector(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, name := range []string{
|
||||
"windows_smb_server_shares_current_open_file_count",
|
||||
"windows_smb_server_shares_tree_connect_count",
|
||||
"windows_smb_server_shares_open_files",
|
||||
"windows_smb_server_shares_tree_connects",
|
||||
} {
|
||||
require.Contains(t, metrics, name)
|
||||
require.Equal(t, dto.MetricType_GAUGE, metrics[name].GetType(), name)
|
||||
|
||||
@@ -61,10 +61,10 @@ func TestCollector(t *testing.T) {
|
||||
require.GreaterOrEqual(t, metric.GetGauge().GetValue(), float64(1<<30))
|
||||
}
|
||||
|
||||
if metric := testutils.RequireFixtureMetric(t, metrics, storage_spaces.Name, "windows_storage_spaces_virtual_disk_storage_efficiency_percent", virtualDisk); metric != nil {
|
||||
if metric := testutils.RequireFixtureMetric(t, metrics, storage_spaces.Name, "windows_storage_spaces_virtual_disk_storage_efficiency_ratio", virtualDisk); metric != nil {
|
||||
value := metric.GetGauge().GetValue()
|
||||
require.Greater(t, value, 0.0)
|
||||
require.LessOrEqual(t, value, 100.0)
|
||||
require.LessOrEqual(t, value, 1.0)
|
||||
}
|
||||
|
||||
// Every pool, including the built-in primordial pool, must carry a boolean primordial label.
|
||||
|
||||
@@ -96,8 +96,8 @@ func (c *Collector) buildVirtualDisk() error {
|
||||
)
|
||||
|
||||
c.virtualDiskStorageEfficiency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, nameVirtualDisk, "storage_efficiency_percent"),
|
||||
"Storage efficiency percentage (AllocatedSize / FootprintOnPool * 100), omitted while FootprintOnPool is 0",
|
||||
prometheus.BuildFQName(types.Namespace, nameVirtualDisk, "storage_efficiency_ratio"),
|
||||
"Storage efficiency ratio (AllocatedSize / FootprintOnPool), omitted while FootprintOnPool is 0",
|
||||
[]string{"name", "unique_id"},
|
||||
nil,
|
||||
)
|
||||
@@ -169,7 +169,7 @@ func (c *Collector) collectVirtualDisk(ch chan<- prometheus.Metric, maxScrapeDur
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualDiskStorageEfficiency,
|
||||
prometheus.GaugeValue,
|
||||
float64(vdisk.AllocatedSize)/float64(vdisk.FootprintOnPool)*100,
|
||||
float64(vdisk.AllocatedSize)/float64(vdisk.FootprintOnPool),
|
||||
vdisk.FriendlyName,
|
||||
vdisk.UniqueId,
|
||||
)
|
||||
|
||||
@@ -206,7 +206,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.connectionsStateCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "connections_state_count"),
|
||||
prometheus.BuildFQName(types.Namespace, Name, "connections"),
|
||||
"Number of TCP connections by state and address family",
|
||||
[]string{"af", "state"},
|
||||
nil,
|
||||
|
||||
@@ -171,8 +171,8 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.clockFrequencyAdjustmentPPB = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "clock_frequency_adjustment_ppb"),
|
||||
"This value reflects the adjustment made to the local system clock frequency by W32Time in Parts Per Billion (PPB) units. 1 PPB adjustment imples the system clock was adjusted at a rate of 1 nanosecond per second. The smallest possible adjustment can vary and can be expected to be in the order of 100's of PPB. This counter helps visualize the finer actions being taken by W32time to synchronize the local clock.",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "clock_frequency_adjustment_ratio"),
|
||||
"This value reflects the adjustment made to the local system clock frequency by W32Time as a ratio. Windows reports it in Parts Per Billion (PPB): an adjustment of 1e-9 implies the system clock was adjusted at a rate of 1 nanosecond per second. The smallest possible adjustment can vary and can be expected to be in the order of 100's of PPB. This counter helps visualize the finer actions being taken by W32time to synchronize the local clock.",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
@@ -320,7 +320,7 @@ func (c *Collector) collectNTP(ch chan<- prometheus.Metric) error {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.clockFrequencyAdjustmentPPB,
|
||||
prometheus.GaugeValue,
|
||||
c.perfDataObject[0].ClockFrequencyAdjustmentPPB,
|
||||
c.perfDataObject[0].ClockFrequencyAdjustmentPPB*1e-9,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -59,13 +59,13 @@ type Collector struct {
|
||||
memTargetSize *prometheus.Desc
|
||||
memUsed *prometheus.Desc
|
||||
|
||||
cpuLimitMHz *prometheus.Desc
|
||||
cpuReservationMHz *prometheus.Desc
|
||||
cpuShares *prometheus.Desc
|
||||
cpuStolenTotal *prometheus.Desc
|
||||
cpuTimeTotal *prometheus.Desc
|
||||
cpuEffectiveVMSpeedMHz *prometheus.Desc
|
||||
hostProcessorSpeedMHz *prometheus.Desc
|
||||
cpuLimitHertz *prometheus.Desc
|
||||
cpuReservationHertz *prometheus.Desc
|
||||
cpuShares *prometheus.Desc
|
||||
cpuStolenTotal *prometheus.Desc
|
||||
cpuTimeTotal *prometheus.Desc
|
||||
cpuEffectiveVMSpeedHertz *prometheus.Desc
|
||||
hostProcessorSpeedHertz *prometheus.Desc
|
||||
}
|
||||
|
||||
func New(config *Config) *Collector {
|
||||
@@ -111,15 +111,15 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
errs = append(errs, fmt.Errorf("failed to create VM Memory collector: %w", err))
|
||||
}
|
||||
|
||||
c.cpuLimitMHz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_limit_mhz"),
|
||||
"The maximum processing power in MHz allowed to the virtual machine. Assigning a CPU Limit ensures that this virtual machine never consumes more than a certain amount of the available processor power. By limiting the amount of processing power consumed, a portion of the processing power becomes available to other virtual machines.",
|
||||
c.cpuLimitHertz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_limit_hertz"),
|
||||
"The maximum processing power in hertz allowed to the virtual machine. Assigning a CPU Limit ensures that this virtual machine never consumes more than a certain amount of the available processor power. By limiting the amount of processing power consumed, a portion of the processing power becomes available to other virtual machines.",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.cpuReservationMHz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_reservation_mhz"),
|
||||
"The minimum processing power in MHz available to the virtual machine. Assigning a CPU Reservation ensures that even as other virtual machines on the same host consume shared processing power, there is still a certain minimum amount for this virtual machine.",
|
||||
c.cpuReservationHertz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_reservation_hertz"),
|
||||
"The minimum processing power in hertz available to the virtual machine. Assigning a CPU Reservation ensures that even as other virtual machines on the same host consume shared processing power, there is still a certain minimum amount for this virtual machine.",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
@@ -141,15 +141,15 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.cpuEffectiveVMSpeedMHz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_effective_vm_speed_mhz_total"),
|
||||
"The effective speed of the VM’s virtual CPU",
|
||||
c.cpuEffectiveVMSpeedHertz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cpu_effective_vm_speed_hertz"),
|
||||
"The effective speed of the VM’s virtual CPU in hertz",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hostProcessorSpeedMHz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "host_processor_speed_mhz"),
|
||||
"Host Processor speed",
|
||||
c.hostProcessorSpeedHertz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "host_processor_speed_hertz"),
|
||||
"Host processor speed in hertz",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
@@ -334,15 +334,15 @@ func (c *Collector) collectCpu(ch chan<- prometheus.Metric) error {
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.cpuLimitMHz,
|
||||
c.cpuLimitHertz,
|
||||
prometheus.GaugeValue,
|
||||
c.perfDataObjectCPU[0].CPULimitMHz,
|
||||
c.perfDataObjectCPU[0].CPULimitMHz*1e6,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.cpuReservationMHz,
|
||||
c.cpuReservationHertz,
|
||||
prometheus.GaugeValue,
|
||||
c.perfDataObjectCPU[0].CPUReservationMHz,
|
||||
c.perfDataObjectCPU[0].CPUReservationMHz*1e6,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
@@ -364,15 +364,15 @@ func (c *Collector) collectCpu(ch chan<- prometheus.Metric) error {
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.cpuEffectiveVMSpeedMHz,
|
||||
c.cpuEffectiveVMSpeedHertz,
|
||||
prometheus.GaugeValue,
|
||||
c.perfDataObjectCPU[0].CPUEffectiveVMSpeedMHz,
|
||||
c.perfDataObjectCPU[0].CPUEffectiveVMSpeedMHz*1e6,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hostProcessorSpeedMHz,
|
||||
c.hostProcessorSpeedHertz,
|
||||
prometheus.GaugeValue,
|
||||
c.perfDataObjectCPU[0].CPUHostProcessorSpeedMHz,
|
||||
c.perfDataObjectCPU[0].CPUHostProcessorSpeedMHz*1e6,
|
||||
)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user