Skip to content

Commit

Permalink
performancecounter: Add the possibility to request formatted values (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke authored Jan 14, 2025
1 parent 4cd9627 commit 86e6d12
Show file tree
Hide file tree
Showing 80 changed files with 354 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .run/all.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="all" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="run">
<module name="windows_exporter" />
<working_directory value="$PROJECT_DIR$" />
<parameters value="--web.listen-address=127.0.0.1:9182 --log.level=info --collectors.enabled=ad,adcs,adfs,cache,container,cpu,cpu_info,cs,dfsr,dhcp,diskdrive,dns,exchange,filetime,fsrmquota,hyperv,iis,license,logical_disk,logon,memory,mscluster,msmq,mssql,net,netframework,nps,os,pagefile,performancecounter,physical_disk,printer,process,remote_fx,scheduled_task,service,smb,smbclient,smtp,system,tcp,terminal_services,thermalzone,time,udp,update,vmware,performancecounter --debug.enabled --collector.performancecounter.objects='[{ &quot;name&quot;: &quot;memory&quot;, &quot;object&quot;: &quot;Memory&quot;, &quot;counters&quot;: [{ &quot;name&quot;:&quot;Cache Faults/sec&quot;, &quot;type&quot;:&quot;counter&quot; }]}]'" />
<parameters value="--web.listen-address=127.0.0.1:9182 --log.level=info --collectors.enabled=ad,adcs,adfs,cache,container,cpu,cpu_info,cs,dfsr,dhcp,diskdrive,dns,exchange,filetime,fsrmquota,hyperv,iis,license,logical_disk,logon,memory,mscluster,msmq,mssql,net,netframework,nps,os,pagefile,performancecounter,physical_disk,printer,process,remote_fx,scheduled_task,service,smb,smbclient,smtp,system,tcp,terminal_services,thermalzone,time,udp,update,vmware,performancecounter --debug.enabled --collector.performancecounter.objects='[{ &quot;name&quot;: &quot;memory&quot;, &quot;type&quot;: &quot;formatted&quot;, &quot;object&quot;: &quot;Memory&quot;, &quot;counters&quot;: [{ &quot;name&quot;:&quot;Cache Faults/sec&quot;, &quot;type&quot;:&quot;counter&quot; }]}]'" />
<sudo value="true" />
<kind value="PACKAGE" />
<package value="github.com/prometheus-community/windows_exporter/cmd/windows_exporter" />
Expand Down
15 changes: 11 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ collector:
include: "windows_exporter"
performancecounter:
objects: |-
- name: memory
object: "Memory"
- name: photon_udp
object: "Photon Socket Server: UDP"
instances: ["*"]
counters:
- name: "Cache Faults/sec"
type: "counter" # optional
- name: "UDP: Datagrams in"
metric: "photon_udp_datagrams"
labels:
direction: "in"
- name: "UDP: Datagrams out"
metric: "photon_udp_datagrams"
labels:
direction: "out"
log:
level: warn
29 changes: 29 additions & 0 deletions docs/collector.performancecounter.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ YAML:
state: idle
- name: memory
object: "Memory"
type: "formatted"
counters:
- name: "Cache Faults/sec"
type: "counter" # optional
Expand Down Expand Up @@ -98,6 +99,7 @@ YAML:
{
"name": "memory",
"object": "Memory",
"type": "formatted",
"counters": [
{
"name": "Cache Faults/sec",
Expand All @@ -120,6 +122,33 @@ ObjectName is the Object to query for, like Processor, DirectoryServices, Logica

The collector supports only english named counter. Localized counter-names are not supported.

#### type

The counter-type. The value can be `raw` or `formatted`. Optional and defaults to `raw`.

- `raw` returns the raw value of the counter. This is the default.
- `formatted` returns the formatted value of the counter. This is useful for counters like `Processor Information` where the value is a percentage.

The difference between a raw Windows Performance Counter and a formatted Windows Performance Counter is about how the data is presented and processed:

1. Raw Windows Performance Counter:

This provides the counter's data in its basic, unprocessed form.
The values may represent cumulative counts, time intervals, or other uncalibrated metrics.
Interpreting these values often requires more calculations or context, such as calculating deltas or normalizing values over time.

2. Formatted Windows Performance Counter:

This presents data that has already been processed and interpreted according to the counter type (e.g., rates per second, averages, percentages).
Formatted counters are easier to understand directly since the necessary calculations have been applied.
These are often what monitoring tools display to users because they are meaningful at a glance.

For example:

* A raw counter for CPU time might give the total number of clock ticks used since the system started.
* A formatted counter would convert this into a percentage of CPU utilization over a specific time interval.


#### instances

The instances key (this is an array) declares the instances of a counter you would like returned, it can be one or more values.
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/ad/ad.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (c *Collector) Close() error {
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
var err error

c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues]("DirectoryServices", pdh.InstancesAll)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "DirectoryServices", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DirectoryServices collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/adcs/adcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (c *Collector) Close() error {
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
var err error

c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues]("Certification Authority", pdh.InstancesAll)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "Certification Authority", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Certification Authority collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/adfs/adfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (c *Collector) Close() error {
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
var err error

c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues]("AD FS", nil)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "AD FS", nil)
if err != nil {
return fmt.Errorf("failed to create AD FS collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (c *Collector) Close() error {
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
var err error

c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues]("Cache", pdh.InstancesAll)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "Cache", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Cache collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {

c.mu = sync.Mutex{}

c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues]("Processor Information", pdh.InstancesAll)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "Processor Information", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Processor Information collector: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/collector/dfsr/dfsr.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,21 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
var err error

if slices.Contains(c.config.CollectorsEnabled, "connection") {
c.perfDataCollectorConnection, err = pdh.NewCollector[perfDataCounterValuesConnection]("DFS Replication Connections", pdh.InstancesAll)
c.perfDataCollectorConnection, err = pdh.NewCollector[perfDataCounterValuesConnection](pdh.CounterTypeRaw, "DFS Replication Connections", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replication Connections collector: %w", err)
}
}

if slices.Contains(c.config.CollectorsEnabled, "folder") {
c.perfDataCollectorFolder, err = pdh.NewCollector[perfDataCounterValuesFolder]("DFS Replicated Folders", pdh.InstancesAll)
c.perfDataCollectorFolder, err = pdh.NewCollector[perfDataCounterValuesFolder](pdh.CounterTypeRaw, "DFS Replicated Folders", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replicated Folders collector: %w", err)
}
}

if slices.Contains(c.config.CollectorsEnabled, "volume") {
c.perfDataCollectorVolume, err = pdh.NewCollector[perfDataCounterValuesVolume]("DFS Replication Service Volumes", pdh.InstancesAll)
c.perfDataCollectorVolume, err = pdh.NewCollector[perfDataCounterValuesVolume](pdh.CounterTypeRaw, "DFS Replication Service Volumes", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replication Service Volumes collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/dhcp/dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (c *Collector) Close() error {
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
var err error

c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues]("DHCP Server", nil)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "DHCP Server", nil)
if err != nil {
return fmt.Errorf("failed to create DHCP Server collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (c *Collector) Close() error {
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
var err error

c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues]("DNS", pdh.InstancesAll)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "DNS", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DNS collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/exchange/exchange_active_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type perfDataCounterValuesActiveSync struct {
func (c *Collector) buildActiveSync() error {
var err error

c.perfDataCollectorActiveSync, err = pdh.NewCollector[perfDataCounterValuesActiveSync]("MSExchange ActiveSync", pdh.InstancesAll)
c.perfDataCollectorActiveSync, err = pdh.NewCollector[perfDataCounterValuesActiveSync](pdh.CounterTypeRaw, "MSExchange ActiveSync", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange ActiveSync collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type perfDataCounterValuesADAccessProcesses struct {
func (c *Collector) buildADAccessProcesses() error {
var err error

c.perfDataCollectorADAccessProcesses, err = pdh.NewCollector[perfDataCounterValuesADAccessProcesses]("MSExchange ADAccess Processes", pdh.InstancesAll)
c.perfDataCollectorADAccessProcesses, err = pdh.NewCollector[perfDataCounterValuesADAccessProcesses](pdh.CounterTypeRaw, "MSExchange ADAccess Processes", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange ADAccess Processes collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/exchange/exchange_autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type perfDataCounterValuesAutoDiscover struct {
func (c *Collector) buildAutoDiscover() error {
var err error

c.perfDataCollectorAutoDiscover, err = pdh.NewCollector[perfDataCounterValuesAutoDiscover]("MSExchange Autodiscover", pdh.InstancesAll)
c.perfDataCollectorAutoDiscover, err = pdh.NewCollector[perfDataCounterValuesAutoDiscover](pdh.CounterTypeRaw, "MSExchange Autodiscover", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange Autodiscover collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type perfDataCounterValuesAvailabilityService struct {
func (c *Collector) buildAvailabilityService() error {
var err error

c.perfDataCollectorAvailabilityService, err = pdh.NewCollector[perfDataCounterValuesAvailabilityService]("MSExchange Availability Service", pdh.InstancesAll)
c.perfDataCollectorAvailabilityService, err = pdh.NewCollector[perfDataCounterValuesAvailabilityService](pdh.CounterTypeRaw, "MSExchange Availability Service", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange Availability Service collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/exchange/exchange_http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type perfDataCounterValuesHTTPProxy struct {
func (c *Collector) buildHTTPProxy() error {
var err error

c.perfDataCollectorHTTPProxy, err = pdh.NewCollector[perfDataCounterValuesHTTPProxy]("MSExchange HttpProxy", pdh.InstancesAll)
c.perfDataCollectorHTTPProxy, err = pdh.NewCollector[perfDataCounterValuesHTTPProxy](pdh.CounterTypeRaw, "MSExchange HttpProxy", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange HttpProxy collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/exchange/exchange_mapi_http_emsmdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type perfDataCounterValuesMapiHttpEmsmdb struct {
func (c *Collector) buildMapiHttpEmsmdb() error {
var err error

c.perfDataCollectorMapiHttpEmsmdb, err = pdh.NewCollector[perfDataCounterValuesMapiHttpEmsmdb]("MSExchange MapiHttp Emsmdb", pdh.InstancesAll)
c.perfDataCollectorMapiHttpEmsmdb, err = pdh.NewCollector[perfDataCounterValuesMapiHttpEmsmdb](pdh.CounterTypeRaw, "MSExchange MapiHttp Emsmdb", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange MapiHttp Emsmdb: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/exchange/exchange_outlook_web_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type perfDataCounterValuesOWA struct {
func (c *Collector) buildOWA() error {
var err error

c.perfDataCollectorOWA, err = pdh.NewCollector[perfDataCounterValuesOWA]("MSExchange OWA", pdh.InstancesAll)
c.perfDataCollectorOWA, err = pdh.NewCollector[perfDataCounterValuesOWA](pdh.CounterTypeRaw, "MSExchange OWA", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange OWA collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/exchange/exchange_rpc_client_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type perfDataCounterValuesRpcClientAccess struct {
func (c *Collector) buildRpcClientAccess() error {
var err error

c.perfDataCollectorRpcClientAccess, err = pdh.NewCollector[perfDataCounterValuesRpcClientAccess]("MSExchange RpcClientAccess", pdh.InstancesAll)
c.perfDataCollectorRpcClientAccess, err = pdh.NewCollector[perfDataCounterValuesRpcClientAccess](pdh.CounterTypeRaw, "MSExchange RpcClientAccess", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange RpcClientAccess collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/exchange/exchange_transport_queues.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type perfDataCounterValuesTransportQueues struct {
func (c *Collector) buildTransportQueues() error {
var err error

c.perfDataCollectorTransportQueues, err = pdh.NewCollector[perfDataCounterValuesTransportQueues]("MSExchangeTransport Queues", pdh.InstancesAll)
c.perfDataCollectorTransportQueues, err = pdh.NewCollector[perfDataCounterValuesTransportQueues](pdh.CounterTypeRaw, "MSExchangeTransport Queues", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchangeTransport Queues collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type perfDataCounterValuesWorkloadManagementWorkloads struct {
func (c *Collector) buildWorkloadManagementWorkloads() error {
var err error

c.perfDataCollectorWorkloadManagementWorkloads, err = pdh.NewCollector[perfDataCounterValuesWorkloadManagementWorkloads]("MSExchange WorkloadManagement Workloads", pdh.InstancesAll)
c.perfDataCollectorWorkloadManagementWorkloads, err = pdh.NewCollector[perfDataCounterValuesWorkloadManagementWorkloads](pdh.CounterTypeRaw, "MSExchange WorkloadManagement Workloads", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create MSExchange WorkloadManagement Workloads collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/hyperv/hyperv_datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type perfDataCounterValuesDataStore struct {
func (c *Collector) buildDataStore() error {
var err error

c.perfDataCollectorDataStore, err = pdh.NewCollector[perfDataCounterValuesDataStore]("Hyper-V DataStore", pdh.InstancesAll)
c.perfDataCollectorDataStore, err = pdh.NewCollector[perfDataCounterValuesDataStore](pdh.CounterTypeRaw, "Hyper-V DataStore", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Hyper-V DataStore collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (c *Collector) buildDynamicMemoryBalancer() error {
var err error

// https://learn.microsoft.com/en-us/archive/blogs/chrisavis/monitoring-dynamic-memory-in-windows-server-hyper-v-2012
c.perfDataCollectorDynamicMemoryBalancer, err = pdh.NewCollector[perfDataCounterValuesDynamicMemoryBalancer]("Hyper-V Dynamic Memory Balancer", pdh.InstancesAll)
c.perfDataCollectorDynamicMemoryBalancer, err = pdh.NewCollector[perfDataCounterValuesDynamicMemoryBalancer](pdh.CounterTypeRaw, "Hyper-V Dynamic Memory Balancer", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Hyper-V Virtual Machine Health Summary collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/hyperv/hyperv_dynamic_memory_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type perfDataCounterValuesDynamicMemoryVM struct {
func (c *Collector) buildDynamicMemoryVM() error {
var err error

c.perfDataCollectorDynamicMemoryVM, err = pdh.NewCollector[perfDataCounterValuesDynamicMemoryVM]("Hyper-V Dynamic Memory VM", pdh.InstancesAll)
c.perfDataCollectorDynamicMemoryVM, err = pdh.NewCollector[perfDataCounterValuesDynamicMemoryVM](pdh.CounterTypeRaw, "Hyper-V Dynamic Memory VM", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Hyper-V Dynamic Memory VM collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type perfDataCounterValuesHypervisorLogicalProcessor struct {
func (c *Collector) buildHypervisorLogicalProcessor() error {
var err error

c.perfDataCollectorHypervisorLogicalProcessor, err = pdh.NewCollector[perfDataCounterValuesHypervisorLogicalProcessor]("Hyper-V Hypervisor Logical Processor", pdh.InstancesAll)
c.perfDataCollectorHypervisorLogicalProcessor, err = pdh.NewCollector[perfDataCounterValuesHypervisorLogicalProcessor](pdh.CounterTypeRaw, "Hyper-V Hypervisor Logical Processor", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Hyper-V Hypervisor Logical Processor collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type perfDataCounterValuesHypervisorRootPartition struct {
func (c *Collector) buildHypervisorRootPartition() error {
var err error

c.perfDataCollectorHypervisorRootPartition, err = pdh.NewCollector[perfDataCounterValuesHypervisorRootPartition]("Hyper-V Hypervisor Root Partition", []string{"Root"})
c.perfDataCollectorHypervisorRootPartition, err = pdh.NewCollector[perfDataCounterValuesHypervisorRootPartition](pdh.CounterTypeRaw, "Hyper-V Hypervisor Root Partition", []string{"Root"})
if err != nil {
return fmt.Errorf("failed to create Hyper-V Hypervisor Root Partition collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type perfDataCounterValuesHypervisorRootVirtualProcessor struct {
func (c *Collector) buildHypervisorRootVirtualProcessor() error {
var err error

c.perfDataCollectorHypervisorRootVirtualProcessor, err = pdh.NewCollector[perfDataCounterValuesHypervisorRootVirtualProcessor]("Hyper-V Hypervisor Root Virtual Processor", pdh.InstancesAll)
c.perfDataCollectorHypervisorRootVirtualProcessor, err = pdh.NewCollector[perfDataCounterValuesHypervisorRootVirtualProcessor](pdh.CounterTypeRaw, "Hyper-V Hypervisor Root Virtual Processor", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Hyper-V Hypervisor Root Virtual Processor collector: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type perfDataCounterValuesHypervisorVirtualProcessor struct {
func (c *Collector) buildHypervisorVirtualProcessor() error {
var err error

c.perfDataCollectorHypervisorVirtualProcessor, err = pdh.NewCollector[perfDataCounterValuesHypervisorVirtualProcessor]("Hyper-V Hypervisor Virtual Processor", pdh.InstancesAll)
c.perfDataCollectorHypervisorVirtualProcessor, err = pdh.NewCollector[perfDataCounterValuesHypervisorVirtualProcessor](pdh.CounterTypeRaw, "Hyper-V Hypervisor Virtual Processor", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Hyper-V Hypervisor Virtual Processor collector: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/hyperv/hyperv_legacy_network_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type perfDataCounterValuesLegacyNetworkAdapter struct {
func (c *Collector) buildLegacyNetworkAdapter() error {
var err error

c.perfDataCollectorLegacyNetworkAdapter, err = pdh.NewCollector[perfDataCounterValuesLegacyNetworkAdapter]("Hyper-V Legacy Network Adapter", pdh.InstancesAll)
c.perfDataCollectorLegacyNetworkAdapter, err = pdh.NewCollector[perfDataCounterValuesLegacyNetworkAdapter](pdh.CounterTypeRaw, "Hyper-V Legacy Network Adapter", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Hyper-V Legacy Network Adapter collector: %w", err)
}
Expand Down
Loading

0 comments on commit 86e6d12

Please sign in to comment.