Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/vcenter] Adds vCenter VM CPU readiness metric #33608

Merged
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/add_vcenter_vm_cpu_readiness_metric.yaml
BominRahmani marked this conversation as resolved.
Show resolved Hide resolved
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]
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
2 changes: 1 addition & 1 deletion receiver/vcenterreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21.0
require (
github.com/basgys/goxml2json v1.1.0
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-version v1.7.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.103.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.103.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.103.0
Expand Down Expand Up @@ -50,7 +51,6 @@ require (
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
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