Skip to content

hyperv: add Hyper-V Replication metrics subcollector - #2481

Draft
jkroepke with Copilot wants to merge 2 commits into
masterfrom
copilot/collect-hyperv-replication-metrics
Draft

hyperv: add Hyper-V Replication metrics subcollector#2481
jkroepke with Copilot wants to merge 2 commits into
masterfrom
copilot/collect-hyperv-replication-metrics

Conversation

Copilot AI commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

The hyperv collector had no support for Hyper-V Replication metrics, forcing users to combine performancecounter configs and custom PowerShell/textfile collectors to monitor replication health and state.

Changes

internal/mi/types.go

  • Add NamespaceRootVirtualizationV2 (root/virtualization/v2) namespace constant

internal/collector/hyperv/hyperv_replica.go (new)

New replica subcollector collecting two data sources:

Hyper-V Replica VM perf counters (per-VM labels):

Metric Type
windows_hyperv_replica_compression_efficiency gauge
windows_hyperv_replica_resynchronized_bytes_total counter
windows_hyperv_replica_network_bytes_recv_total counter
windows_hyperv_replica_network_bytes_sent_total counter
windows_hyperv_replica_average_replication_latency_seconds gauge
windows_hyperv_replica_replication_latency_seconds gauge
windows_hyperv_replica_replication_count_total counter
windows_hyperv_replica_average_replication_size_bytes gauge
windows_hyperv_replica_last_replication_size_bytes gauge

root/virtualization/v2\Msvm_ReplicationRelationship WMI (per-VM labels):

Metric Values
windows_hyperv_replica_health 0=NotApplicable, 1=Ok, 2=Warning, 3=Critical
windows_hyperv_replica_state 0=Disabled … 12=TestFailoverStarted

internal/collector/hyperv/hyperv.go

  • Build now accepts and forwards miSession (was discarded with _)
  • replica subcollector registered and enabled by default in ConfigDefaults
  • collectorReplica embedded in Collector

Copilot AI linked an issue Aug 23, 2026 that may be closed by this pull request
4 tasks
- Add NamespaceRootVirtualizationV2 to internal/mi/types.go
- Create hyperv_replica.go with performance counter and WMI metrics
  for Hyper-V replication (health, state, size, latency, etc.)
- Register replica subcollector in hyperv.go Build function

Co-authored-by: jkroepke <1560587+jkroepke@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Hyper-V replication metrics collection feat(hyperv): add Hyper-V Replication metrics subcollector Aug 23, 2026
Copilot AI requested a review from jkroepke August 23, 2026 22:35
@jkroepke jkroepke changed the title feat(hyperv): add Hyper-V Replication metrics subcollector hyperv: add Hyper-V Replication metrics subcollector Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collect Hyper-V Replication Metrics

2 participants