[receiver/vcenter] Add host, datastore and VM state metrics - #50933
Draft
Harshit1259 wants to merge 5 commits into
Draft
[receiver/vcenter] Add host, datastore and VM state metrics#50933Harshit1259 wants to merge 5 commits into
Harshit1259 wants to merge 5 commits into
Conversation
Add opt-in state metrics requested in open-telemetry#47176 for users migrating from vmware_exporter: host power state, connection state, uptime and triggered alarm count, datastore maintenance mode and triggered alarm count, and VM power state. All new metrics are disabled by default. Assisted-by: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01BqWofePsmD4ZQtnzmicQKe
Harshit1259
force-pushed
the
vcenter-47176-metadata-kpis
branch
from
September 11, 2026 19:32
071038b to
59de75d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
pryorda/vmware_exporterbut missing in the OTel vCenter receiver.Metrics added:
vcenter.host.power.statusvcenter.host.connection.statusvcenter.host.uptimevcenter.host.alarm.countvcenter.datastore.maintenance.statusvcenter.datastore.alarm.countvcenter.vm.power.statusLink to tracking issue
Part of #47176
Testing
Added unit tests in
metrics_test.goto cover all 7 new metrics using sample input data and verify the expected output.Also updated
scraper_test.goto test the complete scrape flow with mocked vCenter responses and compare the results with the golden files.expected.yamlremains unchanged, which confirms the new metrics are disabled by default, whileexpected-all-enabled.yamlincludes all 7 metrics when they are enabled.Documentation
Regenerated
documentation.mdusingmake generateso all 7 new metrics are now documented with their description, unit, metric type, and supported attribute values.The metrics are listed under Optional Metrics, which also confirms that they are disabled by default.
Added the required metric descriptions in
metadata.yaml.Also added the changelog entry
.chloggen/vcenter-47176-metadata-kpis.yamlas an enhancement, listing all 7 metrics and mentioning that they are disabled by default.Solved Standby Power-State Bug
The host power-state mapping was using
"standby", but vSphere actually returns"standBy", so standby hosts were incorrectly reported asunknown.This also affected the new
vcenter.host.power_statemetric, since it uses the same mapping. The fix replaces the manually typed values with govmomi constants, so standby hosts are now reported correctly asstandby.Added tests for both the new host power-state metric and the existing
vcenter.datacenter.host.countmetric, and added a separate bug-fix changelog entry because this changes existing output.Authorship