Skip to content

Commit

Permalink
[receiver/vcenter] vcenter.vm.disk.utilization calculation fix (open-…
Browse files Browse the repository at this point in the history
…telemetry#12343)

* calculate disk utilization for VMs more appropriately

* remove vcenter.vm.cpu.utilization metric from metadata.yaml

* add changelog entry

* add vcenter.cluster.name resource attribute to datastore metrics

* single out issue of vm.disk.utilization
  • Loading branch information
schmikei committed Jul 13, 2022
1 parent 8680aae commit 2f47f46
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion receiver/vcenterreceiver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (v *vcenterMetricScraper) recordVMUsages(
v.mb.RecordVcenterVMDiskUsageDataPoint(now, diskUsed, metadata.AttributeDiskStateUsed)
v.mb.RecordVcenterVMDiskUsageDataPoint(now, diskFree, metadata.AttributeDiskStateAvailable)
if diskFree != 0 {
diskUtilization := float64(diskUsed) / float64(diskFree) * 100
diskUtilization := float64(diskUsed) / float64(diskFree+diskUsed) * 100
v.mb.RecordVcenterVMDiskUtilizationDataPoint(now, diskUtilization)
}
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/vcenterreceiver/testdata/metrics/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3313,7 +3313,7 @@
{
"startTimeUnixNano": "1653335619966318000",
"timeUnixNano": "1653335619974183000",
"asDouble": 6.301649544673818
"asDouble": 5.9280825572001286
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@
{
"startTimeUnixNano": "1653335619966318000",
"timeUnixNano": "1653335619974183000",
"asDouble": 6.301649544673818
"asDouble": 5.9280825572001286
}
]
}
Expand Down
11 changes: 11 additions & 0 deletions unreleased/vcenter-vm-disk-utilization-fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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: Fixes calculation of `vcenter.vm.disk.utilization`.

# One or more tracking issues related to the change
issues: [ 12342 ]

0 comments on commit 2f47f46

Please sign in to comment.