From 60c5303f93472b211b609c55a9c1e7bbd03de975 Mon Sep 17 00:00:00 2001 From: Samiur Arif Date: Fri, 24 Jan 2025 16:50:12 -0800 Subject: [PATCH] Signed-off-by: Samiur Arif addressed previous PR comments. --- ...er-virtual-machine-preformace-metrics.yaml | 27 + receiver/vcenterreceiver/documentation.md | 51 ++ .../internal/metadata/generated_config.go | 148 ++--- .../metadata/generated_config_test.go | 278 ++++----- .../internal/metadata/generated_metrics.go | 508 +++++++++++----- .../metadata/generated_metrics_test.go | 63 ++ .../internal/metadata/testdata/config.yaml | 12 + .../responses/vm-performance-counters.xml | 358 +++++++++++ receiver/vcenterreceiver/metadata.yaml | 31 + receiver/vcenterreceiver/metrics.go | 31 + receiver/vcenterreceiver/scraper_test.go | 3 + .../metrics/expected-all-enabled.yaml | 555 ++++++++++++++++++ 12 files changed, 1712 insertions(+), 353 deletions(-) create mode 100644 .chloggen/add-more-vecenter-receiver-virtual-machine-preformace-metrics.yaml diff --git a/.chloggen/add-more-vecenter-receiver-virtual-machine-preformace-metrics.yaml b/.chloggen/add-more-vecenter-receiver-virtual-machine-preformace-metrics.yaml new file mode 100644 index 000000000000..46f56c13ca08 --- /dev/null +++ b/.chloggen/add-more-vecenter-receiver-virtual-machine-preformace-metrics.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: vcenterreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Adds six more Vcenter virtual machine performance metrics + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [37488] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/vcenterreceiver/documentation.md b/receiver/vcenterreceiver/documentation.md index 5657f5ed3531..717c5f61a9f9 100644 --- a/receiver/vcenterreceiver/documentation.md +++ b/receiver/vcenterreceiver/documentation.md @@ -820,6 +820,23 @@ Total memory capacity of the host system. | ---- | ----------- | ---------- | ----------------------- | --------- | | MiBy | Sum | Double | Cumulative | false | +### vcenter.vm.cpu.time + +CPU time spent in idle, ready or idle state. + +As measured over the most recent 20s interval. + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| % | Gauge | Double | + +#### Attributes + +| Name | Description | Values | +| ---- | ----------- | ------ | +| cpu_state | CPU time spent in idle, ready or idle state. | Str: ``idle``, ``ready``, ``wait`` | +| object | The object on the virtual machine or host that is being reported on. | Any Str | + ### vcenter.vm.memory.granted The amount of memory that is granted to a VM. @@ -828,6 +845,40 @@ The amount of memory that is granted to a VM. | ---- | ----------- | ---------- | ----------------------- | --------- | | MiBy | Sum | Int | Cumulative | false | +### vcenter.vm.network.broadcast.packet.rate + +The rate of broadcast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + +As measured over the most recent 20s interval. + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| {packets/s} | Gauge | Double | + +#### Attributes + +| Name | Description | Values | +| ---- | ----------- | ------ | +| direction | The direction of network throughput. | Str: ``transmitted``, ``received`` | +| object | The object on the virtual machine or host that is being reported on. | Any Str | + +### vcenter.vm.network.multicast.packet.rate + +The rate of multicast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + +As measured over the most recent 20s interval. + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| {packets/s} | Gauge | Double | + +#### Attributes + +| Name | Description | Values | +| ---- | ----------- | ------ | +| direction | The direction of network throughput. | Str: ``transmitted``, ``received`` | +| object | The object on the virtual machine or host that is being reported on. | Any Str | + ## Resource Attributes | Name | Description | Values | Enabled | diff --git a/receiver/vcenterreceiver/internal/metadata/generated_config.go b/receiver/vcenterreceiver/internal/metadata/generated_config.go index dd875d38847a..6e3c44034bc3 100644 --- a/receiver/vcenterreceiver/internal/metadata/generated_config.go +++ b/receiver/vcenterreceiver/internal/metadata/generated_config.go @@ -28,74 +28,77 @@ func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error { // MetricsConfig provides config for vcenter metrics. type MetricsConfig struct { - VcenterClusterCPUEffective MetricConfig `mapstructure:"vcenter.cluster.cpu.effective"` - VcenterClusterCPULimit MetricConfig `mapstructure:"vcenter.cluster.cpu.limit"` - VcenterClusterHostCount MetricConfig `mapstructure:"vcenter.cluster.host.count"` - VcenterClusterMemoryEffective MetricConfig `mapstructure:"vcenter.cluster.memory.effective"` - VcenterClusterMemoryLimit MetricConfig `mapstructure:"vcenter.cluster.memory.limit"` - VcenterClusterVMCount MetricConfig `mapstructure:"vcenter.cluster.vm.count"` - VcenterClusterVMTemplateCount MetricConfig `mapstructure:"vcenter.cluster.vm_template.count"` - VcenterClusterVsanCongestions MetricConfig `mapstructure:"vcenter.cluster.vsan.congestions"` - VcenterClusterVsanLatencyAvg MetricConfig `mapstructure:"vcenter.cluster.vsan.latency.avg"` - VcenterClusterVsanOperations MetricConfig `mapstructure:"vcenter.cluster.vsan.operations"` - VcenterClusterVsanThroughput MetricConfig `mapstructure:"vcenter.cluster.vsan.throughput"` - VcenterDatacenterClusterCount MetricConfig `mapstructure:"vcenter.datacenter.cluster.count"` - VcenterDatacenterCPULimit MetricConfig `mapstructure:"vcenter.datacenter.cpu.limit"` - VcenterDatacenterDatastoreCount MetricConfig `mapstructure:"vcenter.datacenter.datastore.count"` - VcenterDatacenterDiskSpace MetricConfig `mapstructure:"vcenter.datacenter.disk.space"` - VcenterDatacenterHostCount MetricConfig `mapstructure:"vcenter.datacenter.host.count"` - VcenterDatacenterMemoryLimit MetricConfig `mapstructure:"vcenter.datacenter.memory.limit"` - VcenterDatacenterVMCount MetricConfig `mapstructure:"vcenter.datacenter.vm.count"` - VcenterDatastoreDiskUsage MetricConfig `mapstructure:"vcenter.datastore.disk.usage"` - VcenterDatastoreDiskUtilization MetricConfig `mapstructure:"vcenter.datastore.disk.utilization"` - VcenterHostCPUCapacity MetricConfig `mapstructure:"vcenter.host.cpu.capacity"` - VcenterHostCPUReserved MetricConfig `mapstructure:"vcenter.host.cpu.reserved"` - VcenterHostCPUUsage MetricConfig `mapstructure:"vcenter.host.cpu.usage"` - VcenterHostCPUUtilization MetricConfig `mapstructure:"vcenter.host.cpu.utilization"` - VcenterHostDiskLatencyAvg MetricConfig `mapstructure:"vcenter.host.disk.latency.avg"` - VcenterHostDiskLatencyMax MetricConfig `mapstructure:"vcenter.host.disk.latency.max"` - VcenterHostDiskThroughput MetricConfig `mapstructure:"vcenter.host.disk.throughput"` - VcenterHostMemoryCapacity MetricConfig `mapstructure:"vcenter.host.memory.capacity"` - VcenterHostMemoryUsage MetricConfig `mapstructure:"vcenter.host.memory.usage"` - VcenterHostMemoryUtilization MetricConfig `mapstructure:"vcenter.host.memory.utilization"` - VcenterHostNetworkPacketDropRate MetricConfig `mapstructure:"vcenter.host.network.packet.drop.rate"` - VcenterHostNetworkPacketErrorRate MetricConfig `mapstructure:"vcenter.host.network.packet.error.rate"` - VcenterHostNetworkPacketRate MetricConfig `mapstructure:"vcenter.host.network.packet.rate"` - VcenterHostNetworkThroughput MetricConfig `mapstructure:"vcenter.host.network.throughput"` - VcenterHostNetworkUsage MetricConfig `mapstructure:"vcenter.host.network.usage"` - VcenterHostVsanCacheHitRate MetricConfig `mapstructure:"vcenter.host.vsan.cache.hit_rate"` - VcenterHostVsanCongestions MetricConfig `mapstructure:"vcenter.host.vsan.congestions"` - VcenterHostVsanLatencyAvg MetricConfig `mapstructure:"vcenter.host.vsan.latency.avg"` - VcenterHostVsanOperations MetricConfig `mapstructure:"vcenter.host.vsan.operations"` - VcenterHostVsanThroughput MetricConfig `mapstructure:"vcenter.host.vsan.throughput"` - VcenterResourcePoolCPUShares MetricConfig `mapstructure:"vcenter.resource_pool.cpu.shares"` - VcenterResourcePoolCPUUsage MetricConfig `mapstructure:"vcenter.resource_pool.cpu.usage"` - VcenterResourcePoolMemoryBallooned MetricConfig `mapstructure:"vcenter.resource_pool.memory.ballooned"` - VcenterResourcePoolMemoryGranted MetricConfig `mapstructure:"vcenter.resource_pool.memory.granted"` - VcenterResourcePoolMemoryShares MetricConfig `mapstructure:"vcenter.resource_pool.memory.shares"` - VcenterResourcePoolMemorySwapped MetricConfig `mapstructure:"vcenter.resource_pool.memory.swapped"` - VcenterResourcePoolMemoryUsage MetricConfig `mapstructure:"vcenter.resource_pool.memory.usage"` - VcenterVMCPUReadiness MetricConfig `mapstructure:"vcenter.vm.cpu.readiness"` - VcenterVMCPUUsage MetricConfig `mapstructure:"vcenter.vm.cpu.usage"` - VcenterVMCPUUtilization MetricConfig `mapstructure:"vcenter.vm.cpu.utilization"` - VcenterVMDiskLatencyAvg MetricConfig `mapstructure:"vcenter.vm.disk.latency.avg"` - VcenterVMDiskLatencyMax MetricConfig `mapstructure:"vcenter.vm.disk.latency.max"` - VcenterVMDiskThroughput MetricConfig `mapstructure:"vcenter.vm.disk.throughput"` - VcenterVMDiskUsage MetricConfig `mapstructure:"vcenter.vm.disk.usage"` - VcenterVMDiskUtilization MetricConfig `mapstructure:"vcenter.vm.disk.utilization"` - VcenterVMMemoryBallooned MetricConfig `mapstructure:"vcenter.vm.memory.ballooned"` - VcenterVMMemoryGranted MetricConfig `mapstructure:"vcenter.vm.memory.granted"` - VcenterVMMemorySwapped MetricConfig `mapstructure:"vcenter.vm.memory.swapped"` - VcenterVMMemorySwappedSsd MetricConfig `mapstructure:"vcenter.vm.memory.swapped_ssd"` - VcenterVMMemoryUsage MetricConfig `mapstructure:"vcenter.vm.memory.usage"` - VcenterVMMemoryUtilization MetricConfig `mapstructure:"vcenter.vm.memory.utilization"` - VcenterVMNetworkPacketDropRate MetricConfig `mapstructure:"vcenter.vm.network.packet.drop.rate"` - VcenterVMNetworkPacketRate MetricConfig `mapstructure:"vcenter.vm.network.packet.rate"` - VcenterVMNetworkThroughput MetricConfig `mapstructure:"vcenter.vm.network.throughput"` - VcenterVMNetworkUsage MetricConfig `mapstructure:"vcenter.vm.network.usage"` - VcenterVMVsanLatencyAvg MetricConfig `mapstructure:"vcenter.vm.vsan.latency.avg"` - VcenterVMVsanOperations MetricConfig `mapstructure:"vcenter.vm.vsan.operations"` - VcenterVMVsanThroughput MetricConfig `mapstructure:"vcenter.vm.vsan.throughput"` + VcenterClusterCPUEffective MetricConfig `mapstructure:"vcenter.cluster.cpu.effective"` + VcenterClusterCPULimit MetricConfig `mapstructure:"vcenter.cluster.cpu.limit"` + VcenterClusterHostCount MetricConfig `mapstructure:"vcenter.cluster.host.count"` + VcenterClusterMemoryEffective MetricConfig `mapstructure:"vcenter.cluster.memory.effective"` + VcenterClusterMemoryLimit MetricConfig `mapstructure:"vcenter.cluster.memory.limit"` + VcenterClusterVMCount MetricConfig `mapstructure:"vcenter.cluster.vm.count"` + VcenterClusterVMTemplateCount MetricConfig `mapstructure:"vcenter.cluster.vm_template.count"` + VcenterClusterVsanCongestions MetricConfig `mapstructure:"vcenter.cluster.vsan.congestions"` + VcenterClusterVsanLatencyAvg MetricConfig `mapstructure:"vcenter.cluster.vsan.latency.avg"` + VcenterClusterVsanOperations MetricConfig `mapstructure:"vcenter.cluster.vsan.operations"` + VcenterClusterVsanThroughput MetricConfig `mapstructure:"vcenter.cluster.vsan.throughput"` + VcenterDatacenterClusterCount MetricConfig `mapstructure:"vcenter.datacenter.cluster.count"` + VcenterDatacenterCPULimit MetricConfig `mapstructure:"vcenter.datacenter.cpu.limit"` + VcenterDatacenterDatastoreCount MetricConfig `mapstructure:"vcenter.datacenter.datastore.count"` + VcenterDatacenterDiskSpace MetricConfig `mapstructure:"vcenter.datacenter.disk.space"` + VcenterDatacenterHostCount MetricConfig `mapstructure:"vcenter.datacenter.host.count"` + VcenterDatacenterMemoryLimit MetricConfig `mapstructure:"vcenter.datacenter.memory.limit"` + VcenterDatacenterVMCount MetricConfig `mapstructure:"vcenter.datacenter.vm.count"` + VcenterDatastoreDiskUsage MetricConfig `mapstructure:"vcenter.datastore.disk.usage"` + VcenterDatastoreDiskUtilization MetricConfig `mapstructure:"vcenter.datastore.disk.utilization"` + VcenterHostCPUCapacity MetricConfig `mapstructure:"vcenter.host.cpu.capacity"` + VcenterHostCPUReserved MetricConfig `mapstructure:"vcenter.host.cpu.reserved"` + VcenterHostCPUUsage MetricConfig `mapstructure:"vcenter.host.cpu.usage"` + VcenterHostCPUUtilization MetricConfig `mapstructure:"vcenter.host.cpu.utilization"` + VcenterHostDiskLatencyAvg MetricConfig `mapstructure:"vcenter.host.disk.latency.avg"` + VcenterHostDiskLatencyMax MetricConfig `mapstructure:"vcenter.host.disk.latency.max"` + VcenterHostDiskThroughput MetricConfig `mapstructure:"vcenter.host.disk.throughput"` + VcenterHostMemoryCapacity MetricConfig `mapstructure:"vcenter.host.memory.capacity"` + VcenterHostMemoryUsage MetricConfig `mapstructure:"vcenter.host.memory.usage"` + VcenterHostMemoryUtilization MetricConfig `mapstructure:"vcenter.host.memory.utilization"` + VcenterHostNetworkPacketDropRate MetricConfig `mapstructure:"vcenter.host.network.packet.drop.rate"` + VcenterHostNetworkPacketErrorRate MetricConfig `mapstructure:"vcenter.host.network.packet.error.rate"` + VcenterHostNetworkPacketRate MetricConfig `mapstructure:"vcenter.host.network.packet.rate"` + VcenterHostNetworkThroughput MetricConfig `mapstructure:"vcenter.host.network.throughput"` + VcenterHostNetworkUsage MetricConfig `mapstructure:"vcenter.host.network.usage"` + VcenterHostVsanCacheHitRate MetricConfig `mapstructure:"vcenter.host.vsan.cache.hit_rate"` + VcenterHostVsanCongestions MetricConfig `mapstructure:"vcenter.host.vsan.congestions"` + VcenterHostVsanLatencyAvg MetricConfig `mapstructure:"vcenter.host.vsan.latency.avg"` + VcenterHostVsanOperations MetricConfig `mapstructure:"vcenter.host.vsan.operations"` + VcenterHostVsanThroughput MetricConfig `mapstructure:"vcenter.host.vsan.throughput"` + VcenterResourcePoolCPUShares MetricConfig `mapstructure:"vcenter.resource_pool.cpu.shares"` + VcenterResourcePoolCPUUsage MetricConfig `mapstructure:"vcenter.resource_pool.cpu.usage"` + VcenterResourcePoolMemoryBallooned MetricConfig `mapstructure:"vcenter.resource_pool.memory.ballooned"` + VcenterResourcePoolMemoryGranted MetricConfig `mapstructure:"vcenter.resource_pool.memory.granted"` + VcenterResourcePoolMemoryShares MetricConfig `mapstructure:"vcenter.resource_pool.memory.shares"` + VcenterResourcePoolMemorySwapped MetricConfig `mapstructure:"vcenter.resource_pool.memory.swapped"` + VcenterResourcePoolMemoryUsage MetricConfig `mapstructure:"vcenter.resource_pool.memory.usage"` + VcenterVMCPUReadiness MetricConfig `mapstructure:"vcenter.vm.cpu.readiness"` + VcenterVMCPUTime MetricConfig `mapstructure:"vcenter.vm.cpu.time"` + VcenterVMCPUUsage MetricConfig `mapstructure:"vcenter.vm.cpu.usage"` + VcenterVMCPUUtilization MetricConfig `mapstructure:"vcenter.vm.cpu.utilization"` + VcenterVMDiskLatencyAvg MetricConfig `mapstructure:"vcenter.vm.disk.latency.avg"` + VcenterVMDiskLatencyMax MetricConfig `mapstructure:"vcenter.vm.disk.latency.max"` + VcenterVMDiskThroughput MetricConfig `mapstructure:"vcenter.vm.disk.throughput"` + VcenterVMDiskUsage MetricConfig `mapstructure:"vcenter.vm.disk.usage"` + VcenterVMDiskUtilization MetricConfig `mapstructure:"vcenter.vm.disk.utilization"` + VcenterVMMemoryBallooned MetricConfig `mapstructure:"vcenter.vm.memory.ballooned"` + VcenterVMMemoryGranted MetricConfig `mapstructure:"vcenter.vm.memory.granted"` + VcenterVMMemorySwapped MetricConfig `mapstructure:"vcenter.vm.memory.swapped"` + VcenterVMMemorySwappedSsd MetricConfig `mapstructure:"vcenter.vm.memory.swapped_ssd"` + VcenterVMMemoryUsage MetricConfig `mapstructure:"vcenter.vm.memory.usage"` + VcenterVMMemoryUtilization MetricConfig `mapstructure:"vcenter.vm.memory.utilization"` + VcenterVMNetworkBroadcastPacketRate MetricConfig `mapstructure:"vcenter.vm.network.broadcast.packet.rate"` + VcenterVMNetworkMulticastPacketRate MetricConfig `mapstructure:"vcenter.vm.network.multicast.packet.rate"` + VcenterVMNetworkPacketDropRate MetricConfig `mapstructure:"vcenter.vm.network.packet.drop.rate"` + VcenterVMNetworkPacketRate MetricConfig `mapstructure:"vcenter.vm.network.packet.rate"` + VcenterVMNetworkThroughput MetricConfig `mapstructure:"vcenter.vm.network.throughput"` + VcenterVMNetworkUsage MetricConfig `mapstructure:"vcenter.vm.network.usage"` + VcenterVMVsanLatencyAvg MetricConfig `mapstructure:"vcenter.vm.vsan.latency.avg"` + VcenterVMVsanOperations MetricConfig `mapstructure:"vcenter.vm.vsan.operations"` + VcenterVMVsanThroughput MetricConfig `mapstructure:"vcenter.vm.vsan.throughput"` } func DefaultMetricsConfig() MetricsConfig { @@ -244,6 +247,9 @@ func DefaultMetricsConfig() MetricsConfig { VcenterVMCPUReadiness: MetricConfig{ Enabled: true, }, + VcenterVMCPUTime: MetricConfig{ + Enabled: false, + }, VcenterVMCPUUsage: MetricConfig{ Enabled: true, }, @@ -283,6 +289,12 @@ func DefaultMetricsConfig() MetricsConfig { VcenterVMMemoryUtilization: MetricConfig{ Enabled: true, }, + VcenterVMNetworkBroadcastPacketRate: MetricConfig{ + Enabled: false, + }, + VcenterVMNetworkMulticastPacketRate: MetricConfig{ + Enabled: false, + }, VcenterVMNetworkPacketDropRate: MetricConfig{ Enabled: true, }, diff --git a/receiver/vcenterreceiver/internal/metadata/generated_config_test.go b/receiver/vcenterreceiver/internal/metadata/generated_config_test.go index 66cf8d162b10..29efab844d01 100644 --- a/receiver/vcenterreceiver/internal/metadata/generated_config_test.go +++ b/receiver/vcenterreceiver/internal/metadata/generated_config_test.go @@ -25,74 +25,77 @@ func TestMetricsBuilderConfig(t *testing.T) { name: "all_set", want: MetricsBuilderConfig{ Metrics: MetricsConfig{ - VcenterClusterCPUEffective: MetricConfig{Enabled: true}, - VcenterClusterCPULimit: MetricConfig{Enabled: true}, - VcenterClusterHostCount: MetricConfig{Enabled: true}, - VcenterClusterMemoryEffective: MetricConfig{Enabled: true}, - VcenterClusterMemoryLimit: MetricConfig{Enabled: true}, - VcenterClusterVMCount: MetricConfig{Enabled: true}, - VcenterClusterVMTemplateCount: MetricConfig{Enabled: true}, - VcenterClusterVsanCongestions: MetricConfig{Enabled: true}, - VcenterClusterVsanLatencyAvg: MetricConfig{Enabled: true}, - VcenterClusterVsanOperations: MetricConfig{Enabled: true}, - VcenterClusterVsanThroughput: MetricConfig{Enabled: true}, - VcenterDatacenterClusterCount: MetricConfig{Enabled: true}, - VcenterDatacenterCPULimit: MetricConfig{Enabled: true}, - VcenterDatacenterDatastoreCount: MetricConfig{Enabled: true}, - VcenterDatacenterDiskSpace: MetricConfig{Enabled: true}, - VcenterDatacenterHostCount: MetricConfig{Enabled: true}, - VcenterDatacenterMemoryLimit: MetricConfig{Enabled: true}, - VcenterDatacenterVMCount: MetricConfig{Enabled: true}, - VcenterDatastoreDiskUsage: MetricConfig{Enabled: true}, - VcenterDatastoreDiskUtilization: MetricConfig{Enabled: true}, - VcenterHostCPUCapacity: MetricConfig{Enabled: true}, - VcenterHostCPUReserved: MetricConfig{Enabled: true}, - VcenterHostCPUUsage: MetricConfig{Enabled: true}, - VcenterHostCPUUtilization: MetricConfig{Enabled: true}, - VcenterHostDiskLatencyAvg: MetricConfig{Enabled: true}, - VcenterHostDiskLatencyMax: MetricConfig{Enabled: true}, - VcenterHostDiskThroughput: MetricConfig{Enabled: true}, - VcenterHostMemoryCapacity: MetricConfig{Enabled: true}, - VcenterHostMemoryUsage: MetricConfig{Enabled: true}, - VcenterHostMemoryUtilization: MetricConfig{Enabled: true}, - VcenterHostNetworkPacketDropRate: MetricConfig{Enabled: true}, - VcenterHostNetworkPacketErrorRate: MetricConfig{Enabled: true}, - VcenterHostNetworkPacketRate: MetricConfig{Enabled: true}, - VcenterHostNetworkThroughput: MetricConfig{Enabled: true}, - VcenterHostNetworkUsage: MetricConfig{Enabled: true}, - VcenterHostVsanCacheHitRate: MetricConfig{Enabled: true}, - VcenterHostVsanCongestions: MetricConfig{Enabled: true}, - VcenterHostVsanLatencyAvg: MetricConfig{Enabled: true}, - VcenterHostVsanOperations: MetricConfig{Enabled: true}, - VcenterHostVsanThroughput: MetricConfig{Enabled: true}, - VcenterResourcePoolCPUShares: MetricConfig{Enabled: true}, - VcenterResourcePoolCPUUsage: MetricConfig{Enabled: true}, - VcenterResourcePoolMemoryBallooned: MetricConfig{Enabled: true}, - VcenterResourcePoolMemoryGranted: MetricConfig{Enabled: true}, - VcenterResourcePoolMemoryShares: MetricConfig{Enabled: true}, - VcenterResourcePoolMemorySwapped: MetricConfig{Enabled: true}, - VcenterResourcePoolMemoryUsage: MetricConfig{Enabled: true}, - VcenterVMCPUReadiness: MetricConfig{Enabled: true}, - VcenterVMCPUUsage: MetricConfig{Enabled: true}, - VcenterVMCPUUtilization: MetricConfig{Enabled: true}, - VcenterVMDiskLatencyAvg: MetricConfig{Enabled: true}, - VcenterVMDiskLatencyMax: MetricConfig{Enabled: true}, - VcenterVMDiskThroughput: MetricConfig{Enabled: true}, - VcenterVMDiskUsage: MetricConfig{Enabled: true}, - VcenterVMDiskUtilization: MetricConfig{Enabled: true}, - VcenterVMMemoryBallooned: MetricConfig{Enabled: true}, - VcenterVMMemoryGranted: MetricConfig{Enabled: true}, - VcenterVMMemorySwapped: MetricConfig{Enabled: true}, - VcenterVMMemorySwappedSsd: MetricConfig{Enabled: true}, - VcenterVMMemoryUsage: MetricConfig{Enabled: true}, - VcenterVMMemoryUtilization: MetricConfig{Enabled: true}, - VcenterVMNetworkPacketDropRate: MetricConfig{Enabled: true}, - VcenterVMNetworkPacketRate: MetricConfig{Enabled: true}, - VcenterVMNetworkThroughput: MetricConfig{Enabled: true}, - VcenterVMNetworkUsage: MetricConfig{Enabled: true}, - VcenterVMVsanLatencyAvg: MetricConfig{Enabled: true}, - VcenterVMVsanOperations: MetricConfig{Enabled: true}, - VcenterVMVsanThroughput: MetricConfig{Enabled: true}, + VcenterClusterCPUEffective: MetricConfig{Enabled: true}, + VcenterClusterCPULimit: MetricConfig{Enabled: true}, + VcenterClusterHostCount: MetricConfig{Enabled: true}, + VcenterClusterMemoryEffective: MetricConfig{Enabled: true}, + VcenterClusterMemoryLimit: MetricConfig{Enabled: true}, + VcenterClusterVMCount: MetricConfig{Enabled: true}, + VcenterClusterVMTemplateCount: MetricConfig{Enabled: true}, + VcenterClusterVsanCongestions: MetricConfig{Enabled: true}, + VcenterClusterVsanLatencyAvg: MetricConfig{Enabled: true}, + VcenterClusterVsanOperations: MetricConfig{Enabled: true}, + VcenterClusterVsanThroughput: MetricConfig{Enabled: true}, + VcenterDatacenterClusterCount: MetricConfig{Enabled: true}, + VcenterDatacenterCPULimit: MetricConfig{Enabled: true}, + VcenterDatacenterDatastoreCount: MetricConfig{Enabled: true}, + VcenterDatacenterDiskSpace: MetricConfig{Enabled: true}, + VcenterDatacenterHostCount: MetricConfig{Enabled: true}, + VcenterDatacenterMemoryLimit: MetricConfig{Enabled: true}, + VcenterDatacenterVMCount: MetricConfig{Enabled: true}, + VcenterDatastoreDiskUsage: MetricConfig{Enabled: true}, + VcenterDatastoreDiskUtilization: MetricConfig{Enabled: true}, + VcenterHostCPUCapacity: MetricConfig{Enabled: true}, + VcenterHostCPUReserved: MetricConfig{Enabled: true}, + VcenterHostCPUUsage: MetricConfig{Enabled: true}, + VcenterHostCPUUtilization: MetricConfig{Enabled: true}, + VcenterHostDiskLatencyAvg: MetricConfig{Enabled: true}, + VcenterHostDiskLatencyMax: MetricConfig{Enabled: true}, + VcenterHostDiskThroughput: MetricConfig{Enabled: true}, + VcenterHostMemoryCapacity: MetricConfig{Enabled: true}, + VcenterHostMemoryUsage: MetricConfig{Enabled: true}, + VcenterHostMemoryUtilization: MetricConfig{Enabled: true}, + VcenterHostNetworkPacketDropRate: MetricConfig{Enabled: true}, + VcenterHostNetworkPacketErrorRate: MetricConfig{Enabled: true}, + VcenterHostNetworkPacketRate: MetricConfig{Enabled: true}, + VcenterHostNetworkThroughput: MetricConfig{Enabled: true}, + VcenterHostNetworkUsage: MetricConfig{Enabled: true}, + VcenterHostVsanCacheHitRate: MetricConfig{Enabled: true}, + VcenterHostVsanCongestions: MetricConfig{Enabled: true}, + VcenterHostVsanLatencyAvg: MetricConfig{Enabled: true}, + VcenterHostVsanOperations: MetricConfig{Enabled: true}, + VcenterHostVsanThroughput: MetricConfig{Enabled: true}, + VcenterResourcePoolCPUShares: MetricConfig{Enabled: true}, + VcenterResourcePoolCPUUsage: MetricConfig{Enabled: true}, + VcenterResourcePoolMemoryBallooned: MetricConfig{Enabled: true}, + VcenterResourcePoolMemoryGranted: MetricConfig{Enabled: true}, + VcenterResourcePoolMemoryShares: MetricConfig{Enabled: true}, + VcenterResourcePoolMemorySwapped: MetricConfig{Enabled: true}, + VcenterResourcePoolMemoryUsage: MetricConfig{Enabled: true}, + VcenterVMCPUReadiness: MetricConfig{Enabled: true}, + VcenterVMCPUTime: MetricConfig{Enabled: true}, + VcenterVMCPUUsage: MetricConfig{Enabled: true}, + VcenterVMCPUUtilization: MetricConfig{Enabled: true}, + VcenterVMDiskLatencyAvg: MetricConfig{Enabled: true}, + VcenterVMDiskLatencyMax: MetricConfig{Enabled: true}, + VcenterVMDiskThroughput: MetricConfig{Enabled: true}, + VcenterVMDiskUsage: MetricConfig{Enabled: true}, + VcenterVMDiskUtilization: MetricConfig{Enabled: true}, + VcenterVMMemoryBallooned: MetricConfig{Enabled: true}, + VcenterVMMemoryGranted: MetricConfig{Enabled: true}, + VcenterVMMemorySwapped: MetricConfig{Enabled: true}, + VcenterVMMemorySwappedSsd: MetricConfig{Enabled: true}, + VcenterVMMemoryUsage: MetricConfig{Enabled: true}, + VcenterVMMemoryUtilization: MetricConfig{Enabled: true}, + VcenterVMNetworkBroadcastPacketRate: MetricConfig{Enabled: true}, + VcenterVMNetworkMulticastPacketRate: MetricConfig{Enabled: true}, + VcenterVMNetworkPacketDropRate: MetricConfig{Enabled: true}, + VcenterVMNetworkPacketRate: MetricConfig{Enabled: true}, + VcenterVMNetworkThroughput: MetricConfig{Enabled: true}, + VcenterVMNetworkUsage: MetricConfig{Enabled: true}, + VcenterVMVsanLatencyAvg: MetricConfig{Enabled: true}, + VcenterVMVsanOperations: MetricConfig{Enabled: true}, + VcenterVMVsanThroughput: MetricConfig{Enabled: true}, }, ResourceAttributes: ResourceAttributesConfig{ VcenterClusterName: ResourceAttributeConfig{Enabled: true}, @@ -114,74 +117,77 @@ func TestMetricsBuilderConfig(t *testing.T) { name: "none_set", want: MetricsBuilderConfig{ Metrics: MetricsConfig{ - VcenterClusterCPUEffective: MetricConfig{Enabled: false}, - VcenterClusterCPULimit: MetricConfig{Enabled: false}, - VcenterClusterHostCount: MetricConfig{Enabled: false}, - VcenterClusterMemoryEffective: MetricConfig{Enabled: false}, - VcenterClusterMemoryLimit: MetricConfig{Enabled: false}, - VcenterClusterVMCount: MetricConfig{Enabled: false}, - VcenterClusterVMTemplateCount: MetricConfig{Enabled: false}, - VcenterClusterVsanCongestions: MetricConfig{Enabled: false}, - VcenterClusterVsanLatencyAvg: MetricConfig{Enabled: false}, - VcenterClusterVsanOperations: MetricConfig{Enabled: false}, - VcenterClusterVsanThroughput: MetricConfig{Enabled: false}, - VcenterDatacenterClusterCount: MetricConfig{Enabled: false}, - VcenterDatacenterCPULimit: MetricConfig{Enabled: false}, - VcenterDatacenterDatastoreCount: MetricConfig{Enabled: false}, - VcenterDatacenterDiskSpace: MetricConfig{Enabled: false}, - VcenterDatacenterHostCount: MetricConfig{Enabled: false}, - VcenterDatacenterMemoryLimit: MetricConfig{Enabled: false}, - VcenterDatacenterVMCount: MetricConfig{Enabled: false}, - VcenterDatastoreDiskUsage: MetricConfig{Enabled: false}, - VcenterDatastoreDiskUtilization: MetricConfig{Enabled: false}, - VcenterHostCPUCapacity: MetricConfig{Enabled: false}, - VcenterHostCPUReserved: MetricConfig{Enabled: false}, - VcenterHostCPUUsage: MetricConfig{Enabled: false}, - VcenterHostCPUUtilization: MetricConfig{Enabled: false}, - VcenterHostDiskLatencyAvg: MetricConfig{Enabled: false}, - VcenterHostDiskLatencyMax: MetricConfig{Enabled: false}, - VcenterHostDiskThroughput: MetricConfig{Enabled: false}, - VcenterHostMemoryCapacity: MetricConfig{Enabled: false}, - VcenterHostMemoryUsage: MetricConfig{Enabled: false}, - VcenterHostMemoryUtilization: MetricConfig{Enabled: false}, - VcenterHostNetworkPacketDropRate: MetricConfig{Enabled: false}, - VcenterHostNetworkPacketErrorRate: MetricConfig{Enabled: false}, - VcenterHostNetworkPacketRate: MetricConfig{Enabled: false}, - VcenterHostNetworkThroughput: MetricConfig{Enabled: false}, - VcenterHostNetworkUsage: MetricConfig{Enabled: false}, - VcenterHostVsanCacheHitRate: MetricConfig{Enabled: false}, - VcenterHostVsanCongestions: MetricConfig{Enabled: false}, - VcenterHostVsanLatencyAvg: MetricConfig{Enabled: false}, - VcenterHostVsanOperations: MetricConfig{Enabled: false}, - VcenterHostVsanThroughput: MetricConfig{Enabled: false}, - VcenterResourcePoolCPUShares: MetricConfig{Enabled: false}, - VcenterResourcePoolCPUUsage: MetricConfig{Enabled: false}, - VcenterResourcePoolMemoryBallooned: MetricConfig{Enabled: false}, - VcenterResourcePoolMemoryGranted: MetricConfig{Enabled: false}, - VcenterResourcePoolMemoryShares: MetricConfig{Enabled: false}, - VcenterResourcePoolMemorySwapped: MetricConfig{Enabled: false}, - VcenterResourcePoolMemoryUsage: MetricConfig{Enabled: false}, - VcenterVMCPUReadiness: MetricConfig{Enabled: false}, - VcenterVMCPUUsage: MetricConfig{Enabled: false}, - VcenterVMCPUUtilization: MetricConfig{Enabled: false}, - VcenterVMDiskLatencyAvg: MetricConfig{Enabled: false}, - VcenterVMDiskLatencyMax: MetricConfig{Enabled: false}, - VcenterVMDiskThroughput: MetricConfig{Enabled: false}, - VcenterVMDiskUsage: MetricConfig{Enabled: false}, - VcenterVMDiskUtilization: MetricConfig{Enabled: false}, - VcenterVMMemoryBallooned: MetricConfig{Enabled: false}, - VcenterVMMemoryGranted: MetricConfig{Enabled: false}, - VcenterVMMemorySwapped: MetricConfig{Enabled: false}, - VcenterVMMemorySwappedSsd: MetricConfig{Enabled: false}, - VcenterVMMemoryUsage: MetricConfig{Enabled: false}, - VcenterVMMemoryUtilization: MetricConfig{Enabled: false}, - VcenterVMNetworkPacketDropRate: MetricConfig{Enabled: false}, - VcenterVMNetworkPacketRate: MetricConfig{Enabled: false}, - VcenterVMNetworkThroughput: MetricConfig{Enabled: false}, - VcenterVMNetworkUsage: MetricConfig{Enabled: false}, - VcenterVMVsanLatencyAvg: MetricConfig{Enabled: false}, - VcenterVMVsanOperations: MetricConfig{Enabled: false}, - VcenterVMVsanThroughput: MetricConfig{Enabled: false}, + VcenterClusterCPUEffective: MetricConfig{Enabled: false}, + VcenterClusterCPULimit: MetricConfig{Enabled: false}, + VcenterClusterHostCount: MetricConfig{Enabled: false}, + VcenterClusterMemoryEffective: MetricConfig{Enabled: false}, + VcenterClusterMemoryLimit: MetricConfig{Enabled: false}, + VcenterClusterVMCount: MetricConfig{Enabled: false}, + VcenterClusterVMTemplateCount: MetricConfig{Enabled: false}, + VcenterClusterVsanCongestions: MetricConfig{Enabled: false}, + VcenterClusterVsanLatencyAvg: MetricConfig{Enabled: false}, + VcenterClusterVsanOperations: MetricConfig{Enabled: false}, + VcenterClusterVsanThroughput: MetricConfig{Enabled: false}, + VcenterDatacenterClusterCount: MetricConfig{Enabled: false}, + VcenterDatacenterCPULimit: MetricConfig{Enabled: false}, + VcenterDatacenterDatastoreCount: MetricConfig{Enabled: false}, + VcenterDatacenterDiskSpace: MetricConfig{Enabled: false}, + VcenterDatacenterHostCount: MetricConfig{Enabled: false}, + VcenterDatacenterMemoryLimit: MetricConfig{Enabled: false}, + VcenterDatacenterVMCount: MetricConfig{Enabled: false}, + VcenterDatastoreDiskUsage: MetricConfig{Enabled: false}, + VcenterDatastoreDiskUtilization: MetricConfig{Enabled: false}, + VcenterHostCPUCapacity: MetricConfig{Enabled: false}, + VcenterHostCPUReserved: MetricConfig{Enabled: false}, + VcenterHostCPUUsage: MetricConfig{Enabled: false}, + VcenterHostCPUUtilization: MetricConfig{Enabled: false}, + VcenterHostDiskLatencyAvg: MetricConfig{Enabled: false}, + VcenterHostDiskLatencyMax: MetricConfig{Enabled: false}, + VcenterHostDiskThroughput: MetricConfig{Enabled: false}, + VcenterHostMemoryCapacity: MetricConfig{Enabled: false}, + VcenterHostMemoryUsage: MetricConfig{Enabled: false}, + VcenterHostMemoryUtilization: MetricConfig{Enabled: false}, + VcenterHostNetworkPacketDropRate: MetricConfig{Enabled: false}, + VcenterHostNetworkPacketErrorRate: MetricConfig{Enabled: false}, + VcenterHostNetworkPacketRate: MetricConfig{Enabled: false}, + VcenterHostNetworkThroughput: MetricConfig{Enabled: false}, + VcenterHostNetworkUsage: MetricConfig{Enabled: false}, + VcenterHostVsanCacheHitRate: MetricConfig{Enabled: false}, + VcenterHostVsanCongestions: MetricConfig{Enabled: false}, + VcenterHostVsanLatencyAvg: MetricConfig{Enabled: false}, + VcenterHostVsanOperations: MetricConfig{Enabled: false}, + VcenterHostVsanThroughput: MetricConfig{Enabled: false}, + VcenterResourcePoolCPUShares: MetricConfig{Enabled: false}, + VcenterResourcePoolCPUUsage: MetricConfig{Enabled: false}, + VcenterResourcePoolMemoryBallooned: MetricConfig{Enabled: false}, + VcenterResourcePoolMemoryGranted: MetricConfig{Enabled: false}, + VcenterResourcePoolMemoryShares: MetricConfig{Enabled: false}, + VcenterResourcePoolMemorySwapped: MetricConfig{Enabled: false}, + VcenterResourcePoolMemoryUsage: MetricConfig{Enabled: false}, + VcenterVMCPUReadiness: MetricConfig{Enabled: false}, + VcenterVMCPUTime: MetricConfig{Enabled: false}, + VcenterVMCPUUsage: MetricConfig{Enabled: false}, + VcenterVMCPUUtilization: MetricConfig{Enabled: false}, + VcenterVMDiskLatencyAvg: MetricConfig{Enabled: false}, + VcenterVMDiskLatencyMax: MetricConfig{Enabled: false}, + VcenterVMDiskThroughput: MetricConfig{Enabled: false}, + VcenterVMDiskUsage: MetricConfig{Enabled: false}, + VcenterVMDiskUtilization: MetricConfig{Enabled: false}, + VcenterVMMemoryBallooned: MetricConfig{Enabled: false}, + VcenterVMMemoryGranted: MetricConfig{Enabled: false}, + VcenterVMMemorySwapped: MetricConfig{Enabled: false}, + VcenterVMMemorySwappedSsd: MetricConfig{Enabled: false}, + VcenterVMMemoryUsage: MetricConfig{Enabled: false}, + VcenterVMMemoryUtilization: MetricConfig{Enabled: false}, + VcenterVMNetworkBroadcastPacketRate: MetricConfig{Enabled: false}, + VcenterVMNetworkMulticastPacketRate: MetricConfig{Enabled: false}, + VcenterVMNetworkPacketDropRate: MetricConfig{Enabled: false}, + VcenterVMNetworkPacketRate: MetricConfig{Enabled: false}, + VcenterVMNetworkThroughput: MetricConfig{Enabled: false}, + VcenterVMNetworkUsage: MetricConfig{Enabled: false}, + VcenterVMVsanLatencyAvg: MetricConfig{Enabled: false}, + VcenterVMVsanOperations: MetricConfig{Enabled: false}, + VcenterVMVsanThroughput: MetricConfig{Enabled: false}, }, ResourceAttributes: ResourceAttributesConfig{ VcenterClusterName: ResourceAttributeConfig{Enabled: false}, diff --git a/receiver/vcenterreceiver/internal/metadata/generated_metrics.go b/receiver/vcenterreceiver/internal/metadata/generated_metrics.go index 3a31d62572d8..bdff77538f84 100644 --- a/receiver/vcenterreceiver/internal/metadata/generated_metrics.go +++ b/receiver/vcenterreceiver/internal/metadata/generated_metrics.go @@ -38,6 +38,36 @@ var MapAttributeCPUReservationType = map[string]AttributeCPUReservationType{ "used": AttributeCPUReservationTypeUsed, } +// AttributeCPUState specifies the value cpu_state attribute. +type AttributeCPUState int + +const ( + _ AttributeCPUState = iota + AttributeCPUStateIdle + AttributeCPUStateReady + AttributeCPUStateWait +) + +// String returns the string representation of the AttributeCPUState. +func (av AttributeCPUState) String() string { + switch av { + case AttributeCPUStateIdle: + return "idle" + case AttributeCPUStateReady: + return "ready" + case AttributeCPUStateWait: + return "wait" + } + return "" +} + +// MapAttributeCPUState is a helper map of string to AttributeCPUState attribute value. +var MapAttributeCPUState = map[string]AttributeCPUState{ + "idle": AttributeCPUStateIdle, + "ready": AttributeCPUStateReady, + "wait": AttributeCPUStateWait, +} + // AttributeDiskDirection specifies the value disk_direction attribute. type AttributeDiskDirection int @@ -2850,6 +2880,58 @@ func newMetricVcenterVMCPUReadiness(cfg MetricConfig) metricVcenterVMCPUReadines return m } +type metricVcenterVMCPUTime struct { + data pmetric.Metric // data buffer for generated metric. + config MetricConfig // metric config provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills vcenter.vm.cpu.time metric with initial data. +func (m *metricVcenterVMCPUTime) init() { + m.data.SetName("vcenter.vm.cpu.time") + m.data.SetDescription("CPU time spent in idle, ready or idle state.") + m.data.SetUnit("%") + m.data.SetEmptyGauge() + m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricVcenterVMCPUTime) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, cpuStateAttributeValue string, objectNameAttributeValue string) { + if !m.config.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetDoubleValue(val) + dp.Attributes().PutStr("cpu_state", cpuStateAttributeValue) + dp.Attributes().PutStr("object", objectNameAttributeValue) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricVcenterVMCPUTime) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricVcenterVMCPUTime) emit(metrics pmetric.MetricSlice) { + if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricVcenterVMCPUTime(cfg MetricConfig) metricVcenterVMCPUTime { + m := metricVcenterVMCPUTime{config: cfg} + if cfg.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + type metricVcenterVMCPUUsage struct { data pmetric.Metric // data buffer for generated metric. config MetricConfig // metric config provided by user. @@ -3512,6 +3594,110 @@ func newMetricVcenterVMMemoryUtilization(cfg MetricConfig) metricVcenterVMMemory return m } +type metricVcenterVMNetworkBroadcastPacketRate struct { + data pmetric.Metric // data buffer for generated metric. + config MetricConfig // metric config provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills vcenter.vm.network.broadcast.packet.rate metric with initial data. +func (m *metricVcenterVMNetworkBroadcastPacketRate) init() { + m.data.SetName("vcenter.vm.network.broadcast.packet.rate") + m.data.SetDescription("The rate of broadcast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine.") + m.data.SetUnit("{packets/s}") + m.data.SetEmptyGauge() + m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricVcenterVMNetworkBroadcastPacketRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, throughputDirectionAttributeValue string, objectNameAttributeValue string) { + if !m.config.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetDoubleValue(val) + dp.Attributes().PutStr("direction", throughputDirectionAttributeValue) + dp.Attributes().PutStr("object", objectNameAttributeValue) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricVcenterVMNetworkBroadcastPacketRate) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricVcenterVMNetworkBroadcastPacketRate) emit(metrics pmetric.MetricSlice) { + if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricVcenterVMNetworkBroadcastPacketRate(cfg MetricConfig) metricVcenterVMNetworkBroadcastPacketRate { + m := metricVcenterVMNetworkBroadcastPacketRate{config: cfg} + if cfg.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricVcenterVMNetworkMulticastPacketRate struct { + data pmetric.Metric // data buffer for generated metric. + config MetricConfig // metric config provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills vcenter.vm.network.multicast.packet.rate metric with initial data. +func (m *metricVcenterVMNetworkMulticastPacketRate) init() { + m.data.SetName("vcenter.vm.network.multicast.packet.rate") + m.data.SetDescription("The rate of multicast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine.") + m.data.SetUnit("{packets/s}") + m.data.SetEmptyGauge() + m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricVcenterVMNetworkMulticastPacketRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, throughputDirectionAttributeValue string, objectNameAttributeValue string) { + if !m.config.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetDoubleValue(val) + dp.Attributes().PutStr("direction", throughputDirectionAttributeValue) + dp.Attributes().PutStr("object", objectNameAttributeValue) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricVcenterVMNetworkMulticastPacketRate) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricVcenterVMNetworkMulticastPacketRate) emit(metrics pmetric.MetricSlice) { + if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricVcenterVMNetworkMulticastPacketRate(cfg MetricConfig) metricVcenterVMNetworkMulticastPacketRate { + m := metricVcenterVMNetworkMulticastPacketRate{config: cfg} + if cfg.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + type metricVcenterVMNetworkPacketDropRate struct { data pmetric.Metric // data buffer for generated metric. config MetricConfig // metric config provided by user. @@ -3879,81 +4065,84 @@ func newMetricVcenterVMVsanThroughput(cfg MetricConfig) metricVcenterVMVsanThrou // MetricsBuilder provides an interface for scrapers to report metrics while taking care of all the transformations // required to produce metric representation defined in metadata and user config. type MetricsBuilder struct { - config MetricsBuilderConfig // config of the metrics builder. - startTime pcommon.Timestamp // start time that will be applied to all recorded data points. - metricsCapacity int // maximum observed number of metrics per resource. - metricsBuffer pmetric.Metrics // accumulates metrics data before emitting. - buildInfo component.BuildInfo // contains version information. - resourceAttributeIncludeFilter map[string]filter.Filter - resourceAttributeExcludeFilter map[string]filter.Filter - metricVcenterClusterCPUEffective metricVcenterClusterCPUEffective - metricVcenterClusterCPULimit metricVcenterClusterCPULimit - metricVcenterClusterHostCount metricVcenterClusterHostCount - metricVcenterClusterMemoryEffective metricVcenterClusterMemoryEffective - metricVcenterClusterMemoryLimit metricVcenterClusterMemoryLimit - metricVcenterClusterVMCount metricVcenterClusterVMCount - metricVcenterClusterVMTemplateCount metricVcenterClusterVMTemplateCount - metricVcenterClusterVsanCongestions metricVcenterClusterVsanCongestions - metricVcenterClusterVsanLatencyAvg metricVcenterClusterVsanLatencyAvg - metricVcenterClusterVsanOperations metricVcenterClusterVsanOperations - metricVcenterClusterVsanThroughput metricVcenterClusterVsanThroughput - metricVcenterDatacenterClusterCount metricVcenterDatacenterClusterCount - metricVcenterDatacenterCPULimit metricVcenterDatacenterCPULimit - metricVcenterDatacenterDatastoreCount metricVcenterDatacenterDatastoreCount - metricVcenterDatacenterDiskSpace metricVcenterDatacenterDiskSpace - metricVcenterDatacenterHostCount metricVcenterDatacenterHostCount - metricVcenterDatacenterMemoryLimit metricVcenterDatacenterMemoryLimit - metricVcenterDatacenterVMCount metricVcenterDatacenterVMCount - metricVcenterDatastoreDiskUsage metricVcenterDatastoreDiskUsage - metricVcenterDatastoreDiskUtilization metricVcenterDatastoreDiskUtilization - metricVcenterHostCPUCapacity metricVcenterHostCPUCapacity - metricVcenterHostCPUReserved metricVcenterHostCPUReserved - metricVcenterHostCPUUsage metricVcenterHostCPUUsage - metricVcenterHostCPUUtilization metricVcenterHostCPUUtilization - metricVcenterHostDiskLatencyAvg metricVcenterHostDiskLatencyAvg - metricVcenterHostDiskLatencyMax metricVcenterHostDiskLatencyMax - metricVcenterHostDiskThroughput metricVcenterHostDiskThroughput - metricVcenterHostMemoryCapacity metricVcenterHostMemoryCapacity - metricVcenterHostMemoryUsage metricVcenterHostMemoryUsage - metricVcenterHostMemoryUtilization metricVcenterHostMemoryUtilization - metricVcenterHostNetworkPacketDropRate metricVcenterHostNetworkPacketDropRate - metricVcenterHostNetworkPacketErrorRate metricVcenterHostNetworkPacketErrorRate - metricVcenterHostNetworkPacketRate metricVcenterHostNetworkPacketRate - metricVcenterHostNetworkThroughput metricVcenterHostNetworkThroughput - metricVcenterHostNetworkUsage metricVcenterHostNetworkUsage - metricVcenterHostVsanCacheHitRate metricVcenterHostVsanCacheHitRate - metricVcenterHostVsanCongestions metricVcenterHostVsanCongestions - metricVcenterHostVsanLatencyAvg metricVcenterHostVsanLatencyAvg - metricVcenterHostVsanOperations metricVcenterHostVsanOperations - metricVcenterHostVsanThroughput metricVcenterHostVsanThroughput - metricVcenterResourcePoolCPUShares metricVcenterResourcePoolCPUShares - metricVcenterResourcePoolCPUUsage metricVcenterResourcePoolCPUUsage - metricVcenterResourcePoolMemoryBallooned metricVcenterResourcePoolMemoryBallooned - metricVcenterResourcePoolMemoryGranted metricVcenterResourcePoolMemoryGranted - metricVcenterResourcePoolMemoryShares metricVcenterResourcePoolMemoryShares - metricVcenterResourcePoolMemorySwapped metricVcenterResourcePoolMemorySwapped - metricVcenterResourcePoolMemoryUsage metricVcenterResourcePoolMemoryUsage - metricVcenterVMCPUReadiness metricVcenterVMCPUReadiness - metricVcenterVMCPUUsage metricVcenterVMCPUUsage - metricVcenterVMCPUUtilization metricVcenterVMCPUUtilization - metricVcenterVMDiskLatencyAvg metricVcenterVMDiskLatencyAvg - metricVcenterVMDiskLatencyMax metricVcenterVMDiskLatencyMax - metricVcenterVMDiskThroughput metricVcenterVMDiskThroughput - metricVcenterVMDiskUsage metricVcenterVMDiskUsage - metricVcenterVMDiskUtilization metricVcenterVMDiskUtilization - metricVcenterVMMemoryBallooned metricVcenterVMMemoryBallooned - metricVcenterVMMemoryGranted metricVcenterVMMemoryGranted - metricVcenterVMMemorySwapped metricVcenterVMMemorySwapped - metricVcenterVMMemorySwappedSsd metricVcenterVMMemorySwappedSsd - metricVcenterVMMemoryUsage metricVcenterVMMemoryUsage - metricVcenterVMMemoryUtilization metricVcenterVMMemoryUtilization - metricVcenterVMNetworkPacketDropRate metricVcenterVMNetworkPacketDropRate - metricVcenterVMNetworkPacketRate metricVcenterVMNetworkPacketRate - metricVcenterVMNetworkThroughput metricVcenterVMNetworkThroughput - metricVcenterVMNetworkUsage metricVcenterVMNetworkUsage - metricVcenterVMVsanLatencyAvg metricVcenterVMVsanLatencyAvg - metricVcenterVMVsanOperations metricVcenterVMVsanOperations - metricVcenterVMVsanThroughput metricVcenterVMVsanThroughput + config MetricsBuilderConfig // config of the metrics builder. + startTime pcommon.Timestamp // start time that will be applied to all recorded data points. + metricsCapacity int // maximum observed number of metrics per resource. + metricsBuffer pmetric.Metrics // accumulates metrics data before emitting. + buildInfo component.BuildInfo // contains version information. + resourceAttributeIncludeFilter map[string]filter.Filter + resourceAttributeExcludeFilter map[string]filter.Filter + metricVcenterClusterCPUEffective metricVcenterClusterCPUEffective + metricVcenterClusterCPULimit metricVcenterClusterCPULimit + metricVcenterClusterHostCount metricVcenterClusterHostCount + metricVcenterClusterMemoryEffective metricVcenterClusterMemoryEffective + metricVcenterClusterMemoryLimit metricVcenterClusterMemoryLimit + metricVcenterClusterVMCount metricVcenterClusterVMCount + metricVcenterClusterVMTemplateCount metricVcenterClusterVMTemplateCount + metricVcenterClusterVsanCongestions metricVcenterClusterVsanCongestions + metricVcenterClusterVsanLatencyAvg metricVcenterClusterVsanLatencyAvg + metricVcenterClusterVsanOperations metricVcenterClusterVsanOperations + metricVcenterClusterVsanThroughput metricVcenterClusterVsanThroughput + metricVcenterDatacenterClusterCount metricVcenterDatacenterClusterCount + metricVcenterDatacenterCPULimit metricVcenterDatacenterCPULimit + metricVcenterDatacenterDatastoreCount metricVcenterDatacenterDatastoreCount + metricVcenterDatacenterDiskSpace metricVcenterDatacenterDiskSpace + metricVcenterDatacenterHostCount metricVcenterDatacenterHostCount + metricVcenterDatacenterMemoryLimit metricVcenterDatacenterMemoryLimit + metricVcenterDatacenterVMCount metricVcenterDatacenterVMCount + metricVcenterDatastoreDiskUsage metricVcenterDatastoreDiskUsage + metricVcenterDatastoreDiskUtilization metricVcenterDatastoreDiskUtilization + metricVcenterHostCPUCapacity metricVcenterHostCPUCapacity + metricVcenterHostCPUReserved metricVcenterHostCPUReserved + metricVcenterHostCPUUsage metricVcenterHostCPUUsage + metricVcenterHostCPUUtilization metricVcenterHostCPUUtilization + metricVcenterHostDiskLatencyAvg metricVcenterHostDiskLatencyAvg + metricVcenterHostDiskLatencyMax metricVcenterHostDiskLatencyMax + metricVcenterHostDiskThroughput metricVcenterHostDiskThroughput + metricVcenterHostMemoryCapacity metricVcenterHostMemoryCapacity + metricVcenterHostMemoryUsage metricVcenterHostMemoryUsage + metricVcenterHostMemoryUtilization metricVcenterHostMemoryUtilization + metricVcenterHostNetworkPacketDropRate metricVcenterHostNetworkPacketDropRate + metricVcenterHostNetworkPacketErrorRate metricVcenterHostNetworkPacketErrorRate + metricVcenterHostNetworkPacketRate metricVcenterHostNetworkPacketRate + metricVcenterHostNetworkThroughput metricVcenterHostNetworkThroughput + metricVcenterHostNetworkUsage metricVcenterHostNetworkUsage + metricVcenterHostVsanCacheHitRate metricVcenterHostVsanCacheHitRate + metricVcenterHostVsanCongestions metricVcenterHostVsanCongestions + metricVcenterHostVsanLatencyAvg metricVcenterHostVsanLatencyAvg + metricVcenterHostVsanOperations metricVcenterHostVsanOperations + metricVcenterHostVsanThroughput metricVcenterHostVsanThroughput + metricVcenterResourcePoolCPUShares metricVcenterResourcePoolCPUShares + metricVcenterResourcePoolCPUUsage metricVcenterResourcePoolCPUUsage + metricVcenterResourcePoolMemoryBallooned metricVcenterResourcePoolMemoryBallooned + metricVcenterResourcePoolMemoryGranted metricVcenterResourcePoolMemoryGranted + metricVcenterResourcePoolMemoryShares metricVcenterResourcePoolMemoryShares + metricVcenterResourcePoolMemorySwapped metricVcenterResourcePoolMemorySwapped + metricVcenterResourcePoolMemoryUsage metricVcenterResourcePoolMemoryUsage + metricVcenterVMCPUReadiness metricVcenterVMCPUReadiness + metricVcenterVMCPUTime metricVcenterVMCPUTime + metricVcenterVMCPUUsage metricVcenterVMCPUUsage + metricVcenterVMCPUUtilization metricVcenterVMCPUUtilization + metricVcenterVMDiskLatencyAvg metricVcenterVMDiskLatencyAvg + metricVcenterVMDiskLatencyMax metricVcenterVMDiskLatencyMax + metricVcenterVMDiskThroughput metricVcenterVMDiskThroughput + metricVcenterVMDiskUsage metricVcenterVMDiskUsage + metricVcenterVMDiskUtilization metricVcenterVMDiskUtilization + metricVcenterVMMemoryBallooned metricVcenterVMMemoryBallooned + metricVcenterVMMemoryGranted metricVcenterVMMemoryGranted + metricVcenterVMMemorySwapped metricVcenterVMMemorySwapped + metricVcenterVMMemorySwappedSsd metricVcenterVMMemorySwappedSsd + metricVcenterVMMemoryUsage metricVcenterVMMemoryUsage + metricVcenterVMMemoryUtilization metricVcenterVMMemoryUtilization + metricVcenterVMNetworkBroadcastPacketRate metricVcenterVMNetworkBroadcastPacketRate + metricVcenterVMNetworkMulticastPacketRate metricVcenterVMNetworkMulticastPacketRate + metricVcenterVMNetworkPacketDropRate metricVcenterVMNetworkPacketDropRate + metricVcenterVMNetworkPacketRate metricVcenterVMNetworkPacketRate + metricVcenterVMNetworkThroughput metricVcenterVMNetworkThroughput + metricVcenterVMNetworkUsage metricVcenterVMNetworkUsage + metricVcenterVMVsanLatencyAvg metricVcenterVMVsanLatencyAvg + metricVcenterVMVsanOperations metricVcenterVMVsanOperations + metricVcenterVMVsanThroughput metricVcenterVMVsanThroughput } // MetricBuilderOption applies changes to default metrics builder. @@ -3975,80 +4164,83 @@ func WithStartTime(startTime pcommon.Timestamp) MetricBuilderOption { } func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder { mb := &MetricsBuilder{ - config: mbc, - startTime: pcommon.NewTimestampFromTime(time.Now()), - metricsBuffer: pmetric.NewMetrics(), - buildInfo: settings.BuildInfo, - metricVcenterClusterCPUEffective: newMetricVcenterClusterCPUEffective(mbc.Metrics.VcenterClusterCPUEffective), - metricVcenterClusterCPULimit: newMetricVcenterClusterCPULimit(mbc.Metrics.VcenterClusterCPULimit), - metricVcenterClusterHostCount: newMetricVcenterClusterHostCount(mbc.Metrics.VcenterClusterHostCount), - metricVcenterClusterMemoryEffective: newMetricVcenterClusterMemoryEffective(mbc.Metrics.VcenterClusterMemoryEffective), - metricVcenterClusterMemoryLimit: newMetricVcenterClusterMemoryLimit(mbc.Metrics.VcenterClusterMemoryLimit), - metricVcenterClusterVMCount: newMetricVcenterClusterVMCount(mbc.Metrics.VcenterClusterVMCount), - metricVcenterClusterVMTemplateCount: newMetricVcenterClusterVMTemplateCount(mbc.Metrics.VcenterClusterVMTemplateCount), - metricVcenterClusterVsanCongestions: newMetricVcenterClusterVsanCongestions(mbc.Metrics.VcenterClusterVsanCongestions), - metricVcenterClusterVsanLatencyAvg: newMetricVcenterClusterVsanLatencyAvg(mbc.Metrics.VcenterClusterVsanLatencyAvg), - metricVcenterClusterVsanOperations: newMetricVcenterClusterVsanOperations(mbc.Metrics.VcenterClusterVsanOperations), - metricVcenterClusterVsanThroughput: newMetricVcenterClusterVsanThroughput(mbc.Metrics.VcenterClusterVsanThroughput), - metricVcenterDatacenterClusterCount: newMetricVcenterDatacenterClusterCount(mbc.Metrics.VcenterDatacenterClusterCount), - metricVcenterDatacenterCPULimit: newMetricVcenterDatacenterCPULimit(mbc.Metrics.VcenterDatacenterCPULimit), - metricVcenterDatacenterDatastoreCount: newMetricVcenterDatacenterDatastoreCount(mbc.Metrics.VcenterDatacenterDatastoreCount), - metricVcenterDatacenterDiskSpace: newMetricVcenterDatacenterDiskSpace(mbc.Metrics.VcenterDatacenterDiskSpace), - metricVcenterDatacenterHostCount: newMetricVcenterDatacenterHostCount(mbc.Metrics.VcenterDatacenterHostCount), - metricVcenterDatacenterMemoryLimit: newMetricVcenterDatacenterMemoryLimit(mbc.Metrics.VcenterDatacenterMemoryLimit), - metricVcenterDatacenterVMCount: newMetricVcenterDatacenterVMCount(mbc.Metrics.VcenterDatacenterVMCount), - metricVcenterDatastoreDiskUsage: newMetricVcenterDatastoreDiskUsage(mbc.Metrics.VcenterDatastoreDiskUsage), - metricVcenterDatastoreDiskUtilization: newMetricVcenterDatastoreDiskUtilization(mbc.Metrics.VcenterDatastoreDiskUtilization), - metricVcenterHostCPUCapacity: newMetricVcenterHostCPUCapacity(mbc.Metrics.VcenterHostCPUCapacity), - metricVcenterHostCPUReserved: newMetricVcenterHostCPUReserved(mbc.Metrics.VcenterHostCPUReserved), - metricVcenterHostCPUUsage: newMetricVcenterHostCPUUsage(mbc.Metrics.VcenterHostCPUUsage), - metricVcenterHostCPUUtilization: newMetricVcenterHostCPUUtilization(mbc.Metrics.VcenterHostCPUUtilization), - metricVcenterHostDiskLatencyAvg: newMetricVcenterHostDiskLatencyAvg(mbc.Metrics.VcenterHostDiskLatencyAvg), - metricVcenterHostDiskLatencyMax: newMetricVcenterHostDiskLatencyMax(mbc.Metrics.VcenterHostDiskLatencyMax), - metricVcenterHostDiskThroughput: newMetricVcenterHostDiskThroughput(mbc.Metrics.VcenterHostDiskThroughput), - metricVcenterHostMemoryCapacity: newMetricVcenterHostMemoryCapacity(mbc.Metrics.VcenterHostMemoryCapacity), - metricVcenterHostMemoryUsage: newMetricVcenterHostMemoryUsage(mbc.Metrics.VcenterHostMemoryUsage), - metricVcenterHostMemoryUtilization: newMetricVcenterHostMemoryUtilization(mbc.Metrics.VcenterHostMemoryUtilization), - metricVcenterHostNetworkPacketDropRate: newMetricVcenterHostNetworkPacketDropRate(mbc.Metrics.VcenterHostNetworkPacketDropRate), - metricVcenterHostNetworkPacketErrorRate: newMetricVcenterHostNetworkPacketErrorRate(mbc.Metrics.VcenterHostNetworkPacketErrorRate), - metricVcenterHostNetworkPacketRate: newMetricVcenterHostNetworkPacketRate(mbc.Metrics.VcenterHostNetworkPacketRate), - metricVcenterHostNetworkThroughput: newMetricVcenterHostNetworkThroughput(mbc.Metrics.VcenterHostNetworkThroughput), - metricVcenterHostNetworkUsage: newMetricVcenterHostNetworkUsage(mbc.Metrics.VcenterHostNetworkUsage), - metricVcenterHostVsanCacheHitRate: newMetricVcenterHostVsanCacheHitRate(mbc.Metrics.VcenterHostVsanCacheHitRate), - metricVcenterHostVsanCongestions: newMetricVcenterHostVsanCongestions(mbc.Metrics.VcenterHostVsanCongestions), - metricVcenterHostVsanLatencyAvg: newMetricVcenterHostVsanLatencyAvg(mbc.Metrics.VcenterHostVsanLatencyAvg), - metricVcenterHostVsanOperations: newMetricVcenterHostVsanOperations(mbc.Metrics.VcenterHostVsanOperations), - metricVcenterHostVsanThroughput: newMetricVcenterHostVsanThroughput(mbc.Metrics.VcenterHostVsanThroughput), - metricVcenterResourcePoolCPUShares: newMetricVcenterResourcePoolCPUShares(mbc.Metrics.VcenterResourcePoolCPUShares), - metricVcenterResourcePoolCPUUsage: newMetricVcenterResourcePoolCPUUsage(mbc.Metrics.VcenterResourcePoolCPUUsage), - metricVcenterResourcePoolMemoryBallooned: newMetricVcenterResourcePoolMemoryBallooned(mbc.Metrics.VcenterResourcePoolMemoryBallooned), - metricVcenterResourcePoolMemoryGranted: newMetricVcenterResourcePoolMemoryGranted(mbc.Metrics.VcenterResourcePoolMemoryGranted), - metricVcenterResourcePoolMemoryShares: newMetricVcenterResourcePoolMemoryShares(mbc.Metrics.VcenterResourcePoolMemoryShares), - metricVcenterResourcePoolMemorySwapped: newMetricVcenterResourcePoolMemorySwapped(mbc.Metrics.VcenterResourcePoolMemorySwapped), - metricVcenterResourcePoolMemoryUsage: newMetricVcenterResourcePoolMemoryUsage(mbc.Metrics.VcenterResourcePoolMemoryUsage), - metricVcenterVMCPUReadiness: newMetricVcenterVMCPUReadiness(mbc.Metrics.VcenterVMCPUReadiness), - metricVcenterVMCPUUsage: newMetricVcenterVMCPUUsage(mbc.Metrics.VcenterVMCPUUsage), - metricVcenterVMCPUUtilization: newMetricVcenterVMCPUUtilization(mbc.Metrics.VcenterVMCPUUtilization), - metricVcenterVMDiskLatencyAvg: newMetricVcenterVMDiskLatencyAvg(mbc.Metrics.VcenterVMDiskLatencyAvg), - metricVcenterVMDiskLatencyMax: newMetricVcenterVMDiskLatencyMax(mbc.Metrics.VcenterVMDiskLatencyMax), - metricVcenterVMDiskThroughput: newMetricVcenterVMDiskThroughput(mbc.Metrics.VcenterVMDiskThroughput), - metricVcenterVMDiskUsage: newMetricVcenterVMDiskUsage(mbc.Metrics.VcenterVMDiskUsage), - metricVcenterVMDiskUtilization: newMetricVcenterVMDiskUtilization(mbc.Metrics.VcenterVMDiskUtilization), - metricVcenterVMMemoryBallooned: newMetricVcenterVMMemoryBallooned(mbc.Metrics.VcenterVMMemoryBallooned), - metricVcenterVMMemoryGranted: newMetricVcenterVMMemoryGranted(mbc.Metrics.VcenterVMMemoryGranted), - metricVcenterVMMemorySwapped: newMetricVcenterVMMemorySwapped(mbc.Metrics.VcenterVMMemorySwapped), - metricVcenterVMMemorySwappedSsd: newMetricVcenterVMMemorySwappedSsd(mbc.Metrics.VcenterVMMemorySwappedSsd), - metricVcenterVMMemoryUsage: newMetricVcenterVMMemoryUsage(mbc.Metrics.VcenterVMMemoryUsage), - metricVcenterVMMemoryUtilization: newMetricVcenterVMMemoryUtilization(mbc.Metrics.VcenterVMMemoryUtilization), - metricVcenterVMNetworkPacketDropRate: newMetricVcenterVMNetworkPacketDropRate(mbc.Metrics.VcenterVMNetworkPacketDropRate), - metricVcenterVMNetworkPacketRate: newMetricVcenterVMNetworkPacketRate(mbc.Metrics.VcenterVMNetworkPacketRate), - metricVcenterVMNetworkThroughput: newMetricVcenterVMNetworkThroughput(mbc.Metrics.VcenterVMNetworkThroughput), - metricVcenterVMNetworkUsage: newMetricVcenterVMNetworkUsage(mbc.Metrics.VcenterVMNetworkUsage), - metricVcenterVMVsanLatencyAvg: newMetricVcenterVMVsanLatencyAvg(mbc.Metrics.VcenterVMVsanLatencyAvg), - metricVcenterVMVsanOperations: newMetricVcenterVMVsanOperations(mbc.Metrics.VcenterVMVsanOperations), - metricVcenterVMVsanThroughput: newMetricVcenterVMVsanThroughput(mbc.Metrics.VcenterVMVsanThroughput), - resourceAttributeIncludeFilter: make(map[string]filter.Filter), - resourceAttributeExcludeFilter: make(map[string]filter.Filter), + config: mbc, + startTime: pcommon.NewTimestampFromTime(time.Now()), + metricsBuffer: pmetric.NewMetrics(), + buildInfo: settings.BuildInfo, + metricVcenterClusterCPUEffective: newMetricVcenterClusterCPUEffective(mbc.Metrics.VcenterClusterCPUEffective), + metricVcenterClusterCPULimit: newMetricVcenterClusterCPULimit(mbc.Metrics.VcenterClusterCPULimit), + metricVcenterClusterHostCount: newMetricVcenterClusterHostCount(mbc.Metrics.VcenterClusterHostCount), + metricVcenterClusterMemoryEffective: newMetricVcenterClusterMemoryEffective(mbc.Metrics.VcenterClusterMemoryEffective), + metricVcenterClusterMemoryLimit: newMetricVcenterClusterMemoryLimit(mbc.Metrics.VcenterClusterMemoryLimit), + metricVcenterClusterVMCount: newMetricVcenterClusterVMCount(mbc.Metrics.VcenterClusterVMCount), + metricVcenterClusterVMTemplateCount: newMetricVcenterClusterVMTemplateCount(mbc.Metrics.VcenterClusterVMTemplateCount), + metricVcenterClusterVsanCongestions: newMetricVcenterClusterVsanCongestions(mbc.Metrics.VcenterClusterVsanCongestions), + metricVcenterClusterVsanLatencyAvg: newMetricVcenterClusterVsanLatencyAvg(mbc.Metrics.VcenterClusterVsanLatencyAvg), + metricVcenterClusterVsanOperations: newMetricVcenterClusterVsanOperations(mbc.Metrics.VcenterClusterVsanOperations), + metricVcenterClusterVsanThroughput: newMetricVcenterClusterVsanThroughput(mbc.Metrics.VcenterClusterVsanThroughput), + metricVcenterDatacenterClusterCount: newMetricVcenterDatacenterClusterCount(mbc.Metrics.VcenterDatacenterClusterCount), + metricVcenterDatacenterCPULimit: newMetricVcenterDatacenterCPULimit(mbc.Metrics.VcenterDatacenterCPULimit), + metricVcenterDatacenterDatastoreCount: newMetricVcenterDatacenterDatastoreCount(mbc.Metrics.VcenterDatacenterDatastoreCount), + metricVcenterDatacenterDiskSpace: newMetricVcenterDatacenterDiskSpace(mbc.Metrics.VcenterDatacenterDiskSpace), + metricVcenterDatacenterHostCount: newMetricVcenterDatacenterHostCount(mbc.Metrics.VcenterDatacenterHostCount), + metricVcenterDatacenterMemoryLimit: newMetricVcenterDatacenterMemoryLimit(mbc.Metrics.VcenterDatacenterMemoryLimit), + metricVcenterDatacenterVMCount: newMetricVcenterDatacenterVMCount(mbc.Metrics.VcenterDatacenterVMCount), + metricVcenterDatastoreDiskUsage: newMetricVcenterDatastoreDiskUsage(mbc.Metrics.VcenterDatastoreDiskUsage), + metricVcenterDatastoreDiskUtilization: newMetricVcenterDatastoreDiskUtilization(mbc.Metrics.VcenterDatastoreDiskUtilization), + metricVcenterHostCPUCapacity: newMetricVcenterHostCPUCapacity(mbc.Metrics.VcenterHostCPUCapacity), + metricVcenterHostCPUReserved: newMetricVcenterHostCPUReserved(mbc.Metrics.VcenterHostCPUReserved), + metricVcenterHostCPUUsage: newMetricVcenterHostCPUUsage(mbc.Metrics.VcenterHostCPUUsage), + metricVcenterHostCPUUtilization: newMetricVcenterHostCPUUtilization(mbc.Metrics.VcenterHostCPUUtilization), + metricVcenterHostDiskLatencyAvg: newMetricVcenterHostDiskLatencyAvg(mbc.Metrics.VcenterHostDiskLatencyAvg), + metricVcenterHostDiskLatencyMax: newMetricVcenterHostDiskLatencyMax(mbc.Metrics.VcenterHostDiskLatencyMax), + metricVcenterHostDiskThroughput: newMetricVcenterHostDiskThroughput(mbc.Metrics.VcenterHostDiskThroughput), + metricVcenterHostMemoryCapacity: newMetricVcenterHostMemoryCapacity(mbc.Metrics.VcenterHostMemoryCapacity), + metricVcenterHostMemoryUsage: newMetricVcenterHostMemoryUsage(mbc.Metrics.VcenterHostMemoryUsage), + metricVcenterHostMemoryUtilization: newMetricVcenterHostMemoryUtilization(mbc.Metrics.VcenterHostMemoryUtilization), + metricVcenterHostNetworkPacketDropRate: newMetricVcenterHostNetworkPacketDropRate(mbc.Metrics.VcenterHostNetworkPacketDropRate), + metricVcenterHostNetworkPacketErrorRate: newMetricVcenterHostNetworkPacketErrorRate(mbc.Metrics.VcenterHostNetworkPacketErrorRate), + metricVcenterHostNetworkPacketRate: newMetricVcenterHostNetworkPacketRate(mbc.Metrics.VcenterHostNetworkPacketRate), + metricVcenterHostNetworkThroughput: newMetricVcenterHostNetworkThroughput(mbc.Metrics.VcenterHostNetworkThroughput), + metricVcenterHostNetworkUsage: newMetricVcenterHostNetworkUsage(mbc.Metrics.VcenterHostNetworkUsage), + metricVcenterHostVsanCacheHitRate: newMetricVcenterHostVsanCacheHitRate(mbc.Metrics.VcenterHostVsanCacheHitRate), + metricVcenterHostVsanCongestions: newMetricVcenterHostVsanCongestions(mbc.Metrics.VcenterHostVsanCongestions), + metricVcenterHostVsanLatencyAvg: newMetricVcenterHostVsanLatencyAvg(mbc.Metrics.VcenterHostVsanLatencyAvg), + metricVcenterHostVsanOperations: newMetricVcenterHostVsanOperations(mbc.Metrics.VcenterHostVsanOperations), + metricVcenterHostVsanThroughput: newMetricVcenterHostVsanThroughput(mbc.Metrics.VcenterHostVsanThroughput), + metricVcenterResourcePoolCPUShares: newMetricVcenterResourcePoolCPUShares(mbc.Metrics.VcenterResourcePoolCPUShares), + metricVcenterResourcePoolCPUUsage: newMetricVcenterResourcePoolCPUUsage(mbc.Metrics.VcenterResourcePoolCPUUsage), + metricVcenterResourcePoolMemoryBallooned: newMetricVcenterResourcePoolMemoryBallooned(mbc.Metrics.VcenterResourcePoolMemoryBallooned), + metricVcenterResourcePoolMemoryGranted: newMetricVcenterResourcePoolMemoryGranted(mbc.Metrics.VcenterResourcePoolMemoryGranted), + metricVcenterResourcePoolMemoryShares: newMetricVcenterResourcePoolMemoryShares(mbc.Metrics.VcenterResourcePoolMemoryShares), + metricVcenterResourcePoolMemorySwapped: newMetricVcenterResourcePoolMemorySwapped(mbc.Metrics.VcenterResourcePoolMemorySwapped), + metricVcenterResourcePoolMemoryUsage: newMetricVcenterResourcePoolMemoryUsage(mbc.Metrics.VcenterResourcePoolMemoryUsage), + metricVcenterVMCPUReadiness: newMetricVcenterVMCPUReadiness(mbc.Metrics.VcenterVMCPUReadiness), + metricVcenterVMCPUTime: newMetricVcenterVMCPUTime(mbc.Metrics.VcenterVMCPUTime), + metricVcenterVMCPUUsage: newMetricVcenterVMCPUUsage(mbc.Metrics.VcenterVMCPUUsage), + metricVcenterVMCPUUtilization: newMetricVcenterVMCPUUtilization(mbc.Metrics.VcenterVMCPUUtilization), + metricVcenterVMDiskLatencyAvg: newMetricVcenterVMDiskLatencyAvg(mbc.Metrics.VcenterVMDiskLatencyAvg), + metricVcenterVMDiskLatencyMax: newMetricVcenterVMDiskLatencyMax(mbc.Metrics.VcenterVMDiskLatencyMax), + metricVcenterVMDiskThroughput: newMetricVcenterVMDiskThroughput(mbc.Metrics.VcenterVMDiskThroughput), + metricVcenterVMDiskUsage: newMetricVcenterVMDiskUsage(mbc.Metrics.VcenterVMDiskUsage), + metricVcenterVMDiskUtilization: newMetricVcenterVMDiskUtilization(mbc.Metrics.VcenterVMDiskUtilization), + metricVcenterVMMemoryBallooned: newMetricVcenterVMMemoryBallooned(mbc.Metrics.VcenterVMMemoryBallooned), + metricVcenterVMMemoryGranted: newMetricVcenterVMMemoryGranted(mbc.Metrics.VcenterVMMemoryGranted), + metricVcenterVMMemorySwapped: newMetricVcenterVMMemorySwapped(mbc.Metrics.VcenterVMMemorySwapped), + metricVcenterVMMemorySwappedSsd: newMetricVcenterVMMemorySwappedSsd(mbc.Metrics.VcenterVMMemorySwappedSsd), + metricVcenterVMMemoryUsage: newMetricVcenterVMMemoryUsage(mbc.Metrics.VcenterVMMemoryUsage), + metricVcenterVMMemoryUtilization: newMetricVcenterVMMemoryUtilization(mbc.Metrics.VcenterVMMemoryUtilization), + metricVcenterVMNetworkBroadcastPacketRate: newMetricVcenterVMNetworkBroadcastPacketRate(mbc.Metrics.VcenterVMNetworkBroadcastPacketRate), + metricVcenterVMNetworkMulticastPacketRate: newMetricVcenterVMNetworkMulticastPacketRate(mbc.Metrics.VcenterVMNetworkMulticastPacketRate), + metricVcenterVMNetworkPacketDropRate: newMetricVcenterVMNetworkPacketDropRate(mbc.Metrics.VcenterVMNetworkPacketDropRate), + metricVcenterVMNetworkPacketRate: newMetricVcenterVMNetworkPacketRate(mbc.Metrics.VcenterVMNetworkPacketRate), + metricVcenterVMNetworkThroughput: newMetricVcenterVMNetworkThroughput(mbc.Metrics.VcenterVMNetworkThroughput), + metricVcenterVMNetworkUsage: newMetricVcenterVMNetworkUsage(mbc.Metrics.VcenterVMNetworkUsage), + metricVcenterVMVsanLatencyAvg: newMetricVcenterVMVsanLatencyAvg(mbc.Metrics.VcenterVMVsanLatencyAvg), + metricVcenterVMVsanOperations: newMetricVcenterVMVsanOperations(mbc.Metrics.VcenterVMVsanOperations), + metricVcenterVMVsanThroughput: newMetricVcenterVMVsanThroughput(mbc.Metrics.VcenterVMVsanThroughput), + resourceAttributeIncludeFilter: make(map[string]filter.Filter), + resourceAttributeExcludeFilter: make(map[string]filter.Filter), } if mbc.ResourceAttributes.VcenterClusterName.MetricsInclude != nil { mb.resourceAttributeIncludeFilter["vcenter.cluster.name"] = filter.CreateFilter(mbc.ResourceAttributes.VcenterClusterName.MetricsInclude) @@ -4239,6 +4431,7 @@ func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption) { mb.metricVcenterResourcePoolMemorySwapped.emit(ils.Metrics()) mb.metricVcenterResourcePoolMemoryUsage.emit(ils.Metrics()) mb.metricVcenterVMCPUReadiness.emit(ils.Metrics()) + mb.metricVcenterVMCPUTime.emit(ils.Metrics()) mb.metricVcenterVMCPUUsage.emit(ils.Metrics()) mb.metricVcenterVMCPUUtilization.emit(ils.Metrics()) mb.metricVcenterVMDiskLatencyAvg.emit(ils.Metrics()) @@ -4252,6 +4445,8 @@ func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption) { mb.metricVcenterVMMemorySwappedSsd.emit(ils.Metrics()) mb.metricVcenterVMMemoryUsage.emit(ils.Metrics()) mb.metricVcenterVMMemoryUtilization.emit(ils.Metrics()) + mb.metricVcenterVMNetworkBroadcastPacketRate.emit(ils.Metrics()) + mb.metricVcenterVMNetworkMulticastPacketRate.emit(ils.Metrics()) mb.metricVcenterVMNetworkPacketDropRate.emit(ils.Metrics()) mb.metricVcenterVMNetworkPacketRate.emit(ils.Metrics()) mb.metricVcenterVMNetworkThroughput.emit(ils.Metrics()) @@ -4530,6 +4725,11 @@ func (mb *MetricsBuilder) RecordVcenterVMCPUReadinessDataPoint(ts pcommon.Timest mb.metricVcenterVMCPUReadiness.recordDataPoint(mb.startTime, ts, val) } +// RecordVcenterVMCPUTimeDataPoint adds a data point to vcenter.vm.cpu.time metric. +func (mb *MetricsBuilder) RecordVcenterVMCPUTimeDataPoint(ts pcommon.Timestamp, val float64, cpuStateAttributeValue AttributeCPUState, objectNameAttributeValue string) { + mb.metricVcenterVMCPUTime.recordDataPoint(mb.startTime, ts, val, cpuStateAttributeValue.String(), objectNameAttributeValue) +} + // RecordVcenterVMCPUUsageDataPoint adds a data point to vcenter.vm.cpu.usage metric. func (mb *MetricsBuilder) RecordVcenterVMCPUUsageDataPoint(ts pcommon.Timestamp, val int64) { mb.metricVcenterVMCPUUsage.recordDataPoint(mb.startTime, ts, val) @@ -4595,6 +4795,16 @@ func (mb *MetricsBuilder) RecordVcenterVMMemoryUtilizationDataPoint(ts pcommon.T mb.metricVcenterVMMemoryUtilization.recordDataPoint(mb.startTime, ts, val) } +// RecordVcenterVMNetworkBroadcastPacketRateDataPoint adds a data point to vcenter.vm.network.broadcast.packet.rate metric. +func (mb *MetricsBuilder) RecordVcenterVMNetworkBroadcastPacketRateDataPoint(ts pcommon.Timestamp, val float64, throughputDirectionAttributeValue AttributeThroughputDirection, objectNameAttributeValue string) { + mb.metricVcenterVMNetworkBroadcastPacketRate.recordDataPoint(mb.startTime, ts, val, throughputDirectionAttributeValue.String(), objectNameAttributeValue) +} + +// RecordVcenterVMNetworkMulticastPacketRateDataPoint adds a data point to vcenter.vm.network.multicast.packet.rate metric. +func (mb *MetricsBuilder) RecordVcenterVMNetworkMulticastPacketRateDataPoint(ts pcommon.Timestamp, val float64, throughputDirectionAttributeValue AttributeThroughputDirection, objectNameAttributeValue string) { + mb.metricVcenterVMNetworkMulticastPacketRate.recordDataPoint(mb.startTime, ts, val, throughputDirectionAttributeValue.String(), objectNameAttributeValue) +} + // RecordVcenterVMNetworkPacketDropRateDataPoint adds a data point to vcenter.vm.network.packet.drop.rate metric. func (mb *MetricsBuilder) RecordVcenterVMNetworkPacketDropRateDataPoint(ts pcommon.Timestamp, val float64, throughputDirectionAttributeValue AttributeThroughputDirection, objectNameAttributeValue string) { mb.metricVcenterVMNetworkPacketDropRate.recordDataPoint(mb.startTime, ts, val, throughputDirectionAttributeValue.String(), objectNameAttributeValue) diff --git a/receiver/vcenterreceiver/internal/metadata/generated_metrics_test.go b/receiver/vcenterreceiver/internal/metadata/generated_metrics_test.go index f286196dda59..2b0e5beb0389 100644 --- a/receiver/vcenterreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/vcenterreceiver/internal/metadata/generated_metrics_test.go @@ -259,6 +259,9 @@ func TestMetricsBuilder(t *testing.T) { allMetricsCount++ mb.RecordVcenterVMCPUReadinessDataPoint(ts, 1) + allMetricsCount++ + mb.RecordVcenterVMCPUTimeDataPoint(ts, 1, AttributeCPUStateIdle, "object_name-val") + defaultMetricsCount++ allMetricsCount++ mb.RecordVcenterVMCPUUsageDataPoint(ts, 1) @@ -310,6 +313,12 @@ func TestMetricsBuilder(t *testing.T) { allMetricsCount++ mb.RecordVcenterVMMemoryUtilizationDataPoint(ts, 1) + allMetricsCount++ + mb.RecordVcenterVMNetworkBroadcastPacketRateDataPoint(ts, 1, AttributeThroughputDirectionTransmitted, "object_name-val") + + allMetricsCount++ + mb.RecordVcenterVMNetworkMulticastPacketRateDataPoint(ts, 1, AttributeThroughputDirectionTransmitted, "object_name-val") + defaultMetricsCount++ allMetricsCount++ mb.RecordVcenterVMNetworkPacketDropRateDataPoint(ts, 1, AttributeThroughputDirectionTransmitted, "object_name-val") @@ -1105,6 +1114,24 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, ts, dp.Timestamp()) assert.Equal(t, pmetric.NumberDataPointValueTypeInt, dp.ValueType()) assert.Equal(t, int64(1), dp.IntValue()) + case "vcenter.vm.cpu.time": + assert.False(t, validatedMetrics["vcenter.vm.cpu.time"], "Found a duplicate in the metrics slice: vcenter.vm.cpu.time") + validatedMetrics["vcenter.vm.cpu.time"] = true + assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) + assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) + assert.Equal(t, "CPU time spent in idle, ready or idle state.", ms.At(i).Description()) + assert.Equal(t, "%", ms.At(i).Unit()) + dp := ms.At(i).Gauge().DataPoints().At(0) + assert.Equal(t, start, dp.StartTimestamp()) + assert.Equal(t, ts, dp.Timestamp()) + assert.Equal(t, pmetric.NumberDataPointValueTypeDouble, dp.ValueType()) + assert.InDelta(t, float64(1), dp.DoubleValue(), 0.01) + attrVal, ok := dp.Attributes().Get("cpu_state") + assert.True(t, ok) + assert.EqualValues(t, "idle", attrVal.Str()) + attrVal, ok = dp.Attributes().Get("object") + assert.True(t, ok) + assert.EqualValues(t, "object_name-val", attrVal.Str()) case "vcenter.vm.cpu.usage": assert.False(t, validatedMetrics["vcenter.vm.cpu.usage"], "Found a duplicate in the metrics slice: vcenter.vm.cpu.usage") validatedMetrics["vcenter.vm.cpu.usage"] = true @@ -1296,6 +1323,42 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, ts, dp.Timestamp()) assert.Equal(t, pmetric.NumberDataPointValueTypeDouble, dp.ValueType()) assert.InDelta(t, float64(1), dp.DoubleValue(), 0.01) + case "vcenter.vm.network.broadcast.packet.rate": + assert.False(t, validatedMetrics["vcenter.vm.network.broadcast.packet.rate"], "Found a duplicate in the metrics slice: vcenter.vm.network.broadcast.packet.rate") + validatedMetrics["vcenter.vm.network.broadcast.packet.rate"] = true + assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) + assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) + assert.Equal(t, "The rate of broadcast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine.", ms.At(i).Description()) + assert.Equal(t, "{packets/s}", ms.At(i).Unit()) + dp := ms.At(i).Gauge().DataPoints().At(0) + assert.Equal(t, start, dp.StartTimestamp()) + assert.Equal(t, ts, dp.Timestamp()) + assert.Equal(t, pmetric.NumberDataPointValueTypeDouble, dp.ValueType()) + assert.InDelta(t, float64(1), dp.DoubleValue(), 0.01) + attrVal, ok := dp.Attributes().Get("direction") + assert.True(t, ok) + assert.EqualValues(t, "transmitted", attrVal.Str()) + attrVal, ok = dp.Attributes().Get("object") + assert.True(t, ok) + assert.EqualValues(t, "object_name-val", attrVal.Str()) + case "vcenter.vm.network.multicast.packet.rate": + assert.False(t, validatedMetrics["vcenter.vm.network.multicast.packet.rate"], "Found a duplicate in the metrics slice: vcenter.vm.network.multicast.packet.rate") + validatedMetrics["vcenter.vm.network.multicast.packet.rate"] = true + assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) + assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) + assert.Equal(t, "The rate of multicast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine.", ms.At(i).Description()) + assert.Equal(t, "{packets/s}", ms.At(i).Unit()) + dp := ms.At(i).Gauge().DataPoints().At(0) + assert.Equal(t, start, dp.StartTimestamp()) + assert.Equal(t, ts, dp.Timestamp()) + assert.Equal(t, pmetric.NumberDataPointValueTypeDouble, dp.ValueType()) + assert.InDelta(t, float64(1), dp.DoubleValue(), 0.01) + attrVal, ok := dp.Attributes().Get("direction") + assert.True(t, ok) + assert.EqualValues(t, "transmitted", attrVal.Str()) + attrVal, ok = dp.Attributes().Get("object") + assert.True(t, ok) + assert.EqualValues(t, "object_name-val", attrVal.Str()) case "vcenter.vm.network.packet.drop.rate": assert.False(t, validatedMetrics["vcenter.vm.network.packet.drop.rate"], "Found a duplicate in the metrics slice: vcenter.vm.network.packet.drop.rate") validatedMetrics["vcenter.vm.network.packet.drop.rate"] = true diff --git a/receiver/vcenterreceiver/internal/metadata/testdata/config.yaml b/receiver/vcenterreceiver/internal/metadata/testdata/config.yaml index ce2aae9f092d..130db2582ef9 100644 --- a/receiver/vcenterreceiver/internal/metadata/testdata/config.yaml +++ b/receiver/vcenterreceiver/internal/metadata/testdata/config.yaml @@ -97,6 +97,8 @@ all_set: enabled: true vcenter.vm.cpu.readiness: enabled: true + vcenter.vm.cpu.time: + enabled: true vcenter.vm.cpu.usage: enabled: true vcenter.vm.cpu.utilization: @@ -123,6 +125,10 @@ all_set: enabled: true vcenter.vm.memory.utilization: enabled: true + vcenter.vm.network.broadcast.packet.rate: + enabled: true + vcenter.vm.network.multicast.packet.rate: + enabled: true vcenter.vm.network.packet.drop.rate: enabled: true vcenter.vm.network.packet.rate: @@ -260,6 +266,8 @@ none_set: enabled: false vcenter.vm.cpu.readiness: enabled: false + vcenter.vm.cpu.time: + enabled: false vcenter.vm.cpu.usage: enabled: false vcenter.vm.cpu.utilization: @@ -286,6 +294,10 @@ none_set: enabled: false vcenter.vm.memory.utilization: enabled: false + vcenter.vm.network.broadcast.packet.rate: + enabled: false + vcenter.vm.network.multicast.packet.rate: + enabled: false vcenter.vm.network.packet.drop.rate: enabled: false vcenter.vm.network.packet.rate: diff --git a/receiver/vcenterreceiver/internal/mockserver/responses/vm-performance-counters.xml b/receiver/vcenterreceiver/internal/mockserver/responses/vm-performance-counters.xml index 59f89bf27dab..efad590c7f80 100644 --- a/receiver/vcenterreceiver/internal/mockserver/responses/vm-performance-counters.xml +++ b/receiver/vcenterreceiver/internal/mockserver/responses/vm-performance-counters.xml @@ -78,6 +78,34 @@ 20 + + + 533 + + + 70 + + + + 534 + + + 90 + + + + 535 + + + 90 + + + + 536 + + + 90 + 143 @@ -190,6 +218,20 @@ 20 + + + 533 + vmnic1 + + 70 + + + + 535 + vmnic1 + + 90 + 143 @@ -225,6 +267,20 @@ 20 + + + 533 + vmnic0 + + 70 + + + + 535 + vmnic0 + + 90 + 143 @@ -246,6 +302,20 @@ 20 + + + 533 + vmnic3 + + 70 + + + + 535 + vmnic3 + + 90 + 146 @@ -260,6 +330,20 @@ 20 + + + 533 + vmnic2 + + 70 + + + + 535 + vmnic2 + + 90 + 532 @@ -323,6 +407,20 @@ 20 + + + 533 + 4000 + + 70 + + + + 535 + 4000 + + 90 + 147 @@ -351,6 +449,27 @@ 899 + + + 13 + 4000 + + 2 + + + + 11 + 4000 + + 3 + + + + 12 + 4000 + + 5 + vm-6004 @@ -428,6 +547,34 @@ 20 + + + 533 + + + 70 + + + + 534 + + + 70 + + + + 535 + + + 20 + + + + 536 + + + 70 + 143 @@ -540,6 +687,20 @@ 20 + + + 533 + vmnic1 + + 70 + + + + 535 + vmnic1 + + 90 + 143 @@ -575,6 +736,20 @@ 20 + + + 533 + vmnic0 + + 70 + + + + 535 + vmnic0 + + 90 + 143 @@ -596,6 +771,20 @@ 20 + + + 533 + vmnic3 + + 70 + + + + 535 + vmnic3 + + 90 + 146 @@ -610,6 +799,21 @@ 20 + + + 533 + vmnic2 + + 70 + + + + 535 + vmnic2 + + 90 + + 532 @@ -687,6 +891,20 @@ 20 + + + 533 + 4000 + + 70 + + + + 535 + 4000 + + 90 + 532 @@ -701,6 +919,27 @@ 899 + + + 13 + 4000 + + 2 + + + + 11 + 4000 + + 3 + + + + 12 + 4000 + + 5 + vm-6005 @@ -778,6 +1017,20 @@ 20 + + + 533 + + + 70 + + + + 535 + + + 90 + 143 @@ -890,6 +1143,20 @@ 20 + + + 533 + vmnic1 + + 70 + + + + 535 + vmnic1 + + 90 + 143 @@ -925,6 +1192,20 @@ 20 + + + 533 + vmnic0 + + 70 + + + + 535 + vmnic0 + + 90 + 143 @@ -946,6 +1227,20 @@ 20 + + + 533 + vmnic3 + + 70 + + + + 535 + vmnic3 + + 90 + 146 @@ -960,6 +1255,20 @@ 20 + + + 533 + vmnic2 + + 70 + + + + 535 + vmnic2 + + 90 + 532 @@ -1030,6 +1339,34 @@ 20 + + + 533 + 4000 + + 70 + + + + 534 + 4000 + + 70 + + + + 535 + 4000 + + 90 + + + + 536 + 4000 + + 70 + 530 @@ -1051,6 +1388,27 @@ 899 + + + 13 + 4000 + + 2 + + + + 11 + 4000 + + 3 + + + + 12 + 4000 + + 5 + diff --git a/receiver/vcenterreceiver/metadata.yaml b/receiver/vcenterreceiver/metadata.yaml index 761b36c3bcf0..a046dae2a08c 100644 --- a/receiver/vcenterreceiver/metadata.yaml +++ b/receiver/vcenterreceiver/metadata.yaml @@ -106,6 +106,13 @@ attributes: - "off" - "standby" - "unknown" + cpu_state: + description: CPU time spent in idle, ready or idle state. + type: string + enum: + - "idle" + - "ready" + - "wait" disk_direction: name_override: direction description: The direction of disk latency. @@ -568,6 +575,14 @@ metrics: value_type: int aggregation_temporality: cumulative attributes: [] + vcenter.vm.cpu.time: + enabled: false + description: CPU time spent in idle, ready or idle state. + unit: "%" + gauge: + value_type: double + attributes: [cpu_state, object_name] + extended_documentation: As measured over the most recent 20s interval. vcenter.vm.memory.ballooned: enabled: true description: The amount of memory that is ballooned due to virtualization. @@ -662,6 +677,22 @@ metrics: aggregation_temporality: cumulative attributes: [throughput_direction, object_name] extended_documentation: As measured over the most recent 20s interval. + vcenter.vm.network.broadcast.packet.rate: + enabled: false + description: The rate of broadcast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + unit: "{packets/s}" + gauge: + value_type: double + attributes: [throughput_direction, object_name] + extended_documentation: As measured over the most recent 20s interval. + vcenter.vm.network.multicast.packet.rate: + enabled: false + description: The rate of multicast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + unit: "{packets/s}" + gauge: + value_type: double + attributes: [throughput_direction, object_name] + extended_documentation: As measured over the most recent 20s interval. vcenter.vm.network.packet.rate: enabled: true description: The rate of packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. diff --git a/receiver/vcenterreceiver/metrics.go b/receiver/vcenterreceiver/metrics.go index 199da2fa8317..f0091d28e774 100644 --- a/receiver/vcenterreceiver/metrics.go +++ b/receiver/vcenterreceiver/metrics.go @@ -406,6 +406,11 @@ var vmPerfMetricList = []string{ "net.bytesRx.average", "net.bytesTx.average", "net.usage.average", + "net.broadcastRx.summation", + "net.broadcastTx.summation", + "net.multicastRx.summation", + "net.multicastTx.summation", + // disk metrics "disk.totalWriteLatency.average", "disk.totalReadLatency.average", @@ -414,6 +419,11 @@ var vmPerfMetricList = []string{ "virtualDisk.totalReadLatency.average", "virtualDisk.read.average", "virtualDisk.write.average", + + // cpu metrics + "cpu.idle.summation", + "cpu.wait.summation", + "cpu.ready.summation", } // recordVMPerformanceMetrics records performance metrics for a vSphere Virtual Machine @@ -460,6 +470,27 @@ func (v *vcenterMetricScraper) recordVMPerformanceMetrics(entityMetric *performa case "net.droppedRx.summation": rxRate := float64(nestedValue) / 20 v.mb.RecordVcenterVMNetworkPacketDropRateDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), rxRate, metadata.AttributeThroughputDirectionReceived, val.Instance) + case "net.multicastRx.summation": + rxRate := float64(nestedValue) / 20 + v.mb.RecordVcenterVMNetworkMulticastPacketRateDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), rxRate, metadata.AttributeThroughputDirectionReceived, val.Instance) + case "net.multicastTx.summation": + txRate := float64(nestedValue) / 20 + v.mb.RecordVcenterVMNetworkMulticastPacketRateDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), txRate, metadata.AttributeThroughputDirectionTransmitted, val.Instance) + case "cpu.idle.summation": + idleTime := float64(nestedValue) / float64(si.Interval) * 10 + v.mb.RecordVcenterVMCPUTimeDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), idleTime, metadata.AttributeCPUStateIdle, val.Instance) + case "cpu.wait.summation": + waitTime := float64(nestedValue) / float64(si.Interval) * 10 + v.mb.RecordVcenterVMCPUTimeDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), waitTime, metadata.AttributeCPUStateWait, val.Instance) + case "cpu.ready.summation": + readyTime := float64(nestedValue) / float64(si.Interval) * 10 + v.mb.RecordVcenterVMCPUTimeDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), readyTime, metadata.AttributeCPUStateReady, val.Instance) + case "net.broadcastRx.summation": + rxRate := float64(nestedValue) / 20 + v.mb.RecordVcenterVMNetworkBroadcastPacketRateDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), rxRate, metadata.AttributeThroughputDirectionReceived, val.Instance) + case "net.broadcastTx.summation": + txRate := float64(nestedValue) / 20 + v.mb.RecordVcenterVMNetworkBroadcastPacketRateDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), txRate, metadata.AttributeThroughputDirectionTransmitted, val.Instance) } } } diff --git a/receiver/vcenterreceiver/scraper_test.go b/receiver/vcenterreceiver/scraper_test.go index c30d3e29641d..46421a171d25 100644 --- a/receiver/vcenterreceiver/scraper_test.go +++ b/receiver/vcenterreceiver/scraper_test.go @@ -42,6 +42,9 @@ func TestScrapeConfigsEnabled(t *testing.T) { optConfigs := metadata.DefaultMetricsBuilderConfig() optConfigs.Metrics.VcenterHostMemoryCapacity.Enabled = true optConfigs.Metrics.VcenterVMMemoryGranted.Enabled = true + optConfigs.Metrics.VcenterVMNetworkBroadcastPacketRate.Enabled = true + optConfigs.Metrics.VcenterVMNetworkMulticastPacketRate.Enabled = true + optConfigs.Metrics.VcenterVMCPUTime.Enabled = true setResourcePoolMemoryUsageAttrFeatureGate(t, true) cfg := &Config{ diff --git a/receiver/vcenterreceiver/testdata/metrics/expected-all-enabled.yaml b/receiver/vcenterreceiver/testdata/metrics/expected-all-enabled.yaml index a850c3d2669b..c198330faceb 100644 --- a/receiver/vcenterreceiver/testdata/metrics/expected-all-enabled.yaml +++ b/receiver/vcenterreceiver/testdata/metrics/expected-all-enabled.yaml @@ -2167,6 +2167,41 @@ resourceMetrics: timeUnixNano: "2000000" name: vcenter.vm.cpu.readiness unit: '%' + - description: CPU time spent in idle, ready or idle state. + gauge: + dataPoints: + - asDouble: "1.0" + attributes: + - key: cpu_state + value: + stringValue: "idle" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: "2.5" + attributes: + - key: cpu_state + value: + stringValue: "ready" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: "1.5" + attributes: + - key: cpu_state + value: + stringValue: "wait" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.cpu.time + unit: "%" - description: The amount of CPU used by the VM. name: vcenter.vm.cpu.usage sum: @@ -2353,6 +2388,156 @@ resourceMetrics: timeUnixNano: "2000000" name: vcenter.vm.memory.utilization unit: '%' + - description: The rate of broadcast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + gauge: + dataPoints: + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: transmitted + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic0 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic1 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic2 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic3 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.network.broadcast.packet.rate + unit: '{packets/s}' + - description: The rate of multicast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + gauge: + dataPoints: + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: transmitted + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic0 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic1 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic2 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic3 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.network.multicast.packet.rate + unit: '{packets/s}' - description: The rate of transmitted or received packets dropped by each vNIC (virtual network interface controller) on the virtual machine. gauge: dataPoints: @@ -2813,6 +2998,41 @@ resourceMetrics: timeUnixNano: "2000000" name: vcenter.vm.cpu.readiness unit: '%' + - description: CPU time spent in idle, ready or idle state. + gauge: + dataPoints: + - asDouble: "1.0" + attributes: + - key: cpu_state + value: + stringValue: "idle" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: "2.5" + attributes: + - key: cpu_state + value: + stringValue: "ready" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: "1.5" + attributes: + - key: cpu_state + value: + stringValue: "wait" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.cpu.time + unit: "%" - description: The amount of CPU used by the VM. name: vcenter.vm.cpu.usage sum: @@ -2999,6 +3219,156 @@ resourceMetrics: timeUnixNano: "2000000" name: vcenter.vm.memory.utilization unit: '%' + - description: The rate of broadcast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + gauge: + dataPoints: + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: transmitted + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic0 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic1 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic2 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic3 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.network.broadcast.packet.rate + unit: '{packets/s}' + - description: The rate of multicast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + gauge: + dataPoints: + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: transmitted + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic0 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic1 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic2 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic3 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.network.multicast.packet.rate + unit: '{packets/s}' - description: The rate of transmitted or received packets dropped by each vNIC (virtual network interface controller) on the virtual machine. gauge: dataPoints: @@ -3558,6 +3928,41 @@ resourceMetrics: timeUnixNano: "2000000" name: vcenter.vm.cpu.readiness unit: '%' + - description: CPU time spent in idle, ready or idle state. + gauge: + dataPoints: + - asDouble: "1.0" + attributes: + - key: cpu_state + value: + stringValue: "idle" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: "2.5" + attributes: + - key: cpu_state + value: + stringValue: "ready" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: "1.50" + attributes: + - key: cpu_state + value: + stringValue: "wait" + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.cpu.time + unit: "%" - description: The amount of CPU used by the VM. name: vcenter.vm.cpu.usage sum: @@ -3744,6 +4149,156 @@ resourceMetrics: timeUnixNano: "2000000" name: vcenter.vm.memory.utilization unit: '%' + - description: The rate of broadcast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + gauge: + dataPoints: + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: transmitted + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic0 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic1 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic2 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic3 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.network.broadcast.packet.rate + unit: '{packets/s}' + - description: The rate of multicast packets transmitted or received by each vNIC (virtual network interface controller) on the virtual machine. + gauge: + dataPoints: + - asDouble: 3.5 + attributes: + - key: direction + value: + stringValue: transmitted + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 1.0 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: "4000" + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic0 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic1 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic2 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + - asDouble: 4.5 + attributes: + - key: direction + value: + stringValue: received + - key: object + value: + stringValue: vmnic3 + startTimeUnixNano: "2000000" + timeUnixNano: "1000000" + name: vcenter.vm.network.multicast.packet.rate + unit: '{packets/s}' - description: The rate of transmitted or received packets dropped by each vNIC (virtual network interface controller) on the virtual machine. gauge: dataPoints: