chore: Move private packages to internal (#1664)

This commit is contained in:
Jan-Otto Kröpke
2024-10-03 20:23:56 +02:00
committed by GitHub
parent bcfe6df24d
commit 5d95610c84
181 changed files with 1680 additions and 1867 deletions

View File

@@ -37,7 +37,7 @@ jobs:
- name: check
run: |
PR_TITLE_PREFIX=$(echo "$PR_TITLE" | cut -d':' -f1)
if [[ -d "pkg/collector/$PR_TITLE_PREFIX" ]] ||[[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]]; then
if [[ -d "internal/collector/$PR_TITLE_PREFIX" ]] || [[ -d "internal/$PR_TITLE_PREFIX" ]] || [[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]]; then
exit 0
fi

View File

@@ -34,7 +34,7 @@ linters-settings:
gci:
sections:
- prefix(github.com/prometheus-community/windows_exporter/pkg/initiate)
- prefix(github.com/prometheus-community/windows_exporter/internal/initiate)
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
custom-order: true
@@ -83,7 +83,7 @@ issues:
- text: "don't use ALL_CAPS in Go names; use CamelCase"
linters:
- revive
- path: pkg/perflib/
- path: internal/perflib/
linters:
- godox
- stylecheck

View File

@@ -2,6 +2,7 @@ go:
# Whenever the Go version is updated here,
# .github/workflows should also be updated.
version: 1.23
cgo: false
repository:
path: github.com/prometheus-community/windows_exporter
build:
@@ -21,4 +22,5 @@ tarball:
- LICENSE
crossbuild:
platforms:
- windows
- windows/amd64
- windows/arm64

View File

@@ -29,7 +29,7 @@ test:
go test -v ./...
bench:
go test -v -bench='benchmarkcollector' ./pkg/collector/{cpu,logical_disk,physical_disk,logon,memory,net,printer,process,service,system,tcp,time}
go test -v -bench='benchmarkcollector' ./internal/collectors/{cpu,logical_disk,physical_disk,logon,memory,net,printer,process,service,system,tcp,time}
lint:
golangci-lint -c .golangci.yaml run

View File

@@ -1,3 +1,5 @@
# example configuration file for windows_exporter
collectors:
enabled: cpu,cpu_info,exchange,iis,logical_disk,logon,memory,net,os,process,remote_fx,service,system,tcp,time,terminal_services,textfile
collector:

View File

@@ -1,140 +0,0 @@
{{ template "head" . }}
{{ template "prom_content_head" . }}
<h1>Node Overview - {{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</h1>
<h3>CPU Usage</h3>
<div id="cpuGraph"></div>
<script>
new PromConsole.Graph({
node: document.querySelector("#cpuGraph"),
expr: "sum by (mode)(irate(windows_cpu_time_total{job='node',instance='{{ .Params.instance }}',mode!='idle'}[5m]))",
renderer: 'area',
max: {{ with printf "count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance | query }}{{ . | first | value }}{{ else}}undefined{{end}},
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yTitle: 'Cores'
})
</script>
<h3>Network Utilization</h3>
<div id="networkioGraph"></div>
<script>
new PromConsole.Graph({
node: document.querySelector("#networkioGraph"),
expr: [
"irate(windows_net_bytes_sent_total{job='node',instance='{{ .Params.instance }}',nic!~'^isatap_ec2_internal'}[5m])",
"irate(windows_net_bytes_received_total{job='node',instance='{{ .Params.instance }}',nic!~'^isatap_ec2_internal'}[5m])",
],
min: 0,
name: [ 'sent', 'received' ],
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yUnits: "B",
yTitle: 'Network IO'
})
</script>
<h3>Disk I/O Utilization</h3>
<div id="diskioGraph"></div>
<script>
new PromConsole.Graph({
node: document.querySelector("#diskioGraph"),
expr: [
"100 - irate(windows_logical_disk_idle_seconds_total{job='node',instance='{{ .Params.instance }}',volume!~'^HarddiskVolume.*$'}[5m]) * 100",
],
min: 0,
name: '[[ volume ]]',
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yUnits: "%",
yTitle: 'Disk I/O Utilization'
})
</script>
<h3>Memory</h3>
<div id="memoryGraph"></div>
<script>
new PromConsole.Graph({
node: document.querySelector("#memoryGraph"),
renderer: 'area',
expr: [
"windows_cs_physical_memory_bytes{job='node',instance='{{ .Params.instance }}'}",
"windows_os_physical_memory_free_bytes{job='node',instance='{{ .Params.instance }}'}",
"windows_cs_physical_memory__bytes{job='node',instance='{{ .Params.instance }}'} - windows_os_physical_memory_free_bytes{job='node',instance='{{.Params.instance}}'}",
"windows_os_virtual_memory_bytes{job='node',instance='{{ .Params.instance }}'}",
],
name: ["Physical", "Free", "Used", "Virtual"],
min: 0,
yUnits: "B",
yAxisFormatter: PromConsole.NumberFormatter.humanize1024,
yHoverFormatter: PromConsole.NumberFormatter.humanize1024,
yTitle: 'Memory'
})
</script>
{{ template "prom_right_table_head" }}
<tr><th colspan="2">Overview</th></tr>
<tr>
<td>User CPU</td>
<td>{{ template "prom_query_drilldown" (args (printf "sum(irate(windows_cpu_time_total{job='node',instance='%s',mode='user'}[5m])) * 100 / count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }}</td>
</tr>
<tr>
<td>Privileged CPU</td>
<td>{{ template "prom_query_drilldown" (args (printf "sum(irate(windows_cpu_time_total{job='node',instance='%s',mode='privileged'}[5m])) * 100 / count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }}</td>
</tr>
<tr>
<td>Memory Total</td>
<td>{{ template "prom_query_drilldown" (args (printf "windows_cs_physical_memory_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
</tr>
<tr>
<td>Memory Free</td>
<td>{{ template "prom_query_drilldown" (args (printf "windows_os_physical_memory_free_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
</tr>
<tr>
<th colspan="2">Network</th>
</tr>
{{ range printf "windows_net_bytes_received_total{job='node',instance='%s',nic!='isatap_ec2_internal'}" .Params.instance | query | sortByLabel "nic" }}
<tr>
<td>{{ .Labels.nic }} Received</td>
<td>{{ template "prom_query_drilldown" (args (printf "irate(windows_net_bytes_received_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }}</td>
</tr>
<tr>
<td>{{ .Labels.nic }} Transmitted</td>
<td>{{ template "prom_query_drilldown" (args (printf "irate(windows_net_bytes_sent_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }}</td>
</tr>
{{ end }}
</tr>
<tr>
<th colspan="2">Disks</th>
</tr>
{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }}
<tr>
<td>{{ .Labels.volume }} Utilization</td>
<td>{{ template "prom_query_drilldown" (args (printf "100 - irate(windows_logical_disk_idle_seconds_total{job='node',instance='%s',volume='%s'}[5m]) * 100" .Labels.instance .Labels.volume) "%" "printf.1f") }}</td>
</tr>
{{ end }}
{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }}
<tr>
<td>{{ .Labels.volume }} Throughput</td>
<td>{{ template "prom_query_drilldown" (args (printf "irate(windows_logical_disk_read_bytes_total{job='node',instance='%s',volume='%s'}[5m]) + irate(windows_logical_disk_write_bytes_total{job='node',instance='%s',volume='%s'}[5m])" .Labels.instance .Labels.volume .Labels.instance .Labels.volume) "B/s" "humanize") }}</td>
</tr>
{{ end }}
<tr>
<th colspan="2">Filesystem Fullness</th>
</tr>
{{ define "roughlyNearZero" }}
{{ if gt .1 . }}~0{{ else }}{{ printf "%.1f" . }}{{ end }}
{{ end }}
{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }}
<tr>
<td>{{ .Labels.volume }}</td>
<td>{{ template "prom_query_drilldown" (args (printf "100 - windows_logical_disk_free_bytes{job='node',instance='%s',volume='%s'} / windows_logical_disk_size_bytes{job='node'} * 100" .Labels.instance .Labels.volume) "%" "roughlyNearZero") }}</td>
</tr>
{{ end }}
</tr>
{{ template "prom_right_table_tail" }}
{{ template "prom_content_tail" . }}
{{ template "tail" }}

View File

@@ -7,8 +7,7 @@ package main
//goland:noinspection GoUnsortedImport
//nolint:gofumpt
import (
// Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts.
"github.com/prometheus-community/windows_exporter/pkg/initiate"
"github.com/prometheus-community/windows_exporter/internal/initiate"
"context"
"errors"
@@ -25,13 +24,13 @@ import (
"time"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/internal/config"
"github.com/prometheus-community/windows_exporter/internal/httphandler"
"github.com/prometheus-community/windows_exporter/internal/log"
"github.com/prometheus-community/windows_exporter/internal/log/flag"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus-community/windows_exporter/pkg/collector"
"github.com/prometheus-community/windows_exporter/pkg/config"
"github.com/prometheus-community/windows_exporter/pkg/httphandler"
winlog "github.com/prometheus-community/windows_exporter/pkg/log"
"github.com/prometheus-community/windows_exporter/pkg/log/flag"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus/common/version"
"github.com/prometheus/exporter-toolkit/web"
webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag"
@@ -99,8 +98,8 @@ func run() int {
).Default("normal").String()
)
winlogConfig := &winlog.Config{}
flag.AddFlags(app, winlogConfig)
logConfig := &log.Config{}
flag.AddFlags(app, logConfig)
app.Version(version.Print("windows_exporter"))
app.HelpFlag.Short('h')
@@ -119,7 +118,7 @@ func run() int {
return 1
}
logger, err := winlog.New(winlogConfig)
logger, err := log.New(logConfig)
if err != nil {
//nolint:sloglint // we do not have an logger yet
slog.Error("failed to create logger",
@@ -161,7 +160,7 @@ func run() int {
return 1
}
logger, err = winlog.New(winlogConfig)
logger, err = log.New(logConfig)
if err != nil {
//nolint:sloglint // we do not have an logger yet
slog.Error("failed to create logger",

View File

@@ -8,9 +8,9 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -284,374 +284,374 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.addressBookOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "address_book_operations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "address_book_operations_total"),
"",
[]string{"operation"},
nil,
)
c.addressBookClientSessions = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "address_book_client_sessions"),
prometheus.BuildFQName(types2.Namespace, Name, "address_book_client_sessions"),
"",
nil,
nil,
)
c.approximateHighestDistinguishedNameTag = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "approximate_highest_distinguished_name_tag"),
prometheus.BuildFQName(types2.Namespace, Name, "approximate_highest_distinguished_name_tag"),
"",
nil,
nil,
)
c.atqEstimatedDelaySeconds = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "atq_estimated_delay_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "atq_estimated_delay_seconds"),
"",
nil,
nil,
)
c.atqOutstandingRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "atq_outstanding_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "atq_outstanding_requests"),
"",
nil,
nil,
)
c.atqAverageRequestLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "atq_average_request_latency"),
prometheus.BuildFQName(types2.Namespace, Name, "atq_average_request_latency"),
"",
nil,
nil,
)
c.atqCurrentThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "atq_current_threads"),
prometheus.BuildFQName(types2.Namespace, Name, "atq_current_threads"),
"",
[]string{"service"},
nil,
)
c.searchesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "searches_total"),
prometheus.BuildFQName(types2.Namespace, Name, "searches_total"),
"",
[]string{"scope"},
nil,
)
c.databaseOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "database_operations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "database_operations_total"),
"",
[]string{"operation"},
nil,
)
c.bindsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "binds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "binds_total"),
"",
[]string{"bind_method"},
nil,
)
c.replicationHighestUsn = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_highest_usn"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_highest_usn"),
"",
[]string{"state"},
nil,
)
c.intraSiteReplicationDataBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_data_intrasite_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_data_intrasite_bytes_total"),
"",
[]string{"direction"},
nil,
)
c.interSiteReplicationDataBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_data_intersite_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_data_intersite_bytes_total"),
"",
[]string{"direction"},
nil,
)
c.replicationInboundSyncObjectsRemaining = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_inbound_sync_objects_remaining"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_inbound_sync_objects_remaining"),
"",
nil,
nil,
)
c.replicationInboundLinkValueUpdatesRemaining = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_inbound_link_value_updates_remaining"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_inbound_link_value_updates_remaining"),
"",
nil,
nil,
)
c.replicationInboundObjectsUpdatedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_inbound_objects_updated_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_inbound_objects_updated_total"),
"",
nil,
nil,
)
c.replicationInboundObjectsFilteredTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_inbound_objects_filtered_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_inbound_objects_filtered_total"),
"",
nil,
nil,
)
c.replicationInboundPropertiesUpdatedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_inbound_properties_updated_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_inbound_properties_updated_total"),
"",
nil,
nil,
)
c.replicationInboundPropertiesFilteredTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_inbound_properties_filtered_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_inbound_properties_filtered_total"),
"",
nil,
nil,
)
c.replicationPendingOperations = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_pending_operations"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_pending_operations"),
"",
nil,
nil,
)
c.replicationPendingSynchronizations = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_pending_synchronizations"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_pending_synchronizations"),
"",
nil,
nil,
)
c.replicationSyncRequestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_sync_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_sync_requests_total"),
"",
nil,
nil,
)
c.replicationSyncRequestsSuccessTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_sync_requests_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_sync_requests_success_total"),
"",
nil,
nil,
)
c.replicationSyncRequestsSchemaMismatchFailureTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "replication_sync_requests_schema_mismatch_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "replication_sync_requests_schema_mismatch_failure_total"),
"",
nil,
nil,
)
c.nameTranslationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "name_translations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "name_translations_total"),
"",
[]string{"target_name"},
nil,
)
c.changeMonitorsRegistered = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "change_monitors_registered"),
prometheus.BuildFQName(types2.Namespace, Name, "change_monitors_registered"),
"",
nil,
nil,
)
c.changeMonitorUpdatesPending = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "change_monitor_updates_pending"),
prometheus.BuildFQName(types2.Namespace, Name, "change_monitor_updates_pending"),
"",
nil,
nil,
)
c.nameCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "name_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "name_cache_hits_total"),
"",
nil,
nil,
)
c.nameCacheLookupsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "name_cache_lookups_total"),
prometheus.BuildFQName(types2.Namespace, Name, "name_cache_lookups_total"),
"",
nil,
nil,
)
c.directoryOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "directory_operations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "directory_operations_total"),
"",
[]string{"operation", "origin"},
nil,
)
c.directorySearchSubOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "directory_search_suboperations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "directory_search_suboperations_total"),
"",
nil,
nil,
)
c.securityDescriptorPropagationEventsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "security_descriptor_propagation_events_total"),
prometheus.BuildFQName(types2.Namespace, Name, "security_descriptor_propagation_events_total"),
"",
nil,
nil,
)
c.securityDescriptorPropagationEventsQueued = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "security_descriptor_propagation_events_queued"),
prometheus.BuildFQName(types2.Namespace, Name, "security_descriptor_propagation_events_queued"),
"",
nil,
nil,
)
c.securityDescriptorPropagationAccessWaitTotalSeconds = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "security_descriptor_propagation_access_wait_total_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "security_descriptor_propagation_access_wait_total_seconds"),
"",
nil,
nil,
)
c.securityDescriptorPropagationItemsQueuedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "security_descriptor_propagation_items_queued_total"),
prometheus.BuildFQName(types2.Namespace, Name, "security_descriptor_propagation_items_queued_total"),
"",
nil,
nil,
)
c.directoryServiceThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "directory_service_threads"),
prometheus.BuildFQName(types2.Namespace, Name, "directory_service_threads"),
"",
nil,
nil,
)
c.ldapClosedConnectionsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_closed_connections_total"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_closed_connections_total"),
"",
nil,
nil,
)
c.ldapOpenedConnectionsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_opened_connections_total"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_opened_connections_total"),
"",
[]string{"type"},
nil,
)
c.ldapActiveThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_active_threads"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_active_threads"),
"",
nil,
nil,
)
c.ldapLastBindTimeSeconds = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_last_bind_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_last_bind_time_seconds"),
"",
nil,
nil,
)
c.ldapSearchesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_searches_total"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_searches_total"),
"",
nil,
nil,
)
c.ldapUdpOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_udp_operations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_udp_operations_total"),
"",
nil,
nil,
)
c.ldapWritesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_writes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_writes_total"),
"",
nil,
nil,
)
c.ldapClientSessions = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ldap_client_sessions"),
prometheus.BuildFQName(types2.Namespace, Name, "ldap_client_sessions"),
"This is the number of sessions opened by LDAP clients at the time the data is taken. This is helpful in determining LDAP client activity and if the DC is able to handle the load. Of course, spikes during normal periods of authentication — such as first thing in the morning — are not necessarily a problem, but long sustained periods of high values indicate an overworked DC.",
nil,
nil,
)
c.linkValuesCleanedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "link_values_cleaned_total"),
prometheus.BuildFQName(types2.Namespace, Name, "link_values_cleaned_total"),
"",
nil,
nil,
)
c.phantomObjectsCleanedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "phantom_objects_cleaned_total"),
prometheus.BuildFQName(types2.Namespace, Name, "phantom_objects_cleaned_total"),
"",
nil,
nil,
)
c.phantomObjectsVisitedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "phantom_objects_visited_total"),
prometheus.BuildFQName(types2.Namespace, Name, "phantom_objects_visited_total"),
"",
nil,
nil,
)
c.samGroupMembershipEvaluationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_group_membership_evaluations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_group_membership_evaluations_total"),
"",
[]string{"group_type"},
nil,
)
c.samGroupMembershipGlobalCatalogEvaluationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_group_membership_global_catalog_evaluations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_group_membership_global_catalog_evaluations_total"),
"",
nil,
nil,
)
c.samGroupMembershipEvaluationsNonTransitiveTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_group_membership_evaluations_nontransitive_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_group_membership_evaluations_nontransitive_total"),
"",
nil,
nil,
)
c.samGroupMembershipEvaluationsTransitiveTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_group_membership_evaluations_transitive_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_group_membership_evaluations_transitive_total"),
"",
nil,
nil,
)
c.samGroupEvaluationLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_group_evaluation_latency"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_group_evaluation_latency"),
"The mean latency of the last 100 group evaluations performed for authentication",
[]string{"evaluation_type"},
nil,
)
c.samComputerCreationRequestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_computer_creation_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_computer_creation_requests_total"),
"",
nil,
nil,
)
c.samComputerCreationSuccessfulRequestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_computer_creation_successful_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_computer_creation_successful_requests_total"),
"",
nil,
nil,
)
c.samUserCreationRequestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_user_creation_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_user_creation_requests_total"),
"",
nil,
nil,
)
c.samUserCreationSuccessfulRequestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_user_creation_successful_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_user_creation_successful_requests_total"),
"",
nil,
nil,
)
c.samQueryDisplayRequestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_query_display_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_query_display_requests_total"),
"",
nil,
nil,
)
c.samEnumerationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_enumerations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_enumerations_total"),
"",
nil,
nil,
)
c.samMembershipChangesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_membership_changes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_membership_changes_total"),
"",
nil,
nil,
)
c.samPasswordChangesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sam_password_changes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sam_password_changes_total"),
"",
nil,
nil,
)
c.tombstonesObjectsCollectedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tombstoned_objects_collected_total"),
prometheus.BuildFQName(types2.Namespace, Name, "tombstoned_objects_collected_total"),
"",
nil,
nil,
)
c.tombstonesObjectsVisitedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tombstoned_objects_visited_total"),
prometheus.BuildFQName(types2.Namespace, Name, "tombstoned_objects_visited_total"),
"",
nil,
nil,
@@ -662,7 +662,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
if utils.PDHEnabled() {
return c.collectPDH(ch)
}

View File

@@ -3,8 +3,8 @@ package ad_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/ad"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/ad"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -8,10 +8,10 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -101,79 +101,79 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
c.requestsPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "requests_total"),
"Total certificate requests processed",
[]string{"cert_template"},
nil,
)
c.requestProcessingTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "request_processing_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "request_processing_time_seconds"),
"Last time elapsed for certificate requests",
[]string{"cert_template"},
nil,
)
c.retrievalsPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "retrievals_total"),
prometheus.BuildFQName(types2.Namespace, Name, "retrievals_total"),
"Total certificate retrieval requests processed",
[]string{"cert_template"},
nil,
)
c.retrievalProcessingTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "retrievals_processing_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "retrievals_processing_time_seconds"),
"Last time elapsed for certificate retrieval request",
[]string{"cert_template"},
nil,
)
c.failedRequestsPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failed_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failed_requests_total"),
"Total failed certificate requests processed",
[]string{"cert_template"},
nil,
)
c.issuedRequestsPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "issued_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "issued_requests_total"),
"Total issued certificate requests processed",
[]string{"cert_template"},
nil,
)
c.pendingRequestsPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pending_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "pending_requests_total"),
"Total pending certificate requests processed",
[]string{"cert_template"},
nil,
)
c.requestCryptographicSigningTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "request_cryptographic_signing_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "request_cryptographic_signing_time_seconds"),
"Last time elapsed for signing operation request",
[]string{"cert_template"},
nil,
)
c.requestPolicyModuleProcessingTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "request_policy_module_processing_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "request_policy_module_processing_time_seconds"),
"Last time elapsed for policy module processing request",
[]string{"cert_template"},
nil,
)
c.challengeResponsesPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "challenge_responses_total"),
prometheus.BuildFQName(types2.Namespace, Name, "challenge_responses_total"),
"Total certificate challenge responses processed",
[]string{"cert_template"},
nil,
)
c.challengeResponseProcessingTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "challenge_response_processing_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "challenge_response_processing_time_seconds"),
"Last time elapsed for challenge response",
[]string{"cert_template"},
nil,
)
c.signedCertificateTimestampListsPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "signed_certificate_timestamp_lists_total"),
prometheus.BuildFQName(types2.Namespace, Name, "signed_certificate_timestamp_lists_total"),
"Total Signed Certificate Timestamp Lists processed",
[]string{"cert_template"},
nil,
)
c.signedCertificateTimestampListProcessingTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "signed_certificate_timestamp_list_processing_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "signed_certificate_timestamp_list_processing_time_seconds"),
"Last time elapsed for Signed Certificate Timestamp List",
[]string{"cert_template"},
nil,
@@ -182,7 +182,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
return nil
}
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
if utils.PDHEnabled() {
return c.collectPDH(ch)
}
@@ -199,7 +199,7 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
return nil
}
func (c *Collector) collectADCSCounters(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectADCSCounters(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
dst := make([]perflibADCS, 0)
if _, ok := ctx.PerfObjects["Certification Authority"]; !ok {

View File

@@ -0,0 +1,12 @@
package adcs_test
import (
"testing"
adcs2 "github.com/prometheus-community/windows_exporter/internal/collector/adcs"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {
testutils.FuncBenchmarkCollector(b, adcs2.Name, adcs2.NewWithFlags)
}

View File

@@ -11,10 +11,10 @@ import (
"slices"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -164,259 +164,259 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
c.adLoginConnectionFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ad_login_connection_failures_total"),
prometheus.BuildFQName(types2.Namespace, Name, "ad_login_connection_failures_total"),
"Total number of connection failures to an Active Directory domain controller",
nil,
nil,
)
c.certificateAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "certificate_authentications_total"),
prometheus.BuildFQName(types2.Namespace, Name, "certificate_authentications_total"),
"Total number of User Certificate authentications",
nil,
nil,
)
c.deviceAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "device_authentications_total"),
prometheus.BuildFQName(types2.Namespace, Name, "device_authentications_total"),
"Total number of Device authentications",
nil,
nil,
)
c.extranetAccountLockouts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "extranet_account_lockouts_total"),
prometheus.BuildFQName(types2.Namespace, Name, "extranet_account_lockouts_total"),
"Total number of Extranet Account Lockouts",
nil,
nil,
)
c.federatedAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "federated_authentications_total"),
prometheus.BuildFQName(types2.Namespace, Name, "federated_authentications_total"),
"Total number of authentications from a federated source",
nil,
nil,
)
c.passportAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "passport_authentications_total"),
prometheus.BuildFQName(types2.Namespace, Name, "passport_authentications_total"),
"Total number of Microsoft Passport SSO authentications",
nil,
nil,
)
c.passiveRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "passive_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "passive_requests_total"),
"Total number of passive (browser-based) requests",
nil,
nil,
)
c.passwordChangeFailed = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "password_change_failed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "password_change_failed_total"),
"Total number of failed password changes",
nil,
nil,
)
c.passwordChangeSucceeded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "password_change_succeeded_total"),
prometheus.BuildFQName(types2.Namespace, Name, "password_change_succeeded_total"),
"Total number of successful password changes",
nil,
nil,
)
c.tokenRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "token_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "token_requests_total"),
"Total number of token requests",
nil,
nil,
)
c.windowsIntegratedAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "windows_integrated_authentications_total"),
prometheus.BuildFQName(types2.Namespace, Name, "windows_integrated_authentications_total"),
"Total number of Windows integrated authentications (Kerberos/NTLM)",
nil,
nil,
)
c.oAuthAuthZRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_authorization_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_authorization_requests_total"),
"Total number of incoming requests to the OAuth Authorization endpoint",
nil,
nil,
)
c.oAuthClientAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_authentication_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_authentication_success_total"),
"Total number of successful OAuth client Authentications",
nil,
nil,
)
c.oAuthClientAuthenticationsFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_authentication_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_authentication_failure_total"),
"Total number of failed OAuth client Authentications",
nil,
nil,
)
c.oAuthClientCredentialsRequestFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_credentials_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_credentials_failure_total"),
"Total number of failed OAuth Client Credentials Requests",
nil,
nil,
)
c.oAuthClientCredentialsRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_credentials_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_credentials_success_total"),
"Total number of successful RP tokens issued for OAuth Client Credentials Requests",
nil,
nil,
)
c.oAuthClientPrivateKeyJwtAuthenticationFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_privkey_jwt_authentication_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_privkey_jwt_authentication_failure_total"),
"Total number of failed OAuth Client Private Key Jwt Authentications",
nil,
nil,
)
c.oAuthClientPrivateKeyJwtAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_privkey_jwt_authentications_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_privkey_jwt_authentications_success_total"),
"Total number of successful OAuth Client Private Key Jwt Authentications",
nil,
nil,
)
c.oAuthClientSecretBasicAuthenticationFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_secret_basic_authentications_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_secret_basic_authentications_failure_total"),
"Total number of failed OAuth Client Secret Basic Authentications",
nil,
nil,
)
c.oAuthClientSecretBasicAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_secret_basic_authentications_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_secret_basic_authentications_success_total"),
"Total number of successful OAuth Client Secret Basic Authentications",
nil,
nil,
)
c.oAuthClientSecretPostAuthenticationFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_secret_post_authentications_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_secret_post_authentications_failure_total"),
"Total number of failed OAuth Client Secret Post Authentications",
nil,
nil,
)
c.oAuthClientSecretPostAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_secret_post_authentications_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_secret_post_authentications_success_total"),
"Total number of successful OAuth Client Secret Post Authentications",
nil,
nil,
)
c.oAuthClientWindowsIntegratedAuthenticationFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_windows_authentications_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_windows_authentications_failure_total"),
"Total number of failed OAuth Client Windows Integrated Authentications",
nil,
nil,
)
c.oAuthClientWindowsIntegratedAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_client_windows_authentications_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_client_windows_authentications_success_total"),
"Total number of successful OAuth Client Windows Integrated Authentications",
nil,
nil,
)
c.oAuthLogonCertificateRequestFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_logon_certificate_requests_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_logon_certificate_requests_failure_total"),
"Total number of failed OAuth Logon Certificate Requests",
nil,
nil,
)
c.oAuthLogonCertificateTokenRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_logon_certificate_token_requests_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_logon_certificate_token_requests_success_total"),
"Total number of successful RP tokens issued for OAuth Logon Certificate Requests",
nil,
nil,
)
c.oAuthPasswordGrantRequestFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_password_grant_requests_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_password_grant_requests_failure_total"),
"Total number of failed OAuth Password Grant Requests",
nil,
nil,
)
c.oAuthPasswordGrantRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_password_grant_requests_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_password_grant_requests_success_total"),
"Total number of successful OAuth Password Grant Requests",
nil,
nil,
)
c.oAuthTokenRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "oauth_token_requests_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "oauth_token_requests_success_total"),
"Total number of successful RP tokens issued over OAuth protocol",
nil,
nil,
)
c.samlPTokenRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "samlp_token_requests_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "samlp_token_requests_success_total"),
"Total number of successful RP tokens issued over SAML-P protocol",
nil,
nil,
)
c.ssoAuthenticationFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sso_authentications_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sso_authentications_failure_total"),
"Total number of failed SSO authentications",
nil,
nil,
)
c.ssoAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sso_authentications_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sso_authentications_success_total"),
"Total number of successful SSO authentications",
nil,
nil,
)
c.wsFedTokenRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "wsfed_token_requests_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "wsfed_token_requests_success_total"),
"Total number of successful RP tokens issued over WS-Fed protocol",
nil,
nil,
)
c.wsTrustTokenRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "wstrust_token_requests_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "wstrust_token_requests_success_total"),
"Total number of successful RP tokens issued over WS-Trust protocol",
nil,
nil,
)
c.upAuthenticationFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "userpassword_authentications_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "userpassword_authentications_failure_total"),
"Total number of failed AD U/P authentications",
nil,
nil,
)
c.upAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "userpassword_authentications_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "userpassword_authentications_success_total"),
"Total number of successful AD U/P authentications",
nil,
nil,
)
c.externalAuthenticationFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "external_authentications_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "external_authentications_failure_total"),
"Total number of failed authentications from external MFA providers",
nil,
nil,
)
c.externalAuthentications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "external_authentications_success_total"),
prometheus.BuildFQName(types2.Namespace, Name, "external_authentications_success_total"),
"Total number of successful authentications from external MFA providers",
nil,
nil,
)
c.artifactDBFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "db_artifact_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "db_artifact_failure_total"),
"Total number of failures connecting to the artifact database",
nil,
nil,
)
c.avgArtifactDBQueryTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "db_artifact_query_time_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "db_artifact_query_time_seconds_total"),
"Accumulator of time taken for an artifact database query",
nil,
nil,
)
c.configDBFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "db_config_failure_total"),
prometheus.BuildFQName(types2.Namespace, Name, "db_config_failure_total"),
"Total number of failures connecting to the configuration database",
nil,
nil,
)
c.avgConfigDBQueryTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "db_config_query_time_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "db_config_query_time_seconds_total"),
"Accumulator of time taken for a configuration database query",
nil,
nil,
)
c.federationMetadataRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "federation_metadata_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "federation_metadata_requests_total"),
"Total number of Federation Metadata requests",
nil,
nil,
@@ -425,7 +425,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
return nil
}
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
if utils.PDHEnabled() {
return c.collectPDH(ch)
}
@@ -435,7 +435,7 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
return c.collect(ctx, logger, ch)
}
func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
var adfsData []perflibADFS
err := perflib.UnmarshalObject(ctx.PerfObjects["AD FS"], &adfsData, logger)

View File

@@ -3,8 +3,8 @@ package adfs_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/adfs"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/adfs"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -8,10 +8,10 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -134,175 +134,175 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
c.asyncCopyReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "async_copy_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "async_copy_reads_total"),
"(AsyncCopyReadsTotal)",
nil,
nil,
)
c.asyncDataMapsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "async_data_maps_total"),
prometheus.BuildFQName(types2.Namespace, Name, "async_data_maps_total"),
"(AsyncDataMapsTotal)",
nil,
nil,
)
c.asyncFastReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "async_fast_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "async_fast_reads_total"),
"(AsyncFastReadsTotal)",
nil,
nil,
)
c.asyncMDLReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "async_mdl_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "async_mdl_reads_total"),
"(AsyncMDLReadsTotal)",
nil,
nil,
)
c.asyncPinReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "async_pin_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "async_pin_reads_total"),
"(AsyncPinReadsTotal)",
nil,
nil,
)
c.copyReadHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "copy_read_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "copy_read_hits_total"),
"(CopyReadHitsTotal)",
nil,
nil,
)
c.copyReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "copy_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "copy_reads_total"),
"(CopyReadsTotal)",
nil,
nil,
)
c.dataFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "data_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "data_flushes_total"),
"(DataFlushesTotal)",
nil,
nil,
)
c.dataFlushPagesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "data_flush_pages_total"),
prometheus.BuildFQName(types2.Namespace, Name, "data_flush_pages_total"),
"(DataFlushPagesTotal)",
nil,
nil,
)
c.dataMapHitsPercent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "data_map_hits_percent"),
prometheus.BuildFQName(types2.Namespace, Name, "data_map_hits_percent"),
"(DataMapHitsPercent)",
nil,
nil,
)
c.dataMapPinsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "data_map_pins_total"),
prometheus.BuildFQName(types2.Namespace, Name, "data_map_pins_total"),
"(DataMapPinsTotal)",
nil,
nil,
)
c.dataMapsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "data_maps_total"),
prometheus.BuildFQName(types2.Namespace, Name, "data_maps_total"),
"(DataMapsTotal)",
nil,
nil,
)
c.dirtyPages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dirty_pages"),
prometheus.BuildFQName(types2.Namespace, Name, "dirty_pages"),
"(DirtyPages)",
nil,
nil,
)
c.dirtyPageThreshold = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dirty_page_threshold"),
prometheus.BuildFQName(types2.Namespace, Name, "dirty_page_threshold"),
"(DirtyPageThreshold)",
nil,
nil,
)
c.fastReadNotPossiblesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "fast_read_not_possibles_total"),
prometheus.BuildFQName(types2.Namespace, Name, "fast_read_not_possibles_total"),
"(FastReadNotPossiblesTotal)",
nil,
nil,
)
c.fastReadResourceMissesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "fast_read_resource_misses_total"),
prometheus.BuildFQName(types2.Namespace, Name, "fast_read_resource_misses_total"),
"(FastReadResourceMissesTotal)",
nil,
nil,
)
c.fastReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "fast_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "fast_reads_total"),
"(FastReadsTotal)",
nil,
nil,
)
c.lazyWriteFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "lazy_write_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "lazy_write_flushes_total"),
"(LazyWriteFlushesTotal)",
nil,
nil,
)
c.lazyWritePagesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "lazy_write_pages_total"),
prometheus.BuildFQName(types2.Namespace, Name, "lazy_write_pages_total"),
"(LazyWritePagesTotal)",
nil,
nil,
)
c.mdlReadHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mdl_read_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "mdl_read_hits_total"),
"(MDLReadHitsTotal)",
nil,
nil,
)
c.mdlReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mdl_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "mdl_reads_total"),
"(MDLReadsTotal)",
nil,
nil,
)
c.pinReadHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pin_read_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "pin_read_hits_total"),
"(PinReadHitsTotal)",
nil,
nil,
)
c.pinReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pin_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "pin_reads_total"),
"(PinReadsTotal)",
nil,
nil,
)
c.readAheadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_aheads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_aheads_total"),
"(ReadAheadsTotal)",
nil,
nil,
)
c.syncCopyReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sync_copy_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sync_copy_reads_total"),
"(SyncCopyReadsTotal)",
nil,
nil,
)
c.syncDataMapsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sync_data_maps_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sync_data_maps_total"),
"(SyncDataMapsTotal)",
nil,
nil,
)
c.syncFastReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sync_fast_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sync_fast_reads_total"),
"(SyncFastReadsTotal)",
nil,
nil,
)
c.syncMDLReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sync_mdl_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sync_mdl_reads_total"),
"(SyncMDLReadsTotal)",
nil,
nil,
)
c.syncPinReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sync_pin_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sync_pin_reads_total"),
"(SyncPinReadsTotal)",
nil,
nil,
@@ -312,7 +312,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
// Collect implements the Collector interface.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
if utils.PDHEnabled() {
return c.collectPDH(ch)
}
@@ -329,7 +329,7 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
return nil
}
func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
var dst []perflibCache // Single-instance class, array is required but will have single entry.
if err := perflib.UnmarshalObject(ctx.PerfObjects["Cache"], &dst, logger); err != nil {

View File

@@ -3,8 +3,8 @@ package cache_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/cache"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/cache"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -10,8 +10,8 @@ import (
"github.com/Microsoft/hcsshim"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -88,109 +88,109 @@ func (c *Collector) Close(_ *slog.Logger) error {
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
c.containerAvailable = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "available"),
prometheus.BuildFQName(types2.Namespace, Name, "available"),
"Available",
[]string{"container_id"},
nil,
)
c.containersCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "count"),
prometheus.BuildFQName(types2.Namespace, Name, "count"),
"Number of containers",
nil,
nil,
)
c.usageCommitBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_usage_commit_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "memory_usage_commit_bytes"),
"Memory Usage Commit Bytes",
[]string{"container_id"},
nil,
)
c.usageCommitPeakBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_usage_commit_peak_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "memory_usage_commit_peak_bytes"),
"Memory Usage Commit Peak Bytes",
[]string{"container_id"},
nil,
)
c.usagePrivateWorkingSetBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_usage_private_working_set_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "memory_usage_private_working_set_bytes"),
"Memory Usage Private Working Set Bytes",
[]string{"container_id"},
nil,
)
c.runtimeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "cpu_usage_seconds_total"),
"Total Run time in Seconds",
[]string{"container_id"},
nil,
)
c.runtimeUser = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_usermode"),
prometheus.BuildFQName(types2.Namespace, Name, "cpu_usage_seconds_usermode"),
"Run Time in User mode in Seconds",
[]string{"container_id"},
nil,
)
c.runtimeKernel = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_kernelmode"),
prometheus.BuildFQName(types2.Namespace, Name, "cpu_usage_seconds_kernelmode"),
"Run time in Kernel mode in Seconds",
[]string{"container_id"},
nil,
)
c.bytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_receive_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "network_receive_bytes_total"),
"Bytes Received on Interface",
[]string{"container_id", "interface"},
nil,
)
c.bytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_transmit_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "network_transmit_bytes_total"),
"Bytes Sent on Interface",
[]string{"container_id", "interface"},
nil,
)
c.packetsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_receive_packets_total"),
prometheus.BuildFQName(types2.Namespace, Name, "network_receive_packets_total"),
"Packets Received on Interface",
[]string{"container_id", "interface"},
nil,
)
c.packetsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_transmit_packets_total"),
prometheus.BuildFQName(types2.Namespace, Name, "network_transmit_packets_total"),
"Packets Sent on Interface",
[]string{"container_id", "interface"},
nil,
)
c.droppedPacketsIncoming = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_receive_packets_dropped_total"),
prometheus.BuildFQName(types2.Namespace, Name, "network_receive_packets_dropped_total"),
"Dropped Incoming Packets on Interface",
[]string{"container_id", "interface"},
nil,
)
c.droppedPacketsOutgoing = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_transmit_packets_dropped_total"),
prometheus.BuildFQName(types2.Namespace, Name, "network_transmit_packets_dropped_total"),
"Dropped Outgoing Packets on Interface",
[]string{"container_id", "interface"},
nil,
)
c.readCountNormalized = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_read_count_normalized_total"),
prometheus.BuildFQName(types2.Namespace, Name, "storage_read_count_normalized_total"),
"Read Count Normalized",
[]string{"container_id"},
nil,
)
c.readSizeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_read_size_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "storage_read_size_bytes_total"),
"Read Size Bytes",
[]string{"container_id"},
nil,
)
c.writeCountNormalized = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_write_count_normalized_total"),
prometheus.BuildFQName(types2.Namespace, Name, "storage_write_count_normalized_total"),
"Write Count Normalized",
[]string{"container_id"},
nil,
)
c.writeSizeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_write_size_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "storage_write_size_bytes_total"),
"Write Size Bytes",
[]string{"container_id"},
nil,
@@ -201,7 +201,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(logger, ch); err != nil {
logger.Error("failed collecting collector metrics",

View File

@@ -3,8 +3,8 @@ package container_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/container"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/container"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -8,10 +8,10 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -120,110 +120,110 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
c.logicalProcessors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logical_processor"),
prometheus.BuildFQName(types2.Namespace, Name, "logical_processor"),
"Total number of logical processors",
nil,
nil,
)
c.cStateSecondsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cstate_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "cstate_seconds_total"),
"Time spent in low-power idle state",
[]string{"core", "state"},
nil,
)
c.timeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "time_total"),
prometheus.BuildFQName(types2.Namespace, Name, "time_total"),
"Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)",
[]string{"core", "mode"},
nil,
)
c.interruptsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "interrupts_total"),
prometheus.BuildFQName(types2.Namespace, Name, "interrupts_total"),
"Total number of received and serviced hardware interrupts",
[]string{"core"},
nil,
)
c.dpcsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dpcs_total"),
prometheus.BuildFQName(types2.Namespace, Name, "dpcs_total"),
"Total number of received and serviced deferred procedure calls (DPCs)",
[]string{"core"},
nil,
)
c.cStateSecondsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cstate_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "cstate_seconds_total"),
"Time spent in low-power idle state",
[]string{"core", "state"},
nil,
)
c.timeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "time_total"),
prometheus.BuildFQName(types2.Namespace, Name, "time_total"),
"Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)",
[]string{"core", "mode"},
nil,
)
c.interruptsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "interrupts_total"),
prometheus.BuildFQName(types2.Namespace, Name, "interrupts_total"),
"Total number of received and serviced hardware interrupts",
[]string{"core"},
nil,
)
c.dpcsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dpcs_total"),
prometheus.BuildFQName(types2.Namespace, Name, "dpcs_total"),
"Total number of received and serviced deferred procedure calls (DPCs)",
[]string{"core"},
nil,
)
c.clockInterruptsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "clock_interrupts_total"),
prometheus.BuildFQName(types2.Namespace, Name, "clock_interrupts_total"),
"Total number of received and serviced clock tick interrupts",
[]string{"core"},
nil,
)
c.idleBreakEventsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "idle_break_events_total"),
prometheus.BuildFQName(types2.Namespace, Name, "idle_break_events_total"),
"Total number of time processor was woken from idle",
[]string{"core"},
nil,
)
c.parkingStatus = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "parking_status"),
prometheus.BuildFQName(types2.Namespace, Name, "parking_status"),
"Parking Status represents whether a processor is parked or not",
[]string{"core"},
nil,
)
c.processorFrequencyMHz = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "core_frequency_mhz"),
prometheus.BuildFQName(types2.Namespace, Name, "core_frequency_mhz"),
"Core frequency in megahertz",
[]string{"core"},
nil,
)
c.processorPerformance = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processor_performance_total"),
prometheus.BuildFQName(types2.Namespace, Name, "processor_performance_total"),
"Processor Performance is the average performance of the processor while it is executing instructions, as a percentage of the nominal performance of the processor. On some processors, Processor Performance may exceed 100%",
[]string{"core"},
nil,
)
c.processorMPerf = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processor_mperf_total"),
prometheus.BuildFQName(types2.Namespace, Name, "processor_mperf_total"),
"Processor MPerf is the number of TSC ticks incremented while executing instructions",
[]string{"core"},
nil,
)
c.processorRTC = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processor_rtc_total"),
prometheus.BuildFQName(types2.Namespace, Name, "processor_rtc_total"),
"Processor RTC represents the number of RTC ticks made since the system booted. It should consistently be 64e6, and can be used to properly derive Processor Utility Rate",
[]string{"core"},
nil,
)
c.processorUtility = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processor_utility_total"),
prometheus.BuildFQName(types2.Namespace, Name, "processor_utility_total"),
"Processor Utility represents is the amount of time the core spends executing instructions",
[]string{"core"},
nil,
)
c.processorPrivilegedUtility = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processor_privileged_utility_total"),
prometheus.BuildFQName(types2.Namespace, Name, "processor_privileged_utility_total"),
"Processor Privileged Utility represents is the amount of time the core has spent executing instructions inside the kernel",
[]string{"core"},
nil,
@@ -235,7 +235,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
return nil
}
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
if utils.PDHEnabled() {
return c.collectPDH(ch)
}
@@ -245,7 +245,7 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
return c.collectFull(ctx, logger, ch)
}
func (c *Collector) collectFull(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectFull(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
data := make([]perflibProcessorInformation, 0)
err := perflib.UnmarshalObject(ctx.PerfObjects["Processor Information"], &data, logger)

View File

@@ -0,0 +1,14 @@
//go:build windows
package cpu_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/internal/collector/cpu"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {
testutils.FuncBenchmarkCollector(b, cpu.Name, cpu.NewWithFlags)
}

View File

@@ -9,7 +9,7 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -70,7 +70,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.cpuInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, "", Name),
prometheus.BuildFQName(types2.Namespace, "", Name),
"Labelled CPU information as provided by Win32_Processor",
[]string{
"architecture",
@@ -82,7 +82,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
nil,
)
c.cpuThreadCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "thread"),
prometheus.BuildFQName(types2.Namespace, Name, "thread"),
"Number of threads per CPU",
[]string{
"device_id",
@@ -90,7 +90,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
nil,
)
c.cpuCoreCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "core"),
prometheus.BuildFQName(types2.Namespace, Name, "core"),
"Number of cores per CPU",
[]string{
"device_id",
@@ -98,7 +98,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
nil,
)
c.cpuEnabledCoreCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "enabled_core"),
prometheus.BuildFQName(types2.Namespace, Name, "enabled_core"),
"Number of enabled cores per CPU",
[]string{
"device_id",
@@ -106,7 +106,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
nil,
)
c.cpuLogicalProcessorsCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logical_processor"),
prometheus.BuildFQName(types2.Namespace, Name, "logical_processor"),
"Number of logical processors per CPU",
[]string{
"device_id",
@@ -114,7 +114,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
nil,
)
c.cpuL2CacheSize = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "l2_cache_size"),
prometheus.BuildFQName(types2.Namespace, Name, "l2_cache_size"),
"Size of L2 cache per CPU",
[]string{
"device_id",
@@ -122,7 +122,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
nil,
)
c.cpuL3CacheSize = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "l3_cache_size"),
prometheus.BuildFQName(types2.Namespace, Name, "l3_cache_size"),
"Size of L3 cache per CPU",
[]string{
"device_id",
@@ -149,7 +149,7 @@ type win32Processor struct {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting cpu_info metrics",

View File

@@ -3,8 +3,8 @@ package cpu_info_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/cpu_info"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/cpu_info"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -6,8 +6,8 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/headers/sysinfoapi"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/headers/sysinfoapi"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -68,19 +68,19 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
"Hostname has been moved to os collector.")
c.logicalProcessors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logical_processors"),
prometheus.BuildFQName(types2.Namespace, Name, "logical_processors"),
"Deprecated: Use windows_cpu_logical_processor instead",
nil,
nil,
)
c.physicalMemoryBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "physical_memory_bytes"),
"Deprecated: Use windows_physical_memory_total_bytes instead",
nil,
nil,
)
c.hostname = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "hostname"),
prometheus.BuildFQName(types2.Namespace, Name, "hostname"),
"Deprecated: Use windows_os_hostname instead",
[]string{
"hostname",
@@ -95,7 +95,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {

View File

@@ -3,8 +3,8 @@ package cs_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/cs"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/cs"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -10,10 +10,10 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -87,7 +87,7 @@ type Collector struct {
dfsrChildCollectors []dfsrCollectorFunc
}
type dfsrCollectorFunc func(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error
type dfsrCollectorFunc func(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error
// Map Perflib sources to DFSR Collector names
// e.g, volume -> DFS Replication Service Volumes.
@@ -250,63 +250,63 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// connection
c.connectionBandwidthSavingsUsingDFSReplicationTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_bandwidth_savings_using_dfs_replication_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_bandwidth_savings_using_dfs_replication_bytes_total"),
"Total bytes of bandwidth saved using DFS Replication for this connection",
[]string{"name"},
nil,
)
c.connectionBytesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_bytes_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_bytes_received_total"),
"Total bytes received for connection",
[]string{"name"},
nil,
)
c.connectionCompressedSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_compressed_size_of_files_received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_compressed_size_of_files_received_bytes_total"),
"Total compressed size of files received on the connection, in bytes",
[]string{"name"},
nil,
)
c.connectionFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_received_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_received_files_total"),
"Total number of files received for connection",
[]string{"name"},
nil,
)
c.connectionRDCBytesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_rdc_received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_rdc_received_bytes_total"),
"Total bytes received on the connection while replicating files using Remote Differential Compression",
[]string{"name"},
nil,
)
c.connectionRDCCompressedSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_rdc_compressed_size_of_received_files_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_rdc_compressed_size_of_received_files_bytes_total"),
"Total uncompressed size of files received with Remote Differential Compression for connection",
[]string{"name"},
nil,
)
c.connectionRDCNumberOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_rdc_received_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_rdc_received_files_total"),
"Total number of files received using remote differential compression",
[]string{"name"},
nil,
)
c.connectionRDCSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_rdc_size_of_received_files_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_rdc_size_of_received_files_bytes_total"),
"Total size of received Remote Differential Compression files, in bytes.",
[]string{"name"},
nil,
)
c.connectionSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_files_received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_files_received_bytes_total"),
"Total size of files received, in bytes",
[]string{"name"},
nil,
@@ -314,189 +314,189 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// folder
c.folderBandwidthSavingsUsingDFSReplicationTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_bandwidth_savings_using_dfs_replication_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_bandwidth_savings_using_dfs_replication_bytes_total"),
"Total bytes of bandwidth saved using DFS Replication for this folder",
[]string{"name"},
nil,
)
c.folderCompressedSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_compressed_size_of_received_files_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_compressed_size_of_received_files_bytes_total"),
"Total compressed size of files received on the folder, in bytes",
[]string{"name"},
nil,
)
c.folderConflictBytesCleanedUpTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_cleaned_up_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_conflict_cleaned_up_bytes_total"),
"Total size of conflict loser files and folders deleted from the Conflict and Deleted folder, in bytes",
[]string{"name"},
nil,
)
c.folderConflictBytesGeneratedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_generated_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_conflict_generated_bytes_total"),
"Total size of conflict loser files and folders moved to the Conflict and Deleted folder, in bytes",
[]string{"name"},
nil,
)
c.folderConflictFilesCleanedUpTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_cleaned_up_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_conflict_cleaned_up_files_total"),
"Number of conflict loser files deleted from the Conflict and Deleted folder",
[]string{"name"},
nil,
)
c.folderConflictFilesGeneratedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_generated_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_conflict_generated_files_total"),
"Number of files and folders moved to the Conflict and Deleted folder",
[]string{"name"},
nil,
)
c.folderConflictFolderCleanupsCompletedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_folder_cleanups_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_conflict_folder_cleanups_total"),
"Number of deletions of conflict loser files and folders in the Conflict and Deleted",
[]string{"name"},
nil,
)
c.folderConflictSpaceInUse = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_space_in_use_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_conflict_space_in_use_bytes"),
"Total size of the conflict loser files and folders currently in the Conflict and Deleted folder",
[]string{"name"},
nil,
)
c.folderDeletedSpaceInUse = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_deleted_space_in_use_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_deleted_space_in_use_bytes"),
"Total size (in bytes) of the deleted files and folders currently in the Conflict and Deleted folder",
[]string{"name"},
nil,
)
c.folderDeletedBytesCleanedUpTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_deleted_cleaned_up_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_deleted_cleaned_up_bytes_total"),
"Total size (in bytes) of replicating deleted files and folders that were cleaned up from the Conflict and Deleted folder",
[]string{"name"},
nil,
)
c.folderDeletedBytesGeneratedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_deleted_generated_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_deleted_generated_bytes_total"),
"Total size (in bytes) of replicated deleted files and folders that were moved to the Conflict and Deleted folder after they were deleted from a replicated folder on a sending member",
[]string{"name"},
nil,
)
c.folderDeletedFilesCleanedUpTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_deleted_cleaned_up_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_deleted_cleaned_up_files_total"),
"Number of files and folders that were cleaned up from the Conflict and Deleted folder",
[]string{"name"},
nil,
)
c.folderDeletedFilesGeneratedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_deleted_generated_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_deleted_generated_files_total"),
"Number of deleted files and folders that were moved to the Conflict and Deleted folder",
[]string{"name"},
nil,
)
c.folderFileInstallsRetriedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_file_installs_retried_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_file_installs_retried_total"),
"Total number of file installs that are being retried due to sharing violations or other errors encountered when installing the files",
[]string{"name"},
nil,
)
c.folderFileInstallsSucceededTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_file_installs_succeeded_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_file_installs_succeeded_total"),
"Total number of files that were successfully received from sending members and installed locally on this server",
[]string{"name"},
nil,
)
c.folderFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_received_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_received_files_total"),
"Total number of files received",
[]string{"name"},
nil,
)
c.folderRDCBytesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_rdc_received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_rdc_received_bytes_total"),
"Total number of bytes received in replicating files using Remote Differential Compression",
[]string{"name"},
nil,
)
c.folderRDCCompressedSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_rdc_compressed_size_of_received_files_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_rdc_compressed_size_of_received_files_bytes_total"),
"Total compressed size (in bytes) of the files received with Remote Differential Compression",
[]string{"name"},
nil,
)
c.folderRDCNumberOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_rdc_received_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_rdc_received_files_total"),
"Total number of files received with Remote Differential Compression",
[]string{"name"},
nil,
)
c.folderRDCSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_rdc_files_received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_rdc_files_received_bytes_total"),
"Total uncompressed size (in bytes) of the files received with Remote Differential Compression",
[]string{"name"},
nil,
)
c.folderSizeOfFilesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_files_received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_files_received_bytes_total"),
"Total uncompressed size (in bytes) of the files received",
[]string{"name"},
nil,
)
c.folderStagingSpaceInUse = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_staging_space_in_use_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_staging_space_in_use_bytes"),
"Total size of files and folders currently in the staging folder.",
[]string{"name"},
nil,
)
c.folderStagingBytesCleanedUpTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_staging_cleaned_up_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_staging_cleaned_up_bytes_total"),
"Total size (in bytes) of the files and folders that have been cleaned up from the staging folder",
[]string{"name"},
nil,
)
c.folderStagingBytesGeneratedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_staging_generated_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_staging_generated_bytes_total"),
"Total size (in bytes) of replicated files and folders in the staging folder created by the DFS Replication service since last restart",
[]string{"name"},
nil,
)
c.folderStagingFilesCleanedUpTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_staging_cleaned_up_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_staging_cleaned_up_files_total"),
"Total number of files and folders that have been cleaned up from the staging folder",
[]string{"name"},
nil,
)
c.folderStagingFilesGeneratedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_staging_generated_files_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_staging_generated_files_total"),
"Total number of times replicated files and folders have been staged by the DFS Replication service",
[]string{"name"},
nil,
)
c.folderUpdatesDroppedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "folder_dropped_updates_total"),
prometheus.BuildFQName(types2.Namespace, Name, "folder_dropped_updates_total"),
"Total number of redundant file replication update records that have been ignored by the DFS Replication service because they did not change the replicated file or folder",
[]string{"name"},
nil,
@@ -504,35 +504,35 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// volume
c.volumeDatabaseCommitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "volume_database_commits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "volume_database_commits_total"),
"Total number of DFSR volume database commits",
[]string{"name"},
nil,
)
c.volumeDatabaseLookupsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "volume_database_lookups_total"),
prometheus.BuildFQName(types2.Namespace, Name, "volume_database_lookups_total"),
"Total number of DFSR volume database lookups",
[]string{"name"},
nil,
)
c.volumeUSNJournalUnreadPercentage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "volume_usn_journal_unread_percentage"),
prometheus.BuildFQName(types2.Namespace, Name, "volume_usn_journal_unread_percentage"),
"Percentage of DFSR volume USN journal records that are unread",
[]string{"name"},
nil,
)
c.volumeUSNJournalRecordsAcceptedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "volume_usn_journal_accepted_records_total"),
prometheus.BuildFQName(types2.Namespace, Name, "volume_usn_journal_accepted_records_total"),
"Total number of USN journal records accepted",
[]string{"name"},
nil,
)
c.volumeUSNJournalRecordsReadTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "volume_usn_journal_read_records_total"),
prometheus.BuildFQName(types2.Namespace, Name, "volume_usn_journal_read_records_total"),
"Total number of DFSR volume USN journal records read",
[]string{"name"},
nil,
@@ -566,7 +566,7 @@ func (c *Collector) getDFSRChildCollectors(enabledCollectors []string) []dfsrCol
// Collect implements the Collector interface.
// Sends metric values for each metric to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
if utils.PDHEnabled() {
return c.collectPDH(ch)
}
@@ -582,7 +582,7 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
return nil
}
func (c *Collector) collectConnection(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectConnection(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
var dst []PerflibDFSRConnection
if err := perflib.UnmarshalObject(ctx.PerfObjects["DFS Replication Connections"], &dst, logger); err != nil {
@@ -657,7 +657,7 @@ func (c *Collector) collectConnection(ctx *types.ScrapeContext, logger *slog.Log
return nil
}
func (c *Collector) collectFolder(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectFolder(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
var dst []perflibDFSRFolder
if err := perflib.UnmarshalObject(ctx.PerfObjects["DFS Replicated Folders"], &dst, logger); err != nil {
@@ -858,7 +858,7 @@ func (c *Collector) collectFolder(ctx *types.ScrapeContext, logger *slog.Logger,
return nil
}
func (c *Collector) collectVolume(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectVolume(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
var dst []perflibDFSRVolume
if err := perflib.UnmarshalObject(ctx.PerfObjects["DFS Replication Service Volumes"], &dst, logger); err != nil {

View File

@@ -3,8 +3,8 @@ package dfsr_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/dfsr"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/dfsr"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -6,8 +6,8 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -79,151 +79,151 @@ func (c *Collector) Close(_ *slog.Logger) error {
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
c.packetsReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_received_total"),
"Total number of packets received by the DHCP server (PacketsReceivedTotal)",
nil,
nil,
)
c.duplicatesDroppedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "duplicates_dropped_total"),
prometheus.BuildFQName(types2.Namespace, Name, "duplicates_dropped_total"),
"Total number of duplicate packets received by the DHCP server (DuplicatesDroppedTotal)",
nil,
nil,
)
c.packetsExpiredTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_expired_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_expired_total"),
"Total number of packets expired in the DHCP server message queue (PacketsExpiredTotal)",
nil,
nil,
)
c.activeQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "active_queue_length"),
prometheus.BuildFQName(types2.Namespace, Name, "active_queue_length"),
"Number of packets in the processing queue of the DHCP server (ActiveQueueLength)",
nil,
nil,
)
c.conflictCheckQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "conflict_check_queue_length"),
prometheus.BuildFQName(types2.Namespace, Name, "conflict_check_queue_length"),
"Number of packets in the DHCP server queue waiting on conflict detection (ping). (ConflictCheckQueueLength)",
nil,
nil,
)
c.discoversTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "discovers_total"),
prometheus.BuildFQName(types2.Namespace, Name, "discovers_total"),
"Total DHCP Discovers received by the DHCP server (DiscoversTotal)",
nil,
nil,
)
c.offersTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "offers_total"),
prometheus.BuildFQName(types2.Namespace, Name, "offers_total"),
"Total DHCP Offers sent by the DHCP server (OffersTotal)",
nil,
nil,
)
c.requestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "requests_total"),
"Total DHCP Requests received by the DHCP server (RequestsTotal)",
nil,
nil,
)
c.informsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "informs_total"),
prometheus.BuildFQName(types2.Namespace, Name, "informs_total"),
"Total DHCP Informs received by the DHCP server (InformsTotal)",
nil,
nil,
)
c.acksTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "acks_total"),
prometheus.BuildFQName(types2.Namespace, Name, "acks_total"),
"Total DHCP Acks sent by the DHCP server (AcksTotal)",
nil,
nil,
)
c.nACKsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "nacks_total"),
prometheus.BuildFQName(types2.Namespace, Name, "nacks_total"),
"Total DHCP Nacks sent by the DHCP server (NacksTotal)",
nil,
nil,
)
c.declinesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "declines_total"),
prometheus.BuildFQName(types2.Namespace, Name, "declines_total"),
"Total DHCP Declines received by the DHCP server (DeclinesTotal)",
nil,
nil,
)
c.releasesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "releases_total"),
prometheus.BuildFQName(types2.Namespace, Name, "releases_total"),
"Total DHCP Releases received by the DHCP server (ReleasesTotal)",
nil,
nil,
)
c.offerQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "offer_queue_length"),
prometheus.BuildFQName(types2.Namespace, Name, "offer_queue_length"),
"Number of packets in the offer queue of the DHCP server (OfferQueueLength)",
nil,
nil,
)
c.deniedDueToMatch = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_match_total"),
prometheus.BuildFQName(types2.Namespace, Name, "denied_due_to_match_total"),
"Total number of DHCP requests denied, based on matches from the Deny list (DeniedDueToMatch)",
nil,
nil,
)
c.deniedDueToNonMatch = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_nonmatch_total"),
prometheus.BuildFQName(types2.Namespace, Name, "denied_due_to_nonmatch_total"),
"Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)",
nil,
nil,
)
c.failoverBndupdSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_bndupd_sent_total"),
"Number of DHCP fail over Binding Update messages sent (FailoverBndupdSentTotal)",
nil,
nil,
)
c.failoverBndupdReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_bndupd_received_total"),
"Number of DHCP fail over Binding Update messages received (FailoverBndupdReceivedTotal)",
nil,
nil,
)
c.failoverBndackSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_bndack_sent_total"),
"Number of DHCP fail over Binding Ack messages sent (FailoverBndackSentTotal)",
nil,
nil,
)
c.failoverBndackReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_bndack_received_total"),
"Number of DHCP fail over Binding Ack messages received (FailoverBndackReceivedTotal)",
nil,
nil,
)
c.failoverBndupdPendingOutboundQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_pending_in_outbound_queue"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_bndupd_pending_in_outbound_queue"),
"Number of pending outbound DHCP fail over Binding Update messages (FailoverBndupdPendingOutboundQueue)",
nil,
nil,
)
c.failoverTransitionsCommunicationInterruptedState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_communicationinterrupted_state_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_transitions_communicationinterrupted_state_total"),
"Total number of transitions into COMMUNICATION INTERRUPTED state (FailoverTransitionsCommunicationinterruptedState)",
nil,
nil,
)
c.failoverTransitionsPartnerDownState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_partnerdown_state_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_transitions_partnerdown_state_total"),
"Total number of transitions into PARTNER DOWN state (FailoverTransitionsPartnerdownState)",
nil,
nil,
)
c.failoverTransitionsRecoverState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_recover_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_transitions_recover_total"),
"Total number of transitions into RECOVER state (FailoverTransitionsRecoverState)",
nil,
nil,
)
c.failoverBndupdDropped = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_dropped_total"),
prometheus.BuildFQName(types2.Namespace, Name, "failover_bndupd_dropped_total"),
"Total number of DHCP fail over Binding Updates dropped (FailoverBndupdDropped)",
nil,
nil,
@@ -263,7 +263,7 @@ type dhcpPerf struct {
FailoverBndupdDropped float64 `perflib:"Failover: BndUpd Dropped."`
}
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var dhcpPerfs []dhcpPerf

View File

@@ -3,8 +3,8 @@ package dhcp_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/dhcp"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/dhcp"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -8,7 +8,7 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -69,7 +69,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.diskInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"),
prometheus.BuildFQName(types2.Namespace, Name, "info"),
"General drive information",
[]string{
"device_id",
@@ -80,25 +80,25 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
nil,
)
c.status = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "status"),
prometheus.BuildFQName(types2.Namespace, Name, "status"),
"Status of the drive",
[]string{"name", "status"},
nil,
)
c.size = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "size"),
prometheus.BuildFQName(types2.Namespace, Name, "size"),
"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,
)
c.partitions = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "partitions"),
prometheus.BuildFQName(types2.Namespace, Name, "partitions"),
"Number of partitions",
[]string{"name"},
nil,
)
c.availability = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "availability"),
prometheus.BuildFQName(types2.Namespace, Name, "availability"),
"Availability Status",
[]string{"name", "availability"},
nil,
@@ -160,7 +160,7 @@ var (
)
// Collect sends the metric values for each metric to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting disk_drive_info metrics",

View File

@@ -3,8 +3,8 @@ package diskdrive_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/diskdrive"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/diskdrive"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -7,7 +7,7 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -83,133 +83,133 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.zoneTransferRequestsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "zone_transfer_requests_received_total"),
"Number of zone transfer requests (AXFR/IXFR) received by the master DNS server",
[]string{"qtype"},
nil,
)
c.zoneTransferRequestsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "zone_transfer_requests_sent_total"),
"Number of zone transfer requests (AXFR/IXFR) sent by the secondary DNS server",
[]string{"qtype"},
nil,
)
c.zoneTransferResponsesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_response_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "zone_transfer_response_received_total"),
"Number of zone transfer responses (AXFR/IXFR) received by the secondary DNS server",
[]string{"qtype"},
nil,
)
c.zoneTransferSuccessReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_success_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "zone_transfer_success_received_total"),
"Number of successful zone transfers (AXFR/IXFR) received by the secondary DNS server",
[]string{"qtype", "protocol"},
nil,
)
c.zoneTransferSuccessSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_success_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "zone_transfer_success_sent_total"),
"Number of successful zone transfers (AXFR/IXFR) of the master DNS server",
[]string{"qtype"},
nil,
)
c.zoneTransferFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_failures_total"),
prometheus.BuildFQName(types2.Namespace, Name, "zone_transfer_failures_total"),
"Number of failed zone transfers of the master DNS server",
nil,
nil,
)
c.memoryUsedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_used_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "memory_used_bytes"),
"Current memory used by DNS server",
[]string{"area"},
nil,
)
c.dynamicUpdatesQueued = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_queued"),
prometheus.BuildFQName(types2.Namespace, Name, "dynamic_updates_queued"),
"Number of dynamic updates queued by the DNS server",
nil,
nil,
)
c.dynamicUpdatesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "dynamic_updates_received_total"),
"Number of secure update requests received by the DNS server",
[]string{"operation"},
nil,
)
c.dynamicUpdatesFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dynamic_updates_failures_total"),
prometheus.BuildFQName(types2.Namespace, Name, "dynamic_updates_failures_total"),
"Number of dynamic updates which timed out or were rejected by the DNS server",
[]string{"reason"},
nil,
)
c.notifyReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "notify_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "notify_received_total"),
"Number of notifies received by the secondary DNS server",
nil,
nil,
)
c.notifySent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "notify_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "notify_sent_total"),
"Number of notifies sent by the master DNS server",
nil,
nil,
)
c.secureUpdateFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "secure_update_failures_total"),
prometheus.BuildFQName(types2.Namespace, Name, "secure_update_failures_total"),
"Number of secure updates that failed on the DNS server",
nil,
nil,
)
c.secureUpdateReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "secure_update_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "secure_update_received_total"),
"Number of secure update requests received by the DNS server",
nil,
nil,
)
c.queries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "queries_total"),
"Number of queries received by DNS server",
[]string{"protocol"},
nil,
)
c.responses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "responses_total"),
prometheus.BuildFQName(types2.Namespace, Name, "responses_total"),
"Number of responses sent by DNS server",
[]string{"protocol"},
nil,
)
c.recursiveQueries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recursive_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "recursive_queries_total"),
"Number of recursive queries received by DNS server",
nil,
nil,
)
c.recursiveQueryFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recursive_query_failures_total"),
prometheus.BuildFQName(types2.Namespace, Name, "recursive_query_failures_total"),
"Number of recursive query failures",
nil,
nil,
)
c.recursiveQuerySendTimeouts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recursive_query_send_timeouts_total"),
prometheus.BuildFQName(types2.Namespace, Name, "recursive_query_send_timeouts_total"),
"Number of recursive query sending timeouts",
nil,
nil,
)
c.winsQueries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "wins_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "wins_queries_total"),
"Number of WINS lookup requests received by the server",
[]string{"direction"},
nil,
)
c.winsResponses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "wins_responses_total"),
prometheus.BuildFQName(types2.Namespace, Name, "wins_responses_total"),
"Number of WINS lookup responses sent by the server",
[]string{"direction"},
nil,
)
c.unmatchedResponsesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "unmatched_responses_total"),
prometheus.BuildFQName(types2.Namespace, Name, "unmatched_responses_total"),
"Number of response packets received by the DNS server that do not match any outstanding remote query",
nil,
nil,
@@ -220,7 +220,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting dns metrics",

View File

@@ -3,8 +3,8 @@ package dns_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/dns"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/dns"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -9,8 +9,8 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -181,7 +181,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
// desc creates a new prometheus description
desc := func(metricName string, description string, labels ...string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, "exchange", metricName),
prometheus.BuildFQName(types2.Namespace, "exchange", metricName),
description,
labels,
nil,
@@ -231,9 +231,9 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
// Collect collects exchange metrics and sends them to prometheus.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
collectorFuncs := map[string]func(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error{
collectorFuncs := map[string]func(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error{
"ADAccessProcesses": c.collectADAccessProcesses,
"TransportQueues": c.collectTransportQueues,
"HttpProxy": c.collectHTTPProxy,
@@ -270,7 +270,7 @@ type perflibADAccessProcesses struct {
LongRunningLDAPOperationsPerMin float64 `perflib:"Long Running LDAP Operations/min"`
}
func (c *Collector) collectADAccessProcesses(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectADAccessProcesses(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibADAccessProcesses
@@ -333,7 +333,7 @@ type perflibAvailabilityService struct {
RequestsSec float64 `perflib:"Availability Requests (sec)"`
}
func (c *Collector) collectAvailabilityService(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectAvailabilityService(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibAvailabilityService
@@ -365,7 +365,7 @@ type perflibHTTPProxy struct {
ProxyRequestsPerSec float64 `perflib:"Proxy Requests/Sec"`
}
func (c *Collector) collectHTTPProxy(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectHTTPProxy(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibHTTPProxy
@@ -423,7 +423,7 @@ type perflibOWA struct {
RequestsPerSec float64 `perflib:"Requests/sec"`
}
func (c *Collector) collectOWA(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectOWA(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibOWA
@@ -455,7 +455,7 @@ type perflibActiveSync struct {
SyncCommandsPerSec float64 `perflib:"Sync Commands/sec"`
}
func (c *Collector) collectActiveSync(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectActiveSync(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibActiveSync
@@ -495,7 +495,7 @@ type perflibRPCClientAccess struct {
UserCount float64 `perflib:"User Count"`
}
func (c *Collector) collectRPC(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectRPC(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibRPCClientAccess
@@ -554,7 +554,7 @@ type perflibTransportQueues struct {
PoisonQueueLength float64 `perflib:"Poison Queue Length"`
}
func (c *Collector) collectTransportQueues(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectTransportQueues(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibTransportQueues
@@ -632,7 +632,7 @@ type perflibWorkloadManagementWorkloads struct {
IsActive float64 `perflib:"Active"`
}
func (c *Collector) collectWorkloadManagementWorkloads(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectWorkloadManagementWorkloads(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibWorkloadManagementWorkloads
@@ -686,7 +686,7 @@ type perflibAutodiscover struct {
RequestsPerSec float64 `perflib:"Requests/sec"`
}
func (c *Collector) collectAutoDiscover(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectAutoDiscover(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibAutodiscover
@@ -711,7 +711,7 @@ type perflibMapiHttpEmsmdb struct {
ActiveUserCount float64 `perflib:"Active User Count"`
}
func (c *Collector) collectMapiHttpEmsmdb(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectMapiHttpEmsmdb(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibMapiHttpEmsmdb

View File

@@ -3,8 +3,8 @@ package exchange_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/exchange"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/exchange"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -12,7 +12,7 @@ import (
"github.com/alecthomas/kingpin/v2"
"github.com/bmatcuk/doublestar/v4"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -91,7 +91,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
)
c.fileMTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mtime_timestamp_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "mtime_timestamp_seconds"),
"File modification time",
[]string{"file"},
nil,
@@ -111,7 +111,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
return c.collectGlob(logger, ch)

View File

@@ -3,8 +3,8 @@ package filetime_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/filetime"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/filetime"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -7,8 +7,8 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -71,55 +71,55 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.quotasCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "count"),
prometheus.BuildFQName(types2.Namespace, Name, "count"),
"Number of Quotas",
nil,
nil,
)
c.peakUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "peak_usage_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "peak_usage_bytes"),
"The highest amount of disk space usage charged to this quota. (PeakUsage)",
[]string{"path", "template"},
nil,
)
c.size = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "size_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "size_bytes"),
"The size of the quota. (Size)",
[]string{"path", "template"},
nil,
)
c.usage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "usage_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "usage_bytes"),
"The current amount of disk space usage charged to this quota. (Usage)",
[]string{"path", "template"},
nil,
)
c.description = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "description"),
prometheus.BuildFQName(types2.Namespace, Name, "description"),
"Description of the quota (Description)",
[]string{"path", "template", "description"},
nil,
)
c.disabled = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "disabled"),
prometheus.BuildFQName(types2.Namespace, Name, "disabled"),
"If 1, the quota is disabled. The default value is 0. (Disabled)",
[]string{"path", "template"},
nil,
)
c.softLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "softlimit"),
prometheus.BuildFQName(types2.Namespace, Name, "softlimit"),
"If 1, the quota is a soft limit. If 0, the quota is a hard limit. The default value is 0. Optional (SoftLimit)",
[]string{"path", "template"},
nil,
)
c.template = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "template"),
prometheus.BuildFQName(types2.Namespace, Name, "template"),
"Quota template name. (Template)",
[]string{"path", "template"},
nil,
)
c.matchesTemplate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "matchestemplate"),
prometheus.BuildFQName(types2.Namespace, Name, "matchestemplate"),
"If 1, the property values of this quota match those values of the template from which it was derived. (MatchesTemplate)",
[]string{"path", "template"},
nil,
@@ -130,7 +130,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting fsrmquota metrics",

View File

@@ -3,8 +3,8 @@ package fsrmquota_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/fsrmquota"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/fsrmquota"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -9,7 +9,7 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -178,13 +178,13 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
buildSubsystemName := func(component string) string { return "hyperv_" + component }
c.healthCritical = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("health"), "critical"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("health"), "critical"),
"This counter represents the number of virtual machines with critical health",
nil,
nil,
)
c.healthOk = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("health"), "ok"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("health"), "ok"),
"This counter represents the number of virtual machines with ok health",
nil,
nil,
@@ -193,19 +193,19 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.physicalPagesAllocated = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vid"), "physical_pages_allocated"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vid"), "physical_pages_allocated"),
"The number of physical pages allocated",
[]string{"vm"},
nil,
)
c.preferredNUMANodeIndex = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vid"), "preferred_numa_node_index"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vid"), "preferred_numa_node_index"),
"The preferred NUMA node index associated with this partition",
[]string{"vm"},
nil,
)
c.remotePhysicalPages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vid"), "remote_physical_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vid"), "remote_physical_pages"),
"The number of physical pages not allocated from the preferred NUMA node",
[]string{"vm"},
nil,
@@ -214,127 +214,127 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.addressSpaces = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "address_spaces"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "address_spaces"),
"The number of address spaces in the virtual TLB of the partition",
nil,
nil,
)
c.attachedDevices = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "attached_devices"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "attached_devices"),
"The number of devices attached to the partition",
nil,
nil,
)
c.depositedPages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "deposited_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "deposited_pages"),
"The number of pages deposited into the partition",
nil,
nil,
)
c.deviceDMAErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "device_dma_errors"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "device_dma_errors"),
"An indicator of illegal DMA requests generated by all devices assigned to the partition",
nil,
nil,
)
c.deviceInterruptErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "device_interrupt_errors"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "device_interrupt_errors"),
"An indicator of illegal interrupt requests generated by all devices assigned to the partition",
nil,
nil,
)
c.deviceInterruptMappings = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "device_interrupt_mappings"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "device_interrupt_mappings"),
"The number of device interrupt mappings used by the partition",
nil,
nil,
)
c.deviceInterruptThrottleEvents = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "device_interrupt_throttle_events"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "device_interrupt_throttle_events"),
"The number of times an interrupt from a device assigned to the partition was temporarily throttled because the device was generating too many interrupts",
nil,
nil,
)
c.gpaPages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "preferred_numa_node_index"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "preferred_numa_node_index"),
"The number of pages present in the GPA space of the partition (zero for root partition)",
nil,
nil,
)
c.gpaSpaceModifications = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "gpa_space_modifications"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "gpa_space_modifications"),
"The rate of modifications to the GPA space of the partition",
nil,
nil,
)
c.ioTLBFlushCost = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "io_tlb_flush_cost"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "io_tlb_flush_cost"),
"The average time (in nanoseconds) spent processing an I/O TLB flush",
nil,
nil,
)
c.ioTLBFlushes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "io_tlb_flush"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "io_tlb_flush"),
"The rate of flushes of I/O TLBs of the partition",
nil,
nil,
)
c.recommendedVirtualTLBSize = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "recommended_virtual_tlb_size"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "recommended_virtual_tlb_size"),
"The recommended number of pages to be deposited for the virtual TLB",
nil,
nil,
)
c.skippedTimerTicks = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "physical_pages_allocated"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "physical_pages_allocated"),
"The number of timer interrupts skipped for the partition",
nil,
nil,
)
c.value1Gdevicepages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "1G_device_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "1G_device_pages"),
"The number of 1G pages present in the device space of the partition",
nil,
nil,
)
c.value1GGPApages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "1G_gpa_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "1G_gpa_pages"),
"The number of 1G pages present in the GPA space of the partition",
nil,
nil,
)
c.value2Mdevicepages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "2M_device_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "2M_device_pages"),
"The number of 2M pages present in the device space of the partition",
nil,
nil,
)
c.value2MGPApages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "2M_gpa_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "2M_gpa_pages"),
"The number of 2M pages present in the GPA space of the partition",
nil,
nil,
)
c.value4Kdevicepages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "4K_device_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "4K_device_pages"),
"The number of 4K pages present in the device space of the partition",
nil,
nil,
)
c.value4KGPApages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "4K_gpa_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "4K_gpa_pages"),
"The number of 4K pages present in the GPA space of the partition",
nil,
nil,
)
c.virtualTLBFlushEntires = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "virtual_tlb_flush_entires"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "virtual_tlb_flush_entires"),
"The rate of flushes of the entire virtual TLB",
nil,
nil,
)
c.virtualTLBPages = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("root_partition"), "virtual_tlb_pages"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("root_partition"), "virtual_tlb_pages"),
"The number of pages used by the virtual TLB of the partition",
nil,
nil,
@@ -343,13 +343,13 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.virtualProcessors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("hypervisor"), "virtual_processors"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("hypervisor"), "virtual_processors"),
"The number of virtual processors present in the system",
nil,
nil,
)
c.logicalProcessors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("hypervisor"), "logical_processors"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("hypervisor"), "logical_processors"),
"The number of logical processors present in the system",
nil,
nil,
@@ -358,19 +358,19 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.hostLPGuestRunTimePercent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_lp"), "guest_run_time_percent"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_lp"), "guest_run_time_percent"),
"The percentage of time spent by the processor in guest code",
[]string{"core"},
nil,
)
c.hostLPHypervisorRunTimePercent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_lp"), "hypervisor_run_time_percent"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_lp"), "hypervisor_run_time_percent"),
"The percentage of time spent by the processor in hypervisor code",
[]string{"core"},
nil,
)
c.hostLPTotalRunTimePercent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_lp"), "total_run_time_percent"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_lp"), "total_run_time_percent"),
"The percentage of time spent by the processor in guest and hypervisor code",
[]string{"core"},
nil,
@@ -379,31 +379,31 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.hostGuestRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_cpu"), "guest_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_cpu"), "guest_run_time"),
"The time spent by the virtual processor in guest code",
[]string{"core"},
nil,
)
c.hostHypervisorRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_cpu"), "hypervisor_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_cpu"), "hypervisor_run_time"),
"The time spent by the virtual processor in hypervisor code",
[]string{"core"},
nil,
)
c.hostRemoteRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_cpu"), "remote_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_cpu"), "remote_run_time"),
"The time spent by the virtual processor running on a remote node",
[]string{"core"},
nil,
)
c.hostTotalRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_cpu"), "total_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_cpu"), "total_run_time"),
"The time spent by the virtual processor in guest and hypervisor code",
[]string{"core"},
nil,
)
c.hostCPUWaitTimePerDispatch = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("host_cpu"), "wait_time_per_dispatch_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("host_cpu"), "wait_time_per_dispatch_total"),
"Time in nanoseconds waiting for a virtual processor to be dispatched onto a logical processor",
[]string{"core"},
nil,
@@ -412,31 +412,31 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.vmGuestRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_cpu"), "guest_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_cpu"), "guest_run_time"),
"The time spent by the virtual processor in guest code",
[]string{"vm", "core"},
nil,
)
c.vmHypervisorRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_cpu"), "hypervisor_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_cpu"), "hypervisor_run_time"),
"The time spent by the virtual processor in hypervisor code",
[]string{"vm", "core"},
nil,
)
c.vmRemoteRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_cpu"), "remote_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_cpu"), "remote_run_time"),
"The time spent by the virtual processor running on a remote node",
[]string{"vm", "core"},
nil,
)
c.vmTotalRunTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_cpu"), "total_run_time"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_cpu"), "total_run_time"),
"The time spent by the virtual processor in guest and hypervisor code",
[]string{"vm", "core"},
nil,
)
c.vmCPUWaitTimePerDispatch = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_cpu"), "wait_time_per_dispatch_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_cpu"), "wait_time_per_dispatch_total"),
"Time in nanoseconds waiting for a virtual processor to be dispatched onto a logical processor",
[]string{"vm", "core"},
nil,
@@ -444,127 +444,127 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.broadcastPacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "broadcast_packets_received_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "broadcast_packets_received_total"),
"This represents the total number of broadcast packets received per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.broadcastPacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "broadcast_packets_sent_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "broadcast_packets_sent_total"),
"This represents the total number of broadcast packets sent per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.bytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "bytes_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "bytes_total"),
"This represents the total number of bytes per second traversing the virtual switch",
[]string{"vswitch"},
nil,
)
c.bytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "bytes_received_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "bytes_received_total"),
"This represents the total number of bytes received per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.bytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "bytes_sent_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "bytes_sent_total"),
"This represents the total number of bytes sent per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.directedPacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "directed_packets_received_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "directed_packets_received_total"),
"This represents the total number of directed packets received per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.directedPacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "directed_packets_send_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "directed_packets_send_total"),
"This represents the total number of directed packets sent per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.droppedPacketsIncoming = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "dropped_packets_incoming_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "dropped_packets_incoming_total"),
"This represents the total number of packet dropped per second by the virtual switch in the incoming direction",
[]string{"vswitch"},
nil,
)
c.droppedPacketsOutgoing = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "dropped_packets_outcoming_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "dropped_packets_outcoming_total"),
"This represents the total number of packet dropped per second by the virtual switch in the outgoing direction",
[]string{"vswitch"},
nil,
)
c.extensionsDroppedPacketsIncoming = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_incoming_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_incoming_total"),
"This represents the total number of packet dropped per second by the virtual switch extensions in the incoming direction",
[]string{"vswitch"},
nil,
)
c.extensionsDroppedPacketsOutgoing = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_outcoming_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_outcoming_total"),
"This represents the total number of packet dropped per second by the virtual switch extensions in the outgoing direction",
[]string{"vswitch"},
nil,
)
c.learnedMacAddresses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "learned_mac_addresses_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "learned_mac_addresses_total"),
"This counter represents the total number of learned MAC addresses of the virtual switch",
[]string{"vswitch"},
nil,
)
c.multicastPacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "multicast_packets_received_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "multicast_packets_received_total"),
"This represents the total number of multicast packets received per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.multicastPacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "multicast_packets_sent_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "multicast_packets_sent_total"),
"This represents the total number of multicast packets sent per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.numberOfSendChannelMoves = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "number_of_send_channel_moves_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "number_of_send_channel_moves_total"),
"This represents the total number of send channel moves per second on this virtual switch",
[]string{"vswitch"},
nil,
)
c.numberOfVMQMoves = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "number_of_vmq_moves_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "number_of_vmq_moves_total"),
"This represents the total number of VMQ moves per second on this virtual switch",
[]string{"vswitch"},
nil,
)
c.packetsFlooded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "packets_flooded_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "packets_flooded_total"),
"This counter represents the total number of packets flooded by the virtual switch",
[]string{"vswitch"},
nil,
)
c.packets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "packets_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "packets_total"),
"This represents the total number of packets per second traversing the virtual switch",
[]string{"vswitch"},
nil,
)
c.packetsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "packets_received_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "packets_received_total"),
"This represents the total number of packets received per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.packetsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "packets_sent_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "packets_sent_total"),
"This represents the total number of packets send per second by the virtual switch",
[]string{"vswitch"},
nil,
)
c.purgedMacAddresses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vswitch"), "purged_mac_addresses_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vswitch"), "purged_mac_addresses_total"),
"This counter represents the total number of purged MAC addresses of the virtual switch",
[]string{"vswitch"},
nil,
@@ -573,37 +573,37 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.adapterBytesDropped = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("ethernet"), "bytes_dropped"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("ethernet"), "bytes_dropped"),
"Bytes Dropped is the number of bytes dropped on the network adapter",
[]string{"adapter"},
nil,
)
c.adapterBytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("ethernet"), "bytes_received"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("ethernet"), "bytes_received"),
"Bytes received is the number of bytes received on the network adapter",
[]string{"adapter"},
nil,
)
c.adapterBytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("ethernet"), "bytes_sent"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("ethernet"), "bytes_sent"),
"Bytes sent is the number of bytes sent over the network adapter",
[]string{"adapter"},
nil,
)
c.adapterFramesDropped = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("ethernet"), "frames_dropped"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("ethernet"), "frames_dropped"),
"Frames Dropped is the number of frames dropped on the network adapter",
[]string{"adapter"},
nil,
)
c.adapterFramesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("ethernet"), "frames_received"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("ethernet"), "frames_received"),
"Frames received is the number of frames received on the network adapter",
[]string{"adapter"},
nil,
)
c.adapterFramesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("ethernet"), "frames_sent"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("ethernet"), "frames_sent"),
"Frames sent is the number of frames sent over the network adapter",
[]string{"adapter"},
nil,
@@ -612,37 +612,37 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.vmStorageErrorCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_device"), "error_count"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_device"), "error_count"),
"This counter represents the total number of errors that have occurred on this virtual device",
[]string{"vm_device"},
nil,
)
c.vmStorageQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_device"), "queue_length"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_device"), "queue_length"),
"This counter represents the current queue length on this virtual device",
[]string{"vm_device"},
nil,
)
c.vmStorageReadBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_device"), "bytes_read"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_device"), "bytes_read"),
"This counter represents the total number of bytes that have been read per second on this virtual device",
[]string{"vm_device"},
nil,
)
c.vmStorageReadOperations = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_device"), "operations_read"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_device"), "operations_read"),
"This counter represents the number of read operations that have occurred per second on this virtual device",
[]string{"vm_device"},
nil,
)
c.vmStorageWriteBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_device"), "bytes_written"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_device"), "bytes_written"),
"This counter represents the total number of bytes that have been written per second on this virtual device",
[]string{"vm_device"},
nil,
)
c.vmStorageWriteOperations = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_device"), "operations_written"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_device"), "operations_written"),
"This counter represents the number of write operations that have occurred per second on this virtual device",
[]string{"vm_device"},
nil,
@@ -651,37 +651,37 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.vmStorageBytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_interface"), "bytes_received"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_interface"), "bytes_received"),
"This counter represents the total number of bytes received per second by the network adapter",
[]string{"vm_interface"},
nil,
)
c.vmStorageBytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_interface"), "bytes_sent"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_interface"), "bytes_sent"),
"This counter represents the total number of bytes sent per second by the network adapter",
[]string{"vm_interface"},
nil,
)
c.vmStorageDroppedPacketsIncoming = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_interface"), "packets_incoming_dropped"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_interface"), "packets_incoming_dropped"),
"This counter represents the total number of dropped packets per second in the incoming direction of the network adapter",
[]string{"vm_interface"},
nil,
)
c.vmStorageDroppedPacketsOutgoing = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_interface"), "packets_outgoing_dropped"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_interface"), "packets_outgoing_dropped"),
"This counter represents the total number of dropped packets per second in the outgoing direction of the network adapter",
[]string{"vm_interface"},
nil,
)
c.vmStoragePacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_interface"), "packets_received"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_interface"), "packets_received"),
"This counter represents the total number of packets received per second by the network adapter",
[]string{"vm_interface"},
nil,
)
c.vmStoragePacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_interface"), "packets_sent"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_interface"), "packets_sent"),
"This counter represents the total number of packets sent per second by the network adapter",
[]string{"vm_interface"},
nil,
@@ -690,61 +690,61 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
//
c.vmMemoryAddedMemory = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "added_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "added_total"),
"This counter represents memory in MB added to the VM",
[]string{"vm"},
nil,
)
c.vmMemoryAveragePressure = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "pressure_average"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "pressure_average"),
"This gauge represents the average pressure in the VM.",
[]string{"vm"},
nil,
)
c.vmMemoryCurrentPressure = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "pressure_current"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "pressure_current"),
"This gauge represents the current pressure in the VM.",
[]string{"vm"},
nil,
)
c.vmMemoryGuestVisiblePhysicalMemory = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "physical_guest_visible"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "physical_guest_visible"),
"'This gauge represents the amount of memory in MB visible to the VM guest.'",
[]string{"vm"},
nil,
)
c.vmMemoryMaximumPressure = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "pressure_maximum"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "pressure_maximum"),
"This gauge represents the maximum pressure band in the VM.",
[]string{"vm"},
nil,
)
c.vmMemoryMemoryAddOperations = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "add_operations_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "add_operations_total"),
"This counter represents the number of operations adding memory to the VM.",
[]string{"vm"},
nil,
)
c.vmMemoryMemoryRemoveOperations = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "remove_operations_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "remove_operations_total"),
"This counter represents the number of operations removing memory from the VM.",
[]string{"vm"},
nil,
)
c.vmMemoryMinimumPressure = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "pressure_minimum"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "pressure_minimum"),
"This gauge represents the minimum pressure band in the VM.",
[]string{"vm"},
nil,
)
c.vmMemoryPhysicalMemory = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "physical"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "physical"),
"This gauge represents the current amount of memory in MB assigned to the VM.",
[]string{"vm"},
nil,
)
c.vmMemoryRemovedMemory = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, buildSubsystemName("vm_memory"), "removed_total"),
prometheus.BuildFQName(types2.Namespace, buildSubsystemName("vm_memory"), "removed_total"),
"This counter represents memory in MB removed from the VM",
[]string{"vm"},
nil,
@@ -755,7 +755,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collectVmHealth(ch); err != nil {
logger.Error("failed collecting hyperV health status metrics",

View File

@@ -3,8 +3,8 @@ package hyperv_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/hyperv"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/hyperv"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -10,8 +10,8 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
"golang.org/x/sys/windows/registry"
@@ -27,10 +27,10 @@ type Config struct {
}
var ConfigDefaults = Config{
SiteInclude: types.RegExpAny,
SiteExclude: types.RegExpEmpty,
AppInclude: types.RegExpAny,
AppExclude: types.RegExpEmpty,
SiteInclude: types2.RegExpAny,
SiteExclude: types2.RegExpEmpty,
AppInclude: types2.RegExpAny,
AppExclude: types2.RegExpEmpty,
}
type Collector struct {
@@ -268,7 +268,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
c.iisVersion = getIISVersion(logger)
c.info = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"),
prometheus.BuildFQName(types2.Namespace, Name, "info"),
"ISS information",
[]string{},
prometheus.Labels{
@@ -278,133 +278,133 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// Web Service
c.currentAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_anonymous_users"),
prometheus.BuildFQName(types2.Namespace, Name, "current_anonymous_users"),
"Number of users who currently have an anonymous connection using the Web service (WebService.CurrentAnonymousUsers)",
[]string{"site"},
nil,
)
c.currentBlockedAsyncIORequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_blocked_async_io_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "current_blocked_async_io_requests"),
"Current requests temporarily blocked due to bandwidth throttling settings (WebService.CurrentBlockedAsyncIORequests)",
[]string{"site"},
nil,
)
c.currentCGIRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_cgi_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "current_cgi_requests"),
"Current number of CGI requests being simultaneously processed by the Web service (WebService.CurrentCGIRequests)",
[]string{"site"},
nil,
)
c.currentConnections = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_connections"),
prometheus.BuildFQName(types2.Namespace, Name, "current_connections"),
"Current number of connections established with the Web service (WebService.CurrentConnections)",
[]string{"site"},
nil,
)
c.currentISAPIExtensionRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_isapi_extension_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "current_isapi_extension_requests"),
"Current number of ISAPI requests being simultaneously processed by the Web service (WebService.CurrentISAPIExtensionRequests)",
[]string{"site"},
nil,
)
c.currentNonAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_non_anonymous_users"),
prometheus.BuildFQName(types2.Namespace, Name, "current_non_anonymous_users"),
"Number of users who currently have a non-anonymous connection using the Web service (WebService.CurrentNonAnonymousUsers)",
[]string{"site"},
nil,
)
c.serviceUptime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "service_uptime"),
prometheus.BuildFQName(types2.Namespace, Name, "service_uptime"),
"Number of seconds the WebService is up (WebService.ServiceUptime)",
[]string{"site"},
nil,
)
c.totalBytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "received_bytes_total"),
"Number of data bytes that have been received by the Web service (WebService.TotalBytesReceived)",
[]string{"site"},
nil,
)
c.totalBytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "sent_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "sent_bytes_total"),
"Number of data bytes that have been sent by the Web service (WebService.TotalBytesSent)",
[]string{"site"},
nil,
)
c.totalAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "anonymous_users_total"),
prometheus.BuildFQName(types2.Namespace, Name, "anonymous_users_total"),
"Total number of users who established an anonymous connection with the Web service (WebService.TotalAnonymousUsers)",
[]string{"site"},
nil,
)
c.totalBlockedAsyncIORequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "blocked_async_io_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "blocked_async_io_requests_total"),
"Total requests temporarily blocked due to bandwidth throttling settings (WebService.TotalBlockedAsyncIORequests)",
[]string{"site"},
nil,
)
c.totalCGIRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cgi_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "cgi_requests_total"),
"Total CGI requests is the total number of CGI requests (WebService.TotalCGIRequests)",
[]string{"site"},
nil,
)
c.totalConnectionAttemptsAllInstances = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_attempts_all_instances_total"),
prometheus.BuildFQName(types2.Namespace, Name, "connection_attempts_all_instances_total"),
"Number of connections that have been attempted using the Web service (WebService.TotalConnectionAttemptsAllInstances)",
[]string{"site"},
nil,
)
c.totalRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "requests_total"),
"Number of HTTP requests (WebService.TotalRequests)",
[]string{"site", "method"},
nil,
)
c.totalFilesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "files_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "files_received_total"),
"Number of files received by the Web service (WebService.TotalFilesReceived)",
[]string{"site"},
nil,
)
c.totalFilesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "files_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "files_sent_total"),
"Number of files sent by the Web service (WebService.TotalFilesSent)",
[]string{"site"},
nil,
)
c.totalISAPIExtensionRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ipapi_extension_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "ipapi_extension_requests_total"),
"ISAPI Extension Requests received (WebService.TotalISAPIExtensionRequests)",
[]string{"site"},
nil,
)
c.totalLockedErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "locked_errors_total"),
prometheus.BuildFQName(types2.Namespace, Name, "locked_errors_total"),
"Number of requests that couldn't be satisfied by the server because the requested resource was locked (WebService.TotalLockedErrors)",
[]string{"site"},
nil,
)
c.totalLogonAttempts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logon_attempts_total"),
prometheus.BuildFQName(types2.Namespace, Name, "logon_attempts_total"),
"Number of logons attempts to the Web Service (WebService.TotalLogonAttempts)",
[]string{"site"},
nil,
)
c.totalNonAnonymousUsers = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "non_anonymous_users_total"),
prometheus.BuildFQName(types2.Namespace, Name, "non_anonymous_users_total"),
"Number of users who established a non-anonymous connection with the Web service (WebService.TotalNonAnonymousUsers)",
[]string{"site"},
nil,
)
c.totalNotFoundErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "not_found_errors_total"),
prometheus.BuildFQName(types2.Namespace, Name, "not_found_errors_total"),
"Number of requests that couldn't be satisfied by the server because the requested document could not be found (WebService.TotalNotFoundErrors)",
[]string{"site"},
nil,
)
c.totalRejectedAsyncIORequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rejected_async_io_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "rejected_async_io_requests_total"),
"Requests rejected due to bandwidth throttling settings (WebService.TotalRejectedAsyncIORequests)",
[]string{"site"},
nil,
@@ -412,79 +412,79 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// APP_POOL_WAS
c.currentApplicationPoolState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_application_pool_state"),
prometheus.BuildFQName(types2.Namespace, Name, "current_application_pool_state"),
"The current status of the application pool (1 - Uninitialized, 2 - Initialized, 3 - Running, 4 - Disabling, 5 - Disabled, 6 - Shutdown Pending, 7 - Delete Pending) (CurrentApplicationPoolState)",
[]string{"app", "state"},
nil,
)
c.currentApplicationPoolUptime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_application_pool_start_time"),
prometheus.BuildFQName(types2.Namespace, Name, "current_application_pool_start_time"),
"The unix timestamp for the application pool start time (CurrentApplicationPoolUptime)",
[]string{"app"},
nil,
)
c.currentWorkerProcesses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_worker_processes"),
prometheus.BuildFQName(types2.Namespace, Name, "current_worker_processes"),
"The current number of worker processes that are running in the application pool (CurrentWorkerProcesses)",
[]string{"app"},
nil,
)
c.maximumWorkerProcesses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "maximum_worker_processes"),
prometheus.BuildFQName(types2.Namespace, Name, "maximum_worker_processes"),
"The maximum number of worker processes that have been created for the application pool since Windows Process Activation Service (WAS) started (MaximumWorkerProcesses)",
[]string{"app"},
nil,
)
c.recentWorkerProcessFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recent_worker_process_failures"),
prometheus.BuildFQName(types2.Namespace, Name, "recent_worker_process_failures"),
"The number of times that worker processes for the application pool failed during the rapid-fail protection interval (RecentWorkerProcessFailures)",
[]string{"app"},
nil,
)
c.timeSinceLastWorkerProcessFailure = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "time_since_last_worker_process_failure"),
prometheus.BuildFQName(types2.Namespace, Name, "time_since_last_worker_process_failure"),
"The length of time, in seconds, since the last worker process failure occurred for the application pool (TimeSinceLastWorkerProcessFailure)",
[]string{"app"},
nil,
)
c.totalApplicationPoolRecycles = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_application_pool_recycles"),
prometheus.BuildFQName(types2.Namespace, Name, "total_application_pool_recycles"),
"The number of times that the application pool has been recycled since Windows Process Activation Service (WAS) started (TotalApplicationPoolRecycles)",
[]string{"app"},
nil,
)
c.totalApplicationPoolUptime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_application_pool_start_time"),
prometheus.BuildFQName(types2.Namespace, Name, "total_application_pool_start_time"),
"The unix timestamp for the application pool of when the Windows Process Activation Service (WAS) started (TotalApplicationPoolUptime)",
[]string{"app"},
nil,
)
c.totalWorkerProcessesCreated = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_processes_created"),
prometheus.BuildFQName(types2.Namespace, Name, "total_worker_processes_created"),
"The number of worker processes created for the application pool since Windows Process Activation Service (WAS) started (TotalWorkerProcessesCreated)",
[]string{"app"},
nil,
)
c.totalWorkerProcessFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_failures"),
prometheus.BuildFQName(types2.Namespace, Name, "total_worker_process_failures"),
"The number of times that worker processes have crashed since the application pool was started (TotalWorkerProcessFailures)",
[]string{"app"},
nil,
)
c.totalWorkerProcessPingFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_ping_failures"),
prometheus.BuildFQName(types2.Namespace, Name, "total_worker_process_ping_failures"),
"The number of times that Windows Process Activation Service (WAS) did not receive a response to ping messages sent to a worker process (TotalWorkerProcessPingFailures)",
[]string{"app"},
nil,
)
c.totalWorkerProcessShutdownFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_shutdown_failures"),
prometheus.BuildFQName(types2.Namespace, Name, "total_worker_process_shutdown_failures"),
"The number of times that Windows Process Activation Service (WAS) failed to shut down a worker process (TotalWorkerProcessShutdownFailures)",
[]string{"app"},
nil,
)
c.totalWorkerProcessStartupFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "total_worker_process_startup_failures"),
prometheus.BuildFQName(types2.Namespace, Name, "total_worker_process_startup_failures"),
"The number of times that Windows Process Activation Service (WAS) failed to start a worker process (TotalWorkerProcessStartupFailures)",
[]string{"app"},
nil,
@@ -492,224 +492,224 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// W3SVC_W3WP
c.threads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_threads"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_threads"),
"Number of threads actively processing requests in the worker process",
[]string{"app", "pid", "state"},
nil,
)
c.maximumThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_max_threads"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_max_threads"),
"Maximum number of threads to which the thread pool can grow as needed",
[]string{"app", "pid"},
nil,
)
c.requestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_requests_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_requests_total"),
"Total number of HTTP requests served by the worker process",
[]string{"app", "pid"},
nil,
)
c.requestsActive = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_current_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_current_requests"),
"Current number of requests being processed by the worker process",
[]string{"app", "pid"},
nil,
)
c.activeFlushedEntries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_cache_active_flushed_entries"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_cache_active_flushed_entries"),
"Number of file handles cached in user-mode that will be closed when all current transfers complete.",
[]string{"app", "pid"},
nil,
)
c.currentFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_memory_bytes"),
"Current number of bytes used by user-mode file cache",
[]string{"app", "pid"},
nil,
)
c.maximumFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_max_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_max_memory_bytes"),
"Maximum number of bytes used by user-mode file cache",
[]string{"app", "pid"},
nil,
)
c.fileCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_flushes_total"),
"Total number of files removed from the user-mode cache",
[]string{"app", "pid"},
nil,
)
c.fileCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_queries_total"),
"Total file cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.fileCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_hits_total"),
"Total number of successful lookups in the user-mode file cache",
[]string{"app", "pid"},
nil,
)
c.filesCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_items"),
"Current number of files whose contents are present in user-mode cache",
[]string{"app", "pid"},
nil,
)
c.filesCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_items_total"),
"Total number of files whose contents were ever added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.filesFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_file_cache_items_flushed_total"),
"Total number of file handles that have been removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.uriCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_uri_cache_flushes_total"),
"Total number of URI cache flushes (since service startup)",
[]string{"app", "pid"},
nil,
)
c.uriCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_uri_cache_queries_total"),
"Total number of uri cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.uriCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_uri_cache_hits_total"),
"Total number of successful lookups in the user-mode URI cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.urisCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_uri_cache_items"),
"Number of URI information blocks currently in the user-mode cache",
[]string{"app", "pid"},
nil,
)
c.urisCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_uri_cache_items_total"),
"Total number of URI information blocks added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.urisFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_uri_cache_items_flushed_total"),
"The number of URI information blocks that have been removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_metadata_cache_items"),
"Number of metadata information blocks currently present in user-mode cache",
[]string{"app", "pid"},
nil,
)
c.metadataCacheFlushes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_metadata_cache_flushes_total"),
"Total number of user-mode metadata cache flushes (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_metadata_cache_queries_total"),
"Total metadata cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.metadataCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_metadata_cache_hits_total"),
"Total number of successful lookups in the user-mode metadata cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_cached_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_metadata_cache_items_cached_total"),
"Total number of metadata information blocks added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.metadataFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_metadata_cache_items_flushed_total"),
"Total number of metadata information blocks removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.outputCacheActiveFlushedItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_active_flushed_items"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_output_cache_active_flushed_items"),
"",
[]string{"app", "pid"},
nil,
)
c.outputCacheItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_output_cache_items"),
"Number of items current present in output cache",
[]string{"app", "pid"},
nil,
)
c.outputCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_output_cache_memory_bytes"),
"Current number of bytes used by output cache",
[]string{"app", "pid"},
nil,
)
c.outputCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_output_queries_total"),
"Total number of output cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
)
c.outputCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_output_cache_hits_total"),
"Total number of successful lookups in output cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.outputCacheFlushedItemsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_output_cache_items_flushed_total"),
"Total number of items flushed from output cache (since service startup)",
[]string{"app", "pid"},
nil,
)
c.outputCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_output_cache_flushes_total"),
"Total number of flushes of output cache (since service startup)",
[]string{"app", "pid"},
nil,
)
// W3SVC_W3WP_IIS8
c.requestErrorsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_request_errors_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_request_errors_total"),
"Total number of requests that returned an error",
[]string{"app", "pid", "status_code"},
nil,
)
c.webSocketRequestsActive = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_current_websocket_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_current_websocket_requests"),
"",
[]string{"app", "pid"},
nil,
)
c.webSocketConnectionAttempts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_attempts_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_websocket_connection_attempts_total"),
"",
[]string{"app", "pid"},
nil,
)
c.webSocketConnectionsAccepted = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_accepted_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_websocket_connection_accepted_total"),
"",
[]string{"app", "pid"},
nil,
)
c.webSocketConnectionsRejected = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_rejected_total"),
prometheus.BuildFQName(types2.Namespace, Name, "worker_websocket_connection_rejected_total"),
"",
[]string{"app", "pid"},
nil,
@@ -717,169 +717,169 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// Web Service Cache
c.serviceCacheActiveFlushedEntries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_cache_active_flushed_entries"),
prometheus.BuildFQName(types2.Namespace, Name, "server_cache_active_flushed_entries"),
"Number of file handles cached that will be closed when all current transfers complete.",
nil,
nil,
)
c.serviceCacheCurrentFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_memory_bytes"),
"Current number of bytes used by file cache",
nil,
nil,
)
c.serviceCacheMaximumFileCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_max_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_max_memory_bytes"),
"Maximum number of bytes used by file cache",
nil,
nil,
)
c.serviceCacheFileCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_flushes_total"),
"Total number of file cache flushes (since service startup)",
nil,
nil,
)
c.serviceCacheFileCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_queries_total"),
"Total number of file cache queries (hits + misses)",
nil,
nil,
)
c.serviceCacheFileCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_hits_total"),
"Total number of successful lookups in the user-mode file cache",
nil,
nil,
)
c.serviceCacheFilesCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_items"),
"Current number of files whose contents are present in cache",
nil,
nil,
)
c.serviceCacheFilesCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_items_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_items_total"),
"Total number of files whose contents were ever added to the cache (since service startup)",
nil,
nil,
)
c.serviceCacheFilesFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_file_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_file_cache_items_flushed_total"),
"Total number of file handles that have been removed from the cache (since service startup)",
nil,
nil,
)
c.serviceCacheURICacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_uri_cache_flushes_total"),
"Total number of URI cache flushes (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheURICacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_uri_cache_queries_total"),
"Total number of uri cache queries (hits + misses)",
[]string{"mode"},
nil,
)
c.serviceCacheURICacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_uri_cache_hits_total"),
"Total number of successful lookups in the URI cache (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheURIsCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "server_uri_cache_items"),
"Number of URI information blocks currently in the cache",
[]string{"mode"},
nil,
)
c.serviceCacheURIsCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_items_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_uri_cache_items_total"),
"Total number of URI information blocks added to the cache (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheURIsFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_uri_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_uri_cache_items_flushed_total"),
"The number of URI information blocks that have been removed from the cache (since service startup)",
[]string{"mode"},
nil,
)
c.serviceCacheMetadataCached = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "server_metadata_cache_items"),
"Number of metadata information blocks currently present in cache",
nil,
nil,
)
c.serviceCacheMetadataCacheFlushes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_metadata_cache_flushes_total"),
"Total number of metadata cache flushes (since service startup)",
nil,
nil,
)
c.serviceCacheMetadataCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_metadata_cache_queries_total"),
"Total metadata cache queries (hits + misses)",
nil,
nil,
)
c.serviceCacheMetadataCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_metadata_cache_hits_total"),
"Total number of successful lookups in the metadata cache (since service startup)",
nil,
nil,
)
c.serviceCacheMetadataCachedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_items_cached_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_metadata_cache_items_cached_total"),
"Total number of metadata information blocks added to the cache (since service startup)",
nil,
nil,
)
c.serviceCacheMetadataFlushedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_metadata_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_metadata_cache_items_flushed_total"),
"Total number of metadata information blocks removed from the cache (since service startup)",
nil,
nil,
)
c.serviceCacheOutputCacheActiveFlushedItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_active_flushed_items"),
prometheus.BuildFQName(types2.Namespace, Name, "server_output_cache_active_flushed_items"),
"",
nil,
nil,
)
c.serviceCacheOutputCacheItems = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_items"),
prometheus.BuildFQName(types2.Namespace, Name, "server_output_cache_items"),
"Number of items current present in output cache",
nil,
nil,
)
c.serviceCacheOutputCacheMemoryUsage = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "server_output_cache_memory_bytes"),
"Current number of bytes used by output cache",
nil,
nil,
)
c.serviceCacheOutputCacheQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_queries_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_output_cache_queries_total"),
"Total output cache queries (hits + misses)",
nil,
nil,
)
c.serviceCacheOutputCacheHitsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_hits_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_output_cache_hits_total"),
"Total number of successful lookups in output cache (since service startup)",
nil,
nil,
)
c.serviceCacheOutputCacheFlushedItemsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_items_flushed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_output_cache_items_flushed_total"),
"Total number of items flushed from output cache (since service startup)",
nil,
nil,
)
c.serviceCacheOutputCacheFlushesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "server_output_cache_flushes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "server_output_cache_flushes_total"),
"Total number of flushes of output cache (since service startup)",
nil,
nil,
@@ -940,7 +940,7 @@ func getIISVersion(logger *slog.Logger) simpleVersion {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collectWebService(ctx, logger, ch); err != nil {
logger.Error("failed collecting iis metrics",
@@ -1068,7 +1068,7 @@ func dedupIISNames[V hasGetIISName](services []V) map[string]V {
return webServiceDeDuplicated
}
func (c *Collector) collectWebService(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectWebService(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var webService []perflibWebService
@@ -1363,7 +1363,7 @@ var applicationStates = map[uint32]string{
7: "Delete Pending",
}
func (c *Collector) collectAPP_POOL_WAS(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectAPP_POOL_WAS(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var APP_POOL_WAS []perflibAPP_POOL_WAS
@@ -1543,7 +1543,7 @@ type perflibW3SVC_W3WP_IIS8 struct {
WebSocketConnectionsRejected float64 `perflib:"WebSocket Connections Rejected / Sec"`
}
func (c *Collector) collectW3SVC_W3WP(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectW3SVC_W3WP(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var W3SVC_W3WP []perflibW3SVC_W3WP
@@ -1945,7 +1945,7 @@ type perflibWebServiceCache struct {
ServiceCache_OutputCacheQueriesTotal float64
}
func (c *Collector) collectWebServiceCache(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectWebServiceCache(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var WebServiceCache []perflibWebServiceCache

View File

@@ -3,8 +3,8 @@ package iis_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/iis"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/iis"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -6,8 +6,8 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/headers/slc"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/headers/slc"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -63,7 +63,7 @@ func (c *Collector) Close(_ *slog.Logger) error {
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
c.licenseStatus = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "status"),
prometheus.BuildFQName(types2.Namespace, Name, "status"),
"Status of windows license",
[]string{"state"},
nil,
@@ -74,7 +74,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting license metrics",

View File

@@ -3,8 +3,8 @@ package license_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/license"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/license"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -12,8 +12,8 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
"golang.org/x/sys/windows"
@@ -27,8 +27,8 @@ type Config struct {
}
var ConfigDefaults = Config{
VolumeInclude: types.RegExpAny,
VolumeExclude: types.RegExpEmpty,
VolumeInclude: types2.RegExpAny,
VolumeExclude: types2.RegExpEmpty,
}
// A Collector is a Prometheus Collector for perflib logicalDisk metrics.
@@ -133,124 +133,124 @@ func (c *Collector) Close(_ *slog.Logger) error {
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
c.information = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"),
prometheus.BuildFQName(types2.Namespace, Name, "info"),
"A metric with a constant '1' value labeled with logical disk information",
[]string{"disk", "type", "volume", "volume_name", "filesystem", "serial_number"},
nil,
)
c.readOnly = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "readonly"),
prometheus.BuildFQName(types2.Namespace, Name, "readonly"),
"Whether the logical disk is read-only",
[]string{"volume"},
nil,
)
c.requestsQueued = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_queued"),
prometheus.BuildFQName(types2.Namespace, Name, "requests_queued"),
"The number of requests queued to the disk (LogicalDisk.CurrentDiskQueueLength)",
[]string{"volume"},
nil,
)
c.avgReadQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "avg_read_requests_queued"),
prometheus.BuildFQName(types2.Namespace, Name, "avg_read_requests_queued"),
"Average number of read requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskReadQueueLength)",
[]string{"volume"},
nil,
)
c.avgWriteQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "avg_write_requests_queued"),
prometheus.BuildFQName(types2.Namespace, Name, "avg_write_requests_queued"),
"Average number of write requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskWriteQueueLength)",
[]string{"volume"},
nil,
)
c.readBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_bytes_total"),
"The number of bytes transferred from the disk during read operations (LogicalDisk.DiskReadBytesPerSec)",
[]string{"volume"},
nil,
)
c.readsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "reads_total"),
"The number of read operations on the disk (LogicalDisk.DiskReadsPerSec)",
[]string{"volume"},
nil,
)
c.writeBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "write_bytes_total"),
"The number of bytes transferred to the disk during write operations (LogicalDisk.DiskWriteBytesPerSec)",
[]string{"volume"},
nil,
)
c.writesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "writes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "writes_total"),
"The number of write operations on the disk (LogicalDisk.DiskWritesPerSec)",
[]string{"volume"},
nil,
)
c.readTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_seconds_total"),
"Seconds that the disk was busy servicing read requests (LogicalDisk.PercentDiskReadTime)",
[]string{"volume"},
nil,
)
c.writeTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "write_seconds_total"),
"Seconds that the disk was busy servicing write requests (LogicalDisk.PercentDiskWriteTime)",
[]string{"volume"},
nil,
)
c.freeSpace = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "free_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "free_bytes"),
"Free space in bytes, updates every 10-15 min (LogicalDisk.PercentFreeSpace)",
[]string{"volume"},
nil,
)
c.totalSpace = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "size_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "size_bytes"),
"Total space in bytes, updates every 10-15 min (LogicalDisk.PercentFreeSpace_Base)",
[]string{"volume"},
nil,
)
c.idleTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "idle_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "idle_seconds_total"),
"Seconds that the disk was idle (LogicalDisk.PercentIdleTime)",
[]string{"volume"},
nil,
)
c.splitIOs = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "split_ios_total"),
prometheus.BuildFQName(types2.Namespace, Name, "split_ios_total"),
"The number of I/Os to the disk were split into multiple I/Os (LogicalDisk.SplitIOPerSec)",
[]string{"volume"},
nil,
)
c.readLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_latency_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_latency_seconds_total"),
"Shows the average time, in seconds, of a read operation from the disk (LogicalDisk.AvgDiskSecPerRead)",
[]string{"volume"},
nil,
)
c.writeLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_latency_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "write_latency_seconds_total"),
"Shows the average time, in seconds, of a write operation to the disk (LogicalDisk.AvgDiskSecPerWrite)",
[]string{"volume"},
nil,
)
c.readWriteLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_write_latency_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_write_latency_seconds_total"),
"Shows the time, in seconds, of the average disk transfer (LogicalDisk.AvgDiskSecPerTransfer)",
[]string{"volume"},
nil,
@@ -261,7 +261,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ctx, logger, ch); err != nil {
logger.Error("failed collecting logical_disk metrics",
@@ -297,7 +297,7 @@ type logicalDisk struct {
AvgDiskSecPerTransfer float64 `perflib:"Avg. Disk sec/Transfer"`
}
func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var (

View File

@@ -4,8 +4,8 @@ import (
"testing"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/collector/logical_disk"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/logical_disk"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -7,7 +7,7 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -61,7 +61,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.logonType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logon_type"),
prometheus.BuildFQName(types2.Namespace, Name, "logon_type"),
"Number of active logon sessions (LogonSession.LogonType)",
[]string{"status"},
nil,
@@ -72,7 +72,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting user metrics",

View File

@@ -3,8 +3,8 @@ package logon_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/logon"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/logon"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -11,9 +11,9 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/headers/sysinfoapi"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/headers/sysinfoapi"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -98,223 +98,223 @@ func (c *Collector) Close(_ *slog.Logger) error {
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
c.availableBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "available_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "available_bytes"),
"The amount of physical memory immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to"+
" the standby (cached), free and zero page lists (AvailableBytes)",
nil,
nil,
)
c.cacheBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cache_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "cache_bytes"),
"(CacheBytes)",
nil,
nil,
)
c.cacheBytesPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cache_bytes_peak"),
prometheus.BuildFQName(types2.Namespace, Name, "cache_bytes_peak"),
"(CacheBytesPeak)",
nil,
nil,
)
c.cacheFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cache_faults_total"),
prometheus.BuildFQName(types2.Namespace, Name, "cache_faults_total"),
"Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) "+
"or from disk (hard fault) (Cache Faults/sec)",
nil,
nil,
)
c.commitLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "commit_limit"),
prometheus.BuildFQName(types2.Namespace, Name, "commit_limit"),
"(CommitLimit)",
nil,
nil,
)
c.committedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "committed_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "committed_bytes"),
"(CommittedBytes)",
nil,
nil,
)
c.demandZeroFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "demand_zero_faults_total"),
prometheus.BuildFQName(types2.Namespace, Name, "demand_zero_faults_total"),
"The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security"+
" feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space (Demand Zero Faults/sec)",
nil,
nil,
)
c.freeAndZeroPageListBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "free_and_zero_page_list_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "free_and_zero_page_list_bytes"),
"The amount of physical memory, in bytes, that is assigned to the free and zero page lists. This memory does not contain cached data. It is immediately"+
" available for allocation to a process or for system use (FreeAndZeroPageListBytes)",
nil,
nil,
)
c.freeSystemPageTableEntries = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "free_system_page_table_entries"),
prometheus.BuildFQName(types2.Namespace, Name, "free_system_page_table_entries"),
"(FreeSystemPageTableEntries)",
nil,
nil,
)
c.modifiedPageListBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "modified_page_list_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "modified_page_list_bytes"),
"The amount of physical memory, in bytes, that is assigned to the modified page list. This memory contains cached data and code that is not actively in "+
"use by processes, the system and the system cache (ModifiedPageListBytes)",
nil,
nil,
)
c.pageFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_faults_total"),
prometheus.BuildFQName(types2.Namespace, Name, "page_faults_total"),
"Overall rate at which faulted pages are handled by the processor (Page Faults/sec)",
nil,
nil,
)
c.swapPageReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_page_reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "swap_page_reads_total"),
"Number of disk page reads (a single read operation reading several pages is still only counted once) (PageReadsPersec)",
nil,
nil,
)
c.swapPagesReadTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_pages_read_total"),
prometheus.BuildFQName(types2.Namespace, Name, "swap_pages_read_total"),
"Number of pages read across all page reads (ie counting all pages read even if they are read in a single operation) (PagesInputPersec)",
nil,
nil,
)
c.swapPagesWrittenTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_pages_written_total"),
prometheus.BuildFQName(types2.Namespace, Name, "swap_pages_written_total"),
"Number of pages written across all page writes (ie counting all pages written even if they are written in a single operation) (PagesOutputPersec)",
nil,
nil,
)
c.swapPageOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_page_operations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "swap_page_operations_total"),
"Total number of swap page read and writes (PagesPersec)",
nil,
nil,
)
c.swapPageWritesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "swap_page_writes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "swap_page_writes_total"),
"Number of disk page writes (a single write operation writing several pages is still only counted once) (PageWritesPersec)",
nil,
nil,
)
c.poolNonPagedAllocationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_nonpaged_allocs_total"),
prometheus.BuildFQName(types2.Namespace, Name, "pool_nonpaged_allocs_total"),
"The number of calls to allocate space in the nonpaged pool. The nonpaged pool is an area of system memory area for objects that cannot be written"+
" to disk, and must remain in physical memory as long as they are allocated (PoolNonpagedAllocs)",
nil,
nil,
)
c.poolNonPagedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_nonpaged_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "pool_nonpaged_bytes"),
"Number of bytes in the non-paged pool, an area of the system virtual memory that is used for objects that cannot be written to disk, but must "+
"remain in physical memory as long as they are allocated (PoolNonpagedBytes)",
nil,
nil,
)
c.poolPagedAllocationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_paged_allocs_total"),
prometheus.BuildFQName(types2.Namespace, Name, "pool_paged_allocs_total"),
"Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call (PoolPagedAllocs)",
nil,
nil,
)
c.poolPagedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_paged_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "pool_paged_bytes"),
"(PoolPagedBytes)",
nil,
nil,
)
c.poolPagedResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_paged_resident_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "pool_paged_resident_bytes"),
"The size, in bytes, of the portion of the paged pool that is currently resident and active in physical memory. The paged pool is an area of the "+
"system virtual memory that is used for objects that can be written to disk when they are not being used (PoolPagedResidentBytes)",
nil,
nil,
)
c.standbyCacheCoreBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "standby_cache_core_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "standby_cache_core_bytes"),
"The amount of physical memory, in bytes, that is assigned to the core standby cache page lists. This memory contains cached data and code that is "+
"not actively in use by processes, the system and the system cache (StandbyCacheCoreBytes)",
nil,
nil,
)
c.standbyCacheNormalPriorityBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "standby_cache_normal_priority_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "standby_cache_normal_priority_bytes"),
"The amount of physical memory, in bytes, that is assigned to the normal priority standby cache page lists. This memory contains cached data and "+
"code that is not actively in use by processes, the system and the system cache (StandbyCacheNormalPriorityBytes)",
nil,
nil,
)
c.standbyCacheReserveBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "standby_cache_reserve_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "standby_cache_reserve_bytes"),
"The amount of physical memory, in bytes, that is assigned to the reserve standby cache page lists. This memory contains cached data and code "+
"that is not actively in use by processes, the system and the system cache (StandbyCacheReserveBytes)",
nil,
nil,
)
c.systemCacheResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_cache_resident_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "system_cache_resident_bytes"),
"The size, in bytes, of the portion of the system file cache which is currently resident and active in physical memory (SystemCacheResidentBytes)",
nil,
nil,
)
c.systemCodeResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_code_resident_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "system_code_resident_bytes"),
"The size, in bytes, of the pageable operating system code that is currently resident and active in physical memory (SystemCodeResidentBytes)",
nil,
nil,
)
c.systemCodeTotalBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_code_total_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "system_code_total_bytes"),
"The size, in bytes, of the pageable operating system code currently mapped into the system virtual address space (SystemCodeTotalBytes)",
nil,
nil,
)
c.systemDriverResidentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_driver_resident_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "system_driver_resident_bytes"),
"The size, in bytes, of the pageable physical memory being used by device drivers. It is the working set (physical memory area) of the drivers (SystemDriverResidentBytes)",
nil,
nil,
)
c.systemDriverTotalBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_driver_total_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "system_driver_total_bytes"),
"The size, in bytes, of the pageable virtual memory currently being used by device drivers. Pageable memory can be written to disk when it is not being used (SystemDriverTotalBytes)",
nil,
nil,
)
c.transitionFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "transition_faults_total"),
prometheus.BuildFQName(types2.Namespace, Name, "transition_faults_total"),
"Number of faults rate at which page faults are resolved by recovering pages that were being used by another process sharing the page, or were on the "+
"modified page list or the standby list, or were being written to disk at the time of the page fault (TransitionFaultsPersec)",
nil,
nil,
)
c.transitionPagesRepurposedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "transition_pages_repurposed_total"),
prometheus.BuildFQName(types2.Namespace, Name, "transition_pages_repurposed_total"),
"Transition Pages RePurposed is the rate at which the number of transition cache pages were reused for a different purpose (TransitionPagesRePurposedPersec)",
nil,
nil,
)
c.writeCopiesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_copies_total"),
prometheus.BuildFQName(types2.Namespace, Name, "write_copies_total"),
"The number of page faults caused by attempting to write that were satisfied by copying the page from elsewhere in physical memory (WriteCopiesPersec)",
nil,
nil,
)
c.processMemoryLimitBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "process_memory_limit_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "process_memory_limit_bytes"),
"The size of the user-mode portion of the virtual address space of the calling process, in bytes. This value depends on the type of process, the type of processor, and the configuration of the operating system.",
nil,
nil,
)
c.physicalMemoryTotalBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_total_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "physical_total_bytes"),
"The amount of actual physical memory, in bytes.",
nil,
nil,
)
c.physicalMemoryFreeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_free_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "physical_free_bytes"),
"The amount of physical memory currently available, in bytes. This is the amount of physical memory that can be immediately reused without having to write its contents to disk first. It is the sum of the size of the standby, free, and zero lists.",
nil,
nil,
@@ -325,7 +325,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
errs := make([]error, 0, 2)
@@ -413,7 +413,7 @@ type memory struct {
WriteCopiesPersec float64 `perflib:"Write Copies/sec"`
}
func (c *Collector) collectPerformanceData(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectPerformanceData(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var dst []memory

View File

@@ -3,8 +3,8 @@ package memory_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/memory"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/memory"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -8,7 +8,7 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)

View File

@@ -1,7 +1,7 @@
package mscluster
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -1,7 +1,7 @@
package mscluster
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -1,7 +1,7 @@
package mscluster
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -1,7 +1,7 @@
package mscluster
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -1,7 +1,7 @@
package mscluster
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -8,8 +8,8 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -89,25 +89,25 @@ func (c *Collector) Build(logger *slog.Logger, wmiClient *wmi.Client) error {
}
c.bytesInJournalQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_in_journal_queue"),
prometheus.BuildFQName(types2.Namespace, Name, "bytes_in_journal_queue"),
"Size of queue journal in bytes",
[]string{"name"},
nil,
)
c.bytesInQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_in_queue"),
prometheus.BuildFQName(types2.Namespace, Name, "bytes_in_queue"),
"Size of queue in bytes",
[]string{"name"},
nil,
)
c.messagesInJournalQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_in_journal_queue"),
prometheus.BuildFQName(types2.Namespace, Name, "messages_in_journal_queue"),
"Count messages in queue journal",
[]string{"name"},
nil,
)
c.messagesInQueue = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_in_queue"),
prometheus.BuildFQName(types2.Namespace, Name, "messages_in_queue"),
"Count messages in queue",
[]string{"name"},
nil,
@@ -118,7 +118,7 @@ func (c *Collector) Build(logger *slog.Logger, wmiClient *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting msmq metrics",

View File

@@ -3,8 +3,8 @@ package msmq_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/msmq"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/msmq"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -3,8 +3,8 @@ package mssql_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/mssql"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/mssql"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -13,10 +13,10 @@ import (
"unsafe"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
"golang.org/x/sys/windows"
@@ -31,8 +31,8 @@ type Config struct {
}
var ConfigDefaults = Config{
NicExclude: types.RegExpEmpty,
NicInclude: types.RegExpAny,
NicExclude: types2.RegExpEmpty,
NicInclude: types2.RegExpAny,
CollectorsEnabled: []string{
"metrics",
"nic_addresses",
@@ -182,91 +182,91 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
}
c.bytesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "bytes_received_total"),
"(Network.BytesReceivedPerSec)",
[]string{"nic"},
nil,
)
c.bytesSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "bytes_sent_total"),
"(Network.BytesSentPerSec)",
[]string{"nic"},
nil,
)
c.bytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "bytes_total"),
"(Network.BytesTotalPerSec)",
[]string{"nic"},
nil,
)
c.outputQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "output_queue_length_packets"),
prometheus.BuildFQName(types2.Namespace, Name, "output_queue_length_packets"),
"(Network.OutputQueueLength)",
[]string{"nic"},
nil,
)
c.packetsOutboundDiscarded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_outbound_discarded_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_outbound_discarded_total"),
"(Network.PacketsOutboundDiscarded)",
[]string{"nic"},
nil,
)
c.packetsOutboundErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_outbound_errors_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_outbound_errors_total"),
"(Network.PacketsOutboundErrors)",
[]string{"nic"},
nil,
)
c.packetsReceivedDiscarded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_discarded_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_received_discarded_total"),
"(Network.PacketsReceivedDiscarded)",
[]string{"nic"},
nil,
)
c.packetsReceivedErrors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_errors_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_received_errors_total"),
"(Network.PacketsReceivedErrors)",
[]string{"nic"},
nil,
)
c.packetsReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_received_total"),
"(Network.PacketsReceivedPerSec)",
[]string{"nic"},
nil,
)
c.packetsReceivedUnknown = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_unknown_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_received_unknown_total"),
"(Network.PacketsReceivedUnknown)",
[]string{"nic"},
nil,
)
c.packetsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_total"),
"(Network.PacketsPerSec)",
[]string{"nic"},
nil,
)
c.packetsSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "packets_sent_total"),
"(Network.PacketsSentPerSec)",
[]string{"nic"},
nil,
)
c.currentBandwidth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_bandwidth_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "current_bandwidth_bytes"),
"(Network.CurrentBandwidth)",
[]string{"nic"},
nil,
)
c.nicAddressInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "nic_address_info"),
prometheus.BuildFQName(types2.Namespace, Name, "nic_address_info"),
"A metric with a constant '1' value labeled with the network interface's address information.",
[]string{"nic", "friendly_name", "address", "family"},
nil,
)
c.routeInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "route_info"),
prometheus.BuildFQName(types2.Namespace, Name, "route_info"),
"A metric with a constant '1' value labeled with the network interface's route information.",
[]string{"nic", "src", "dest", "metric"},
nil,
@@ -277,7 +277,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if slices.Contains(c.config.CollectorsEnabled, "metrics") {
@@ -303,7 +303,7 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
return nil
}
func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
var dst []perflibNetworkInterface
if err := perflib.UnmarshalObject(ctx.PerfObjects["Network Interface"], &dst, logger); err != nil {

View File

@@ -6,8 +6,8 @@ import (
"testing"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/collector/net"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/net"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -9,7 +9,7 @@ import (
"slices"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,7 +3,7 @@
package netframework
import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)

View File

@@ -3,8 +3,8 @@ package netframework_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/netframework"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -6,7 +6,7 @@ import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -85,152 +85,152 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.accessAccepts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_accepts"),
prometheus.BuildFQName(types2.Namespace, Name, "access_accepts"),
"(AccessAccepts)",
nil,
nil,
)
c.accessChallenges = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_challenges"),
prometheus.BuildFQName(types2.Namespace, Name, "access_challenges"),
"(AccessChallenges)",
nil,
nil,
)
c.accessRejects = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_rejects"),
prometheus.BuildFQName(types2.Namespace, Name, "access_rejects"),
"(AccessRejects)",
nil,
nil,
)
c.accessRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "access_requests"),
"(AccessRequests)",
nil,
nil,
)
c.accessBadAuthenticators = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_bad_authenticators"),
prometheus.BuildFQName(types2.Namespace, Name, "access_bad_authenticators"),
"(BadAuthenticators)",
nil,
nil,
)
c.accessDroppedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_dropped_packets"),
prometheus.BuildFQName(types2.Namespace, Name, "access_dropped_packets"),
"(DroppedPackets)",
nil,
nil,
)
c.accessInvalidRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_invalid_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "access_invalid_requests"),
"(InvalidRequests)",
nil,
nil,
)
c.accessMalformedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_malformed_packets"),
prometheus.BuildFQName(types2.Namespace, Name, "access_malformed_packets"),
"(MalformedPackets)",
nil,
nil,
)
c.accessPacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_packets_received"),
prometheus.BuildFQName(types2.Namespace, Name, "access_packets_received"),
"(PacketsReceived)",
nil,
nil,
)
c.accessPacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_packets_sent"),
prometheus.BuildFQName(types2.Namespace, Name, "access_packets_sent"),
"(PacketsSent)",
nil,
nil,
)
c.accessServerResetTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_server_reset_time"),
prometheus.BuildFQName(types2.Namespace, Name, "access_server_reset_time"),
"(ServerResetTime)",
nil,
nil,
)
c.accessServerUpTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_server_up_time"),
prometheus.BuildFQName(types2.Namespace, Name, "access_server_up_time"),
"(ServerUpTime)",
nil,
nil,
)
c.accessUnknownType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_unknown_type"),
prometheus.BuildFQName(types2.Namespace, Name, "access_unknown_type"),
"(UnknownType)",
nil,
nil,
)
c.accountingRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_requests"),
"(AccountingRequests)",
nil,
nil,
)
c.accountingResponses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_responses"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_responses"),
"(AccountingResponses)",
nil,
nil,
)
c.accountingBadAuthenticators = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_bad_authenticators"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_bad_authenticators"),
"(BadAuthenticators)",
nil,
nil,
)
c.accountingDroppedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_dropped_packets"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_dropped_packets"),
"(DroppedPackets)",
nil,
nil,
)
c.accountingInvalidRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_invalid_requests"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_invalid_requests"),
"(InvalidRequests)",
nil,
nil,
)
c.accountingMalformedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_malformed_packets"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_malformed_packets"),
"(MalformedPackets)",
nil,
nil,
)
c.accountingNoRecord = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_no_record"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_no_record"),
"(NoRecord)",
nil,
nil,
)
c.accountingPacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_received"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_packets_received"),
"(PacketsReceived)",
nil,
nil,
)
c.accountingPacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_sent"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_packets_sent"),
"(PacketsSent)",
nil,
nil,
)
c.accountingServerResetTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_reset_time"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_server_reset_time"),
"(ServerResetTime)",
nil,
nil,
)
c.accountingServerUpTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_up_time"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_server_up_time"),
"(ServerUpTime)",
nil,
nil,
)
c.accountingUnknownType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_unknown_type"),
prometheus.BuildFQName(types2.Namespace, Name, "accounting_unknown_type"),
"(UnknownType)",
nil,
nil,
@@ -241,7 +241,7 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.CollectAccept(ch); err != nil {
logger.Error(fmt.Sprintf("failed collecting NPS accept data: %s", err))

View File

@@ -3,8 +3,8 @@ package nps_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/nps"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/nps"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -12,12 +12,12 @@ import (
"time"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/headers/kernel32"
"github.com/prometheus-community/windows_exporter/pkg/headers/netapi32"
"github.com/prometheus-community/windows_exporter/pkg/headers/psapi"
"github.com/prometheus-community/windows_exporter/pkg/headers/sysinfoapi"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/headers/kernel32"
"github.com/prometheus-community/windows_exporter/internal/headers/netapi32"
"github.com/prometheus-community/windows_exporter/internal/headers/psapi"
"github.com/prometheus-community/windows_exporter/internal/headers/sysinfoapi"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
"golang.org/x/sys/windows"
@@ -124,7 +124,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
}
c.osInformation = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"),
prometheus.BuildFQName(types2.Namespace, Name, "info"),
`Contains full product name & version in labels. Note that the "major_version" for Windows 11 is \"10\"; a build number greater than 22000 represents Windows 11.`,
nil,
prometheus.Labels{
@@ -138,7 +138,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
)
c.hostname = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "hostname"),
prometheus.BuildFQName(types2.Namespace, Name, "hostname"),
"Labelled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain",
[]string{
"hostname",
@@ -148,73 +148,73 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
nil,
)
c.pagingLimitBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "paging_limit_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "paging_limit_bytes"),
"OperatingSystem.SizeStoredInPagingFiles",
nil,
nil,
)
c.pagingFreeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "paging_free_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "paging_free_bytes"),
"OperatingSystem.FreeSpaceInPagingFiles",
nil,
nil,
)
c.physicalMemoryFreeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_memory_free_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "physical_memory_free_bytes"),
"Deprecated: Use `windows_memory_physical_free_bytes` instead.",
nil,
nil,
)
c.time = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "time"),
prometheus.BuildFQName(types2.Namespace, Name, "time"),
"Deprecated: Use windows_time_current_timestamp_seconds instead.",
nil,
nil,
)
c.timezone = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "timezone"),
prometheus.BuildFQName(types2.Namespace, Name, "timezone"),
"Deprecated: Use windows_time_timezone instead.",
[]string{"timezone"},
nil,
)
c.processes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processes"),
prometheus.BuildFQName(types2.Namespace, Name, "processes"),
"Deprecated: Use `windows_system_processes` instead.",
nil,
nil,
)
c.processesLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processes_limit"),
prometheus.BuildFQName(types2.Namespace, Name, "processes_limit"),
"Deprecated: Use `windows_system_process_limit` instead.",
nil,
nil,
)
c.processMemoryLimitBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "process_memory_limit_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "process_memory_limit_bytes"),
"Deprecated: Use `windows_memory_process_memory_limit_bytes` instead.",
nil,
nil,
)
c.users = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "users"),
prometheus.BuildFQName(types2.Namespace, Name, "users"),
"Deprecated: Use `count(windows_logon_logon_type)` instead.",
nil,
nil,
)
c.virtualMemoryBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "virtual_memory_bytes"),
"Deprecated: Use `windows_memory_commit_limit` instead.",
nil,
nil,
)
c.visibleMemoryBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "visible_memory_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "visible_memory_bytes"),
"Deprecated: Use `windows_memory_physical_total_bytes` instead.",
nil,
nil,
)
c.virtualMemoryFreeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_memory_free_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "virtual_memory_free_bytes"),
"Deprecated: Use `windows_memory_commit_limit - windows_memory_committed_bytes` instead.",
nil,
nil,
@@ -225,7 +225,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
errs := make([]error, 0, 5)
@@ -382,7 +382,7 @@ func (c *Collector) collectMemory(ch chan<- prometheus.Metric) error {
return nil
}
func (c *Collector) collectPaging(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectPaging(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
// Get total allocation of paging files across all disks.
memManKey, err := registry.OpenKey(registry.LOCAL_MACHINE, `SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management`, registry.QUERY_VALUE)
if err != nil {

View File

@@ -3,8 +3,8 @@ package os_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/os"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/os"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -11,8 +11,8 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -114,7 +114,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
if err := c.collect(ch); err != nil {
logger.Error("failed collecting performance data metrics",
slog.Any("err", err),
@@ -153,7 +153,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
sanitizeMetricName(fmt.Sprintf("%s_perfdata_%s_%s", types.Namespace, object.Object, counter)),
sanitizeMetricName(fmt.Sprintf("%s_perfdata_%s_%s", types2.Namespace, object.Object, counter)),
fmt.Sprintf("Performance data for \\%s\\%s", object.Object, counter),
nil,
labels,

View File

@@ -11,7 +11,7 @@ import (
"regexp"
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
perfdata2 "github.com/prometheus-community/windows_exporter/internal/collector/perfdata"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/stretchr/testify/assert"
@@ -19,7 +19,7 @@ import (
)
type collectorAdapter struct {
perfdata.Collector
perfdata2.Collector
}
// Describe implements the prometheus.Collector interface.
@@ -40,27 +40,27 @@ func TestCollector(t *testing.T) {
for _, tc := range []struct {
object string
instances []string
counters map[string]perfdata.Counter
counters map[string]perfdata2.Counter
expectedMetrics *regexp.Regexp
}{
{
object: "Memory",
instances: nil,
counters: map[string]perfdata.Counter{"Available Bytes": {Type: "gauge"}},
counters: map[string]perfdata2.Counter{"Available Bytes": {Type: "gauge"}},
expectedMetrics: regexp.MustCompile(`^# HELP windows_perfdata_memory_available_bytes Performance data for \\\\Memory\\\\Available Bytes\s*# TYPE windows_perfdata_memory_available_bytes gauge\s*windows_perfdata_memory_available_bytes \d`),
},
{
object: "Process",
instances: []string{"*"},
counters: map[string]perfdata.Counter{"Thread Count": {Type: "counter"}},
counters: map[string]perfdata2.Counter{"Thread Count": {Type: "counter"}},
expectedMetrics: regexp.MustCompile(`^# HELP windows_perfdata_process_thread_count Performance data for \\\\Process\\\\Thread Count\s*# TYPE windows_perfdata_process_thread_count counter\s*windows_perfdata_process_thread_count\{instance=".+"} \d`),
},
} {
t.Run(tc.object, func(t *testing.T) {
t.Parallel()
perfDataCollector := perfdata.New(&perfdata.Config{
Objects: []perfdata.Object{
perfDataCollector := perfdata2.New(&perfdata2.Config{
Objects: []perfdata2.Object{
{
Object: tc.object,
Instances: tc.instances,

View File

@@ -6,8 +6,8 @@ import (
"testing"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/perfdata"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -1,7 +1,7 @@
package perfdata
import (
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
"github.com/prometheus-community/windows_exporter/internal/perfdata"
)
type Object struct {

View File

@@ -9,8 +9,8 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -23,8 +23,8 @@ type Config struct {
}
var ConfigDefaults = Config{
DiskInclude: types.RegExpAny,
DiskExclude: types.RegExpEmpty,
DiskInclude: types2.RegExpAny,
DiskExclude: types2.RegExpEmpty,
}
// A Collector is a Prometheus Collector for perflib PhysicalDisk metrics.
@@ -115,84 +115,84 @@ func (c *Collector) Close(_ *slog.Logger) error {
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
c.requestsQueued = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_queued"),
prometheus.BuildFQName(types2.Namespace, Name, "requests_queued"),
"The number of requests queued to the disk (PhysicalDisk.CurrentDiskQueueLength)",
[]string{"disk"},
nil,
)
c.readBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_bytes_total"),
"The number of bytes transferred from the disk during read operations (PhysicalDisk.DiskReadBytesPerSec)",
[]string{"disk"},
nil,
)
c.readsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "reads_total"),
prometheus.BuildFQName(types2.Namespace, Name, "reads_total"),
"The number of read operations on the disk (PhysicalDisk.DiskReadsPerSec)",
[]string{"disk"},
nil,
)
c.writeBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "write_bytes_total"),
"The number of bytes transferred to the disk during write operations (PhysicalDisk.DiskWriteBytesPerSec)",
[]string{"disk"},
nil,
)
c.writesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "writes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "writes_total"),
"The number of write operations on the disk (PhysicalDisk.DiskWritesPerSec)",
[]string{"disk"},
nil,
)
c.readTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_seconds_total"),
"Seconds that the disk was busy servicing read requests (PhysicalDisk.PercentDiskReadTime)",
[]string{"disk"},
nil,
)
c.writeTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "write_seconds_total"),
"Seconds that the disk was busy servicing write requests (PhysicalDisk.PercentDiskWriteTime)",
[]string{"disk"},
nil,
)
c.idleTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "idle_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "idle_seconds_total"),
"Seconds that the disk was idle (PhysicalDisk.PercentIdleTime)",
[]string{"disk"},
nil,
)
c.splitIOs = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "split_ios_total"),
prometheus.BuildFQName(types2.Namespace, Name, "split_ios_total"),
"The number of I/Os to the disk were split into multiple I/Os (PhysicalDisk.SplitIOPerSec)",
[]string{"disk"},
nil,
)
c.readLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_latency_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_latency_seconds_total"),
"Shows the average time, in seconds, of a read operation from the disk (PhysicalDisk.AvgDiskSecPerRead)",
[]string{"disk"},
nil,
)
c.writeLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_latency_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "write_latency_seconds_total"),
"Shows the average time, in seconds, of a write operation to the disk (PhysicalDisk.AvgDiskSecPerWrite)",
[]string{"disk"},
nil,
)
c.readWriteLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_write_latency_seconds_total"),
prometheus.BuildFQName(types2.Namespace, Name, "read_write_latency_seconds_total"),
"Shows the time, in seconds, of the average disk transfer (PhysicalDisk.AvgDiskSecPerTransfer)",
[]string{"disk"},
nil,
@@ -203,7 +203,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ctx, logger, ch); err != nil {
logger.Error("failed collecting physical_disk metrics",
@@ -235,7 +235,7 @@ type PhysicalDisk struct {
AvgDiskSecPerTransfer float64 `perflib:"Avg. Disk sec/Transfer"`
}
func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var dst []PhysicalDisk

View File

@@ -3,8 +3,8 @@ package physical_disk_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/physical_disk"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/physical_disk"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -10,7 +10,7 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -34,8 +34,8 @@ type Config struct {
}
var ConfigDefaults = Config{
PrinterInclude: types.RegExpAny,
PrinterExclude: types.RegExpEmpty,
PrinterInclude: types2.RegExpAny,
PrinterExclude: types2.RegExpEmpty,
}
type Collector struct {
@@ -115,19 +115,19 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
c.wmiClient = wmiClient
c.printerJobStatus = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "job_status"),
prometheus.BuildFQName(types2.Namespace, Name, "job_status"),
"A counter of printer jobs by status",
[]string{"printer", "status"},
nil,
)
c.printerStatus = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "status"),
prometheus.BuildFQName(types2.Namespace, Name, "status"),
"Printer status",
[]string{"printer", "status"},
nil,
)
c.printerJobCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "job_count"),
prometheus.BuildFQName(types2.Namespace, Name, "job_count"),
"Number of jobs processed by the printer since the last reset",
[]string{"printer"},
nil,
@@ -154,7 +154,7 @@ type wmiPrintJob struct {
Status string
}
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collectPrinterStatus(ch); err != nil {
logger.Error("failed to collect printer status metrics",

View File

@@ -4,8 +4,8 @@ import (
"testing"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/collector/printer"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/printer"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -12,8 +12,8 @@ import (
"unsafe"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
"golang.org/x/sys/windows"
@@ -28,8 +28,8 @@ type Config struct {
}
var ConfigDefaults = Config{
ProcessInclude: types.RegExpAny,
ProcessExclude: types.RegExpEmpty,
ProcessInclude: types2.RegExpAny,
ProcessExclude: types2.RegExpEmpty,
EnableWorkerProcess: false,
}
@@ -144,98 +144,98 @@ func (c *Collector) Build(logger *slog.Logger, wmiClient *wmi.Client) error {
}
c.info = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"),
prometheus.BuildFQName(types2.Namespace, Name, "info"),
"Process information.",
[]string{"process", "process_id", "creating_process_id", "process_group_id", "owner", "cmdline"},
nil,
)
c.startTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "start_time"),
prometheus.BuildFQName(types2.Namespace, Name, "start_time"),
"Time of process start.",
[]string{"process", "process_id"},
nil,
)
c.cpuTimeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_time_total"),
prometheus.BuildFQName(types2.Namespace, Name, "cpu_time_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,
)
c.handleCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "handles"),
prometheus.BuildFQName(types2.Namespace, Name, "handles"),
"Total number of handles the process has open. This number is the sum of the handles currently open by each thread in the process.",
[]string{"process", "process_id"},
nil,
)
c.ioBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "io_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "io_bytes_total"),
"Bytes issued to I/O operations in different modes (read, write, other).",
[]string{"process", "process_id", "mode"},
nil,
)
c.ioOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "io_operations_total"),
prometheus.BuildFQName(types2.Namespace, Name, "io_operations_total"),
"I/O operations issued in different modes (read, write, other).",
[]string{"process", "process_id", "mode"},
nil,
)
c.pageFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_faults_total"),
prometheus.BuildFQName(types2.Namespace, Name, "page_faults_total"),
"Page faults by the threads executing in this process.",
[]string{"process", "process_id"},
nil,
)
c.pageFileBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_file_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "page_file_bytes"),
"Current number of bytes this process has used in the paging file(s).",
[]string{"process", "process_id"},
nil,
)
c.poolBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "pool_bytes"),
"Pool Bytes is the last observed number of bytes in the paged or nonpaged pool.",
[]string{"process", "process_id", "pool"},
nil,
)
c.priorityBase = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "priority_base"),
prometheus.BuildFQName(types2.Namespace, Name, "priority_base"),
"Current base priority of this process. Threads within a process can raise and lower their own base priority relative to the process base priority of the process.",
[]string{"process", "process_id"},
nil,
)
c.privateBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "private_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "private_bytes"),
"Current number of bytes this process has allocated that cannot be shared with other processes.",
[]string{"process", "process_id"},
nil,
)
c.threadCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "threads"),
prometheus.BuildFQName(types2.Namespace, Name, "threads"),
"Number of threads currently active in this process.",
[]string{"process", "process_id"},
nil,
)
c.virtualBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "virtual_bytes"),
"Current size, in bytes, of the virtual address space that the process is using.",
[]string{"process", "process_id"},
nil,
)
c.workingSetPrivate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_private_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "working_set_private_bytes"),
"Size of the working set, in bytes, that is use for this process only and not shared nor shareable by other processes.",
[]string{"process", "process_id"},
nil,
)
c.workingSetPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_peak_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "working_set_peak_bytes"),
"Maximum size, in bytes, of the Working Set of this process at any point in time. The Working Set is the set of memory pages touched recently by the threads in the process.",
[]string{"process", "process_id"},
nil,
)
c.workingSet = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_bytes"),
prometheus.BuildFQName(types2.Namespace, Name, "working_set_bytes"),
"Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process.",
[]string{"process", "process_id"},
nil,
@@ -283,7 +283,7 @@ type WorkerProcess struct {
ProcessId uint64
}
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
data := make([]perflibProcess, 0)

View File

@@ -4,8 +4,8 @@ import (
"testing"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/collector/process"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/process"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkProcessCollector(b *testing.B) {

View File

@@ -7,9 +7,9 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus-community/windows_exporter/internal/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -84,79 +84,79 @@ func (c *Collector) Close(_ *slog.Logger) error {
func (c *Collector) Build(*slog.Logger, *wmi.Client) error {
// net
c.baseTCPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_base_tcp_rtt_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "net_base_tcp_rtt_seconds"),
"Base TCP round-trip time (RTT) detected in seconds",
[]string{"session_name"},
nil,
)
c.baseUDPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_base_udp_rtt_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "net_base_udp_rtt_seconds"),
"Base UDP round-trip time (RTT) detected in seconds.",
[]string{"session_name"},
nil,
)
c.currentTCPBandwidth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_tcp_bandwidth"),
prometheus.BuildFQName(types2.Namespace, Name, "net_current_tcp_bandwidth"),
"TCP Bandwidth detected in bytes per second.",
[]string{"session_name"},
nil,
)
c.currentTCPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_tcp_rtt_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "net_current_tcp_rtt_seconds"),
"Average TCP round-trip time (RTT) detected in seconds.",
[]string{"session_name"},
nil,
)
c.currentUDPBandwidth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_udp_bandwidth"),
prometheus.BuildFQName(types2.Namespace, Name, "net_current_udp_bandwidth"),
"UDP Bandwidth detected in bytes per second.",
[]string{"session_name"},
nil,
)
c.currentUDPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_udp_rtt_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "net_current_udp_rtt_seconds"),
"Average UDP round-trip time (RTT) detected in seconds.",
[]string{"session_name"},
nil,
)
c.totalReceivedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_received_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "net_received_bytes_total"),
"(TotalReceivedBytes)",
[]string{"session_name"},
nil,
)
c.totalSentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_sent_bytes_total"),
prometheus.BuildFQName(types2.Namespace, Name, "net_sent_bytes_total"),
"(TotalSentBytes)",
[]string{"session_name"},
nil,
)
c.udpPacketsReceivedPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_udp_packets_received_total"),
prometheus.BuildFQName(types2.Namespace, Name, "net_udp_packets_received_total"),
"Rate in packets per second at which packets are received over UDP.",
[]string{"session_name"},
nil,
)
c.udpPacketsSentPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_udp_packets_sent_total"),
prometheus.BuildFQName(types2.Namespace, Name, "net_udp_packets_sent_total"),
"Rate in packets per second at which packets are sent over UDP.",
[]string{"session_name"},
nil,
)
c.fecRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_fec_rate"),
prometheus.BuildFQName(types2.Namespace, Name, "net_fec_rate"),
"Forward Error Correction (FEC) percentage",
[]string{"session_name"},
nil,
)
c.lossRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_loss_rate"),
prometheus.BuildFQName(types2.Namespace, Name, "net_loss_rate"),
"Loss percentage",
[]string{"session_name"},
nil,
)
c.retransmissionRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_retransmission_rate"),
prometheus.BuildFQName(types2.Namespace, Name, "net_retransmission_rate"),
"Percentage of packets that have been retransmitted",
[]string{"session_name"},
nil,
@@ -164,43 +164,43 @@ func (c *Collector) Build(*slog.Logger, *wmi.Client) error {
// gfx
c.averageEncodingTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_average_encoding_time_seconds"),
prometheus.BuildFQName(types2.Namespace, Name, "gfx_average_encoding_time_seconds"),
"Average frame encoding time in seconds",
[]string{"session_name"},
nil,
)
c.frameQuality = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_frame_quality"),
prometheus.BuildFQName(types2.Namespace, Name, "gfx_frame_quality"),
"Quality of the output frame expressed as a percentage of the quality of the source frame.",
[]string{"session_name"},
nil,
)
c.framesSkippedPerSecondInsufficientResources = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_frames_skipped_insufficient_resource_total"),
prometheus.BuildFQName(types2.Namespace, Name, "gfx_frames_skipped_insufficient_resource_total"),
"Number of frames skipped per second due to insufficient client resources.",
[]string{"session_name", "resource"},
nil,
)
c.graphicsCompressionRatio = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_graphics_compression_ratio"),
prometheus.BuildFQName(types2.Namespace, Name, "gfx_graphics_compression_ratio"),
"Ratio of the number of bytes encoded to the number of bytes input.",
[]string{"session_name"},
nil,
)
c.inputFramesPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_input_frames_total"),
prometheus.BuildFQName(types2.Namespace, Name, "gfx_input_frames_total"),
"Number of sources frames provided as input to RemoteFX graphics per second.",
[]string{"session_name"},
nil,
)
c.outputFramesPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_output_frames_total"),
prometheus.BuildFQName(types2.Namespace, Name, "gfx_output_frames_total"),
"Number of frames sent to the client per second.",
[]string{"session_name"},
nil,
)
c.sourceFramesPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_source_frames_total"),
prometheus.BuildFQName(types2.Namespace, Name, "gfx_source_frames_total"),
"Number of frames composed by the source (DWM) per second.",
[]string{"session_name"},
nil,
@@ -211,7 +211,7 @@ func (c *Collector) Build(*slog.Logger, *wmi.Client) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collectRemoteFXNetworkCount(ctx, logger, ch); err != nil {
logger.Error("failed collecting terminal services session count metrics",
@@ -249,7 +249,7 @@ type perflibRemoteFxNetwork struct {
RetransmissionRate float64 `perflib:"Percentage of packets that have been retransmitted"`
}
func (c *Collector) collectRemoteFXNetworkCount(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectRemoteFXNetworkCount(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
dst := make([]perflibRemoteFxNetwork, 0)
@@ -362,7 +362,7 @@ type perflibRemoteFxGraphics struct {
SourceFramesPerSecond float64 `perflib:"Source Frames/Second"`
}
func (c *Collector) collectRemoteFXGraphicsCounters(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectRemoteFXGraphicsCounters(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
dst := make([]perflibRemoteFxGraphics, 0)

View File

@@ -3,8 +3,8 @@ package remote_fx_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/remote_fx"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/remote_fx"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -13,7 +13,7 @@ import (
"github.com/alecthomas/kingpin/v2"
"github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -26,8 +26,8 @@ type Config struct {
}
var ConfigDefaults = Config{
TaskExclude: types.RegExpEmpty,
TaskInclude: types.RegExpAny,
TaskExclude: types2.RegExpEmpty,
TaskInclude: types2.RegExpAny,
}
type Collector struct {
@@ -160,21 +160,21 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
c.lastResult = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "last_result"),
prometheus.BuildFQName(types2.Namespace, Name, "last_result"),
"The result that was returned the last time the registered task was run",
[]string{"task"},
nil,
)
c.missedRuns = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "missed_runs"),
prometheus.BuildFQName(types2.Namespace, Name, "missed_runs"),
"The number of times the registered task missed a scheduled run",
[]string{"task"},
nil,
)
c.state = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "state"),
prometheus.BuildFQName(types2.Namespace, Name, "state"),
"The current state of a scheduled task",
[]string{"task", "state"},
nil,
@@ -183,7 +183,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
return nil
}
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(ch); err != nil {
logger.Error("failed collecting user metrics",

View File

@@ -3,8 +3,8 @@ package scheduled_task_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/scheduled_task"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/scheduled_task"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -11,7 +11,7 @@ import (
"unsafe"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/types"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
"golang.org/x/sys/windows"
@@ -26,8 +26,8 @@ type Config struct {
}
var ConfigDefaults = Config{
ServiceInclude: types.RegExpAny,
ServiceExclude: types.RegExpEmpty,
ServiceInclude: types2.RegExpAny,
ServiceExclude: types2.RegExpEmpty,
}
// A Collector is a Prometheus Collector for service metrics.
@@ -114,25 +114,25 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
}
c.info = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"),
prometheus.BuildFQName(types2.Namespace, Name, "info"),
"A metric with a constant '1' value labeled with service information",
[]string{"name", "display_name", "run_as", "path_name"},
nil,
)
c.state = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "state"),
prometheus.BuildFQName(types2.Namespace, Name, "state"),
"The state of the service (State)",
[]string{"name", "state"},
nil,
)
c.startMode = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "start_mode"),
prometheus.BuildFQName(types2.Namespace, Name, "start_mode"),
"The start mode of the service (StartMode)",
[]string{"name", "start_mode"},
nil,
)
c.processID = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "process"),
prometheus.BuildFQName(types2.Namespace, Name, "process"),
"Process of started service. The value is the creation time of the process as a unix timestamp.",
[]string{"name", "process_id"},
nil,
@@ -161,7 +161,7 @@ func (c *Collector) Close(logger *slog.Logger) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(_ *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collect(logger, ch); err != nil {

View File

@@ -3,8 +3,8 @@ package service_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/service"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
"github.com/prometheus-community/windows_exporter/internal/collector/service"
"github.com/prometheus-community/windows_exporter/internal/testutils"
)
func BenchmarkCollector(b *testing.B) {

View File

@@ -7,8 +7,8 @@ import (
"strings"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/pkg/perflib"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/internal/perflib"
types2 "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusufpapurcu/wmi"
)
@@ -60,7 +60,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
// desc creates a new prometheus description
desc := func(metricName string, description string, labels ...string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, "smb", metricName),
prometheus.BuildFQName(types2.Namespace, "smb", metricName),
description,
labels,
nil,
@@ -74,7 +74,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
}
// Collect collects smb metrics and sends them to prometheus.
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) Collect(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
if err := c.collectServerShares(ctx, logger, ch); err != nil {
logger.Error("failed to collect server share metrics",
@@ -95,7 +95,7 @@ type perflibServerShares struct {
TreeConnectCount float64 `perflib:"Tree Connect Count"`
}
func (c *Collector) collectServerShares(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectServerShares(ctx *types2.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
logger = logger.With(slog.String("collector", Name))
var data []perflibServerShares

Some files were not shown because too many files have changed in this diff Show More