Skip to content

Commit

Permalink
[receiver/vcenter] Fix datastore disk usage metric (open-telemetry#23654
Browse files Browse the repository at this point in the history
)

**Description:** 
Fixed a bug in which the Vcenter receiver was incorrectly emmiting the
disk_state: used datapoint twice under the vcenter.datastore.disk.usage
metric instead of a
disk_state: used
disk_state: available

**Documentation:** <Describe the documentation added.>
  • Loading branch information
BominRahmani authored Jun 23, 2023
1 parent 403b0ef commit 0c625d0
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 339 deletions.
20 changes: 20 additions & 0 deletions .chloggen/fix-incorrect-diskusage-metric-emission.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use this changelog template to create an entry for release notes.
# If your change doesn't affect end users, such as a test fix or a tooling change,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.

# 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: Fixed a bug in which the vCenter receiver was incorrectly emitting the "used" attribute twice under the vcenter.datastore.disk.usage metric instead of "used" and "available".

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

# (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:
2 changes: 1 addition & 1 deletion receiver/vcenterreceiver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (v *vcenterMetricScraper) recordDatastoreProperties(
diskUsage := s.Capacity - s.FreeSpace
diskUtilization := float64(diskUsage) / float64(s.Capacity) * 100
v.mb.RecordVcenterDatastoreDiskUsageDataPoint(now, diskUsage, metadata.AttributeDiskStateUsed)
v.mb.RecordVcenterDatastoreDiskUsageDataPoint(now, s.Capacity, metadata.AttributeDiskStateUsed)
v.mb.RecordVcenterDatastoreDiskUsageDataPoint(now, s.FreeSpace, metadata.AttributeDiskStateAvailable)
v.mb.RecordVcenterDatastoreDiskUtilizationDataPoint(now, diskUtilization)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ resourceMetrics:
attributes:
- key: disk_state
value:
stringValue: used
stringValue: available
startTimeUnixNano: "1682367880520917116"
timeUnixNano: "1682367880570405002"
unit: By
Expand Down
Loading

0 comments on commit 0c625d0

Please sign in to comment.