Skip to content

Commit

Permalink
[receiver/vcenter] Fixes vcenter.vm.disk.throughput metric (#32780)
Browse files Browse the repository at this point in the history
**Description:** <Describe what has changed.>
Adds missing functionality for `vcenter.vm.disk.throughput` metric on VM
resources.
Also changes the metric from a Sum to a Gauge.

**Link to tracking Issue:** <Issue number if applicable>
#32772 

**Testing:** <Describe what testing was performed and which tests were
added.>
Unit/integration tests updated and tested. Local environment tested.

**Documentation:** <Describe the documentation added.>
New documentation generated based on the metadata.
  • Loading branch information
StefanKurek authored May 1, 2024
1 parent 6ad027c commit 9c96d14
Show file tree
Hide file tree
Showing 9 changed files with 421 additions and 32 deletions.
27 changes: 27 additions & 0 deletions .chloggen/fix_vcenter-vm-add-disk-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: bug_fix

# 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 functionality for `vcenter.vm.disk.throughput` while also changing to a gauge."

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

# (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]
11 changes: 7 additions & 4 deletions receiver/vcenterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,19 @@ The highest reported total latency (device and kernel times) over an interval of
### vcenter.vm.disk.throughput
The throughput of the virtual machine's disk.
Average number of kilobytes read from or written to the virtual disk each second.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| By/sec | Sum | Int | Cumulative | false |
As measured over the most recent 20s interval. Requires Performance Level 2.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {KiBy/s} | Gauge | Int |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| direction | The direction of disk latency. | Str: ``read``, ``write`` |
| object | The object on the virtual machine or host that is being reported on. | Any Str |
### vcenter.vm.disk.usage
Expand Down
25 changes: 12 additions & 13 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 @@ -8,6 +8,34 @@
<timestamp>2022-05-17T14:39:20Z</timestamp>
<interval>20</interval>
</sampleInfo>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>173</counterId>
<instance>scsi0:0</instance>
</id>
<value>10</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>173</counterId>
<instance></instance>
</id>
<value>10</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>174</counterId>
<instance>scsi0:0</instance>
</id>
<value>110</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>174</counterId>
<instance></instance>
</id>
<value>110</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>176</counterId>
Expand Down Expand Up @@ -246,6 +274,34 @@
<timestamp>2022-05-17T14:39:20Z</timestamp>
<interval>20</interval>
</sampleInfo>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>173</counterId>
<instance>scsi0:0</instance>
</id>
<value>9</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>173</counterId>
<instance></instance>
</id>
<value>9</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>174</counterId>
<instance>scsi0:0</instance>
</id>
<value>91</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>174</counterId>
<instance></instance>
</id>
<value>91</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>176</counterId>
Expand Down Expand Up @@ -484,6 +540,34 @@
<timestamp>2022-05-17T14:39:20Z</timestamp>
<interval>20</interval>
</sampleInfo>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>173</counterId>
<instance>scsi0:0</instance>
</id>
<value>8</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>173</counterId>
<instance></instance>
</id>
<value>8</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>174</counterId>
<instance>scsi0:0</instance>
</id>
<value>81</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>174</counterId>
<instance></instance>
</id>
<value>81</value>
</value>
<value xsi:type="PerfMetricIntSeries">
<id>
<counterId>176</counterId>
Expand Down
11 changes: 5 additions & 6 deletions receiver/vcenterreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,12 @@ metrics:
attributes: [object_name]
vcenter.vm.disk.throughput:
enabled: true
description: The throughput of the virtual machine's disk.
unit: By/sec
sum:
monotonic: false
description: Average number of kilobytes read from or written to the virtual disk each second.
unit: "{KiBy/s}"
gauge:
value_type: int
aggregation_temporality: cumulative
attributes: [object_name]
attributes: [disk_direction, object_name]
extended_documentation: As measured over the most recent 20s interval. Requires Performance Level 2.
vcenter.vm.network.throughput:
enabled: true
description: The amount of data that was transmitted or received over the network of the virtual machine.
Expand Down
6 changes: 6 additions & 0 deletions receiver/vcenterreceiver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ var vmPerfMetricList = []string{
"disk.maxTotalLatency.latest",
"virtualDisk.totalWriteLatency.average",
"virtualDisk.totalReadLatency.average",
"virtualDisk.read.average",
"virtualDisk.write.average",
}

func (v *vcenterMetricScraper) recordVMPerformanceMetrics(entityMetric *performance.EntityMetric) {
Expand Down Expand Up @@ -201,6 +203,10 @@ func (v *vcenterMetricScraper) recordVMPerformanceMetrics(entityMetric *performa
v.mb.RecordVcenterVMDiskLatencyAvgDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), nestedValue, metadata.AttributeDiskDirectionWrite, metadata.AttributeDiskTypeVirtual, val.Instance)
case "disk.maxTotalLatency.latest":
v.mb.RecordVcenterVMDiskLatencyMaxDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), nestedValue, val.Instance)
case "virtualDisk.read.average":
v.mb.RecordVcenterVMDiskThroughputDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), nestedValue, metadata.AttributeDiskDirectionRead, val.Instance)
case "virtualDisk.write.average":
v.mb.RecordVcenterVMDiskThroughputDataPoint(pcommon.NewTimestampFromTime(si.Timestamp), nestedValue, metadata.AttributeDiskDirectionWrite, val.Instance)
}
}
}
Expand Down
Loading

0 comments on commit 9c96d14

Please sign in to comment.