Skip to content

Commit

Permalink
[receiver/vcenter] Adds vCenter VM CPU readiness metric (#33608)
Browse files Browse the repository at this point in the history
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
This PR adds the `vcenter.vm.cpu.readiness` metric.
More information on this metric can be found
[here](https://vdc-repo.vmware.com/vmwb-repository/dcr-public/d1902b0e-d479-46bf-8ac9-cee0e31e8ec0/07ce8dbd-db48-4261-9b8f-c6d3ad8ba472/vim.vm.Summary.QuickStats.html).
**Link to tracking Issue:** #33607

**Testing:** <Describe what testing was performed and which tests were
added.>
The metric was scraped from a test vCenter environment, and golden test
files were updated to reflect the addition of the metric.

**Documentation:** <Describe the documentation added.>
Documentation was updated according to the metadata.yaml
  • Loading branch information
BominRahmani authored Jul 1, 2024
1 parent c3f6645 commit 0e9dde7
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .chloggen/add_vcenter_vm_cpu_readiness_metric.yaml
Original file line number Diff line number Diff line change
@@ -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 vCenter CPU readiness metric for VMs."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33607]

# (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]
27 changes: 27 additions & 0 deletions .chloggen/drop_support_for_vcenter_6.yaml
Original file line number Diff line number Diff line change
@@ -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: breaking

# 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: "Drops support for vCenter 6.7"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33607]

# (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]
1 change: 0 additions & 1 deletion receiver/vcenterreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ This receiver has been built to support ESXi and vCenter versions:

- 8
- 7.0
- 6.7

A “Read Only” user assigned to a vSphere with permissions to the vCenter server, cluster and all subsequent resources being monitored must be specified in order for the receiver to retrieve information about them.

Expand Down
18 changes: 18 additions & 0 deletions receiver/vcenterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,24 @@ As measured over the most recent 20s interval.
| ---- | ----------- | ------ |
| object | The object on the virtual machine or host that is being reported on. | Any Str |
## Optional Metrics
The following metrics are not emitted by default. Each of them can be enabled by applying the following configuration:
```yaml
metrics:
<metric_name>:
enabled: true
```
### vcenter.vm.cpu.readiness
Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| % | Gauge | Int |
## Resource Attributes
| Name | Description | Values | Enabled |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions receiver/vcenterreceiver/internal/metadata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ all_set:
enabled: true
vcenter.resource_pool.memory.usage:
enabled: true
vcenter.vm.cpu.readiness:
enabled: true
vcenter.vm.cpu.usage:
enabled: true
vcenter.vm.cpu.utilization:
Expand Down Expand Up @@ -156,6 +158,8 @@ none_set:
enabled: false
vcenter.resource_pool.memory.usage:
enabled: false
vcenter.vm.cpu.readiness:
enabled: false
vcenter.vm.cpu.usage:
enabled: false
vcenter.vm.cpu.utilization:
Expand Down
9 changes: 9 additions & 0 deletions receiver/vcenterreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,15 @@ metrics:
value_type: int
aggregation_temporality: cumulative
attributes: []
vcenter.vm.cpu.readiness:
enabled: false
description: Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU.
unit: "%"
gauge:
value_type: int
attributes: []
warnings:
if_enabled_not_set: "this metric will be enabled by default starting in release v0.105.0"
vcenter.vm.memory.utilization:
enabled: true
description: The memory utilization of the VM.
Expand Down
4 changes: 4 additions & 0 deletions receiver/vcenterreceiver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ func (v *vcenterMetricScraper) recordVMStats(
return
}
v.mb.RecordVcenterVMCPUUtilizationDataPoint(ts, 100*float64(cpuUsage)/float64(cpuLimit))

cpuReadiness := vm.Summary.QuickStats.OverallCpuReadiness
v.mb.RecordVcenterVMCPUReadinessDataPoint(ts, int64(cpuReadiness))

}

var hostPerfMetricList = []string{
Expand Down
1 change: 1 addition & 0 deletions receiver/vcenterreceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestScrapeConfigsEnabled(t *testing.T) {
defer mockServer.Close()

optConfigs := metadata.DefaultMetricsBuilderConfig()
optConfigs.Metrics.VcenterVMCPUReadiness.Enabled = true

cfg := &Config{
MetricsBuilderConfig: optConfigs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5212,6 +5212,14 @@ resourceMetrics:
stringValue: CentOS 9
scopeMetrics:
- metrics:
- description: Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU.
gauge:
dataPoints:
- asInt: "0"
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: vcenter.vm.cpu.readiness
unit: '%'
- description: The amount of CPU used by the VM.
name: vcenter.vm.cpu.usage
sum:
Expand Down Expand Up @@ -5841,6 +5849,14 @@ resourceMetrics:
stringValue: CentOS 7
scopeMetrics:
- metrics:
- description: Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU.
gauge:
dataPoints:
- asInt: "0"
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: vcenter.vm.cpu.readiness
unit: '%'
- description: The amount of CPU used by the VM.
name: vcenter.vm.cpu.usage
sum:
Expand Down Expand Up @@ -6470,6 +6486,14 @@ resourceMetrics:
stringValue: CentOS 8
scopeMetrics:
- metrics:
- description: Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU.
gauge:
dataPoints:
- asInt: "0"
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: vcenter.vm.cpu.readiness
unit: '%'
- description: The amount of CPU used by the VM.
name: vcenter.vm.cpu.usage
sum:
Expand Down

0 comments on commit 0e9dde7

Please sign in to comment.