Skip to content

Commit 8c25e9f

Browse files
[receiver/vcenter] Adds vCenter VSAN Host metrics (#34063)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> The following PR adds VSAN host metric collection. The following metrics are collected ``` vcenter.host.vsan.throughput (direction={read/write}) vcenter.host.vsan.iops (direction={read/write}) vcenter.host.vsan.congestions vcenter.host.vsan.cache.hit_rate vcenter.host.vsan.latency.avg (direction={read/write}) ``` **Link to tracking Issue:** #33556 **Testing:** <Describe what testing was performed and which tests were added.> Added mock data fields in order to test vsan host metric scraping. Updated golden test file output. **Documentation:** <Describe the documentation added.> Updated documentation using `make generate` Co-authored-by: Stefan Kurek <[email protected]>
1 parent 44e48ba commit 8c25e9f

File tree

17 files changed

+1090
-27
lines changed

17 files changed

+1090
-27
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: vcenterreceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Adds vCenter vSAN host metrics."
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [33556]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
Introduces the following vSAN host metrics to the vCenter receiver:
20+
- vcenter.host.vsan.throughput
21+
- vcenter.host.vsan.iops
22+
- vcenter.host.vsan.congestions
23+
- vcenter.host.vsan.cache.hit_rate
24+
- vcenter.host.vsan.latency.avg
25+
26+
# If your change doesn't affect end users or the exported elements of any package,
27+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
28+
# Optional: The change log or logs in which this entry should be included.
29+
# e.g. '[user]' or '[user, api]'
30+
# Include 'user' if the change is relevant to end users.
31+
# Include 'api' if there is a change to a library API.
32+
# Default: '[user]'
33+
change_logs: [user]

receiver/vcenterreceiver/client.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ func (vc *vcenterClient) HostSystems(ctx context.Context, containerMoRef vt.Mana
177177
"summary.hardware.memorySize",
178178
"summary.hardware.numCpuCores",
179179
"summary.hardware.cpuMhz",
180+
"config.vsanHostConfig.clusterInfo.nodeUuid",
180181
"summary.quickStats.overallMemoryUsage",
181182
"summary.quickStats.overallCpuUsage",
182183
"summary.overallStatus",
@@ -366,12 +367,18 @@ type VSANMetricDetails struct {
366367
type vSANQueryType string
367368

368369
const (
370+
VSANQueryTypeHosts vSANQueryType = "host-domclient:*"
369371
VSANQueryTypeVirtualMachines vSANQueryType = "virtual-machine:*"
370372
)
371373

372374
// getLabelsForQueryType returns the appropriate labels for each query type
373375
func (vc *vcenterClient) getLabelsForQueryType(queryType vSANQueryType) []string {
374376
switch queryType {
377+
case VSANQueryTypeHosts:
378+
return []string{
379+
"iopsRead", "iopsWrite", "throughputRead", "throughputWrite",
380+
"latencyAvgRead", "latencyAvgWrite", "congestion", "clientCacheHitRate",
381+
}
375382
case VSANQueryTypeVirtualMachines:
376383
return []string{
377384
"iopsRead", "iopsWrite", "throughputRead", "throughputWrite",
@@ -382,7 +389,17 @@ func (vc *vcenterClient) getLabelsForQueryType(queryType vSANQueryType) []string
382389
}
383390
}
384391

385-
// VSANVirtualMachines returns back virtual machine vSAN performance metrics
392+
// VSANHosts returns host VSAN performance metrics for a group of clusters
393+
func (vc *vcenterClient) VSANHosts(
394+
ctx context.Context,
395+
clusterRefs []*vt.ManagedObjectReference,
396+
) (*VSANQueryResults, error) {
397+
results, err := vc.vSANQuery(ctx, VSANQueryTypeHosts, clusterRefs)
398+
err = vc.handleVSANError(err, VSANQueryTypeHosts)
399+
return results, err
400+
}
401+
402+
// VSANVirtualMachines returns virtual machine vSAN performance metrics for a group of clusters
386403
func (vc *vcenterClient) VSANVirtualMachines(
387404
ctx context.Context,
388405
clusterRefs []*vt.ManagedObjectReference,

receiver/vcenterreceiver/documentation.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,74 @@ metrics:
652652
enabled: true
653653
```
654654
655+
### vcenter.host.vsan.cache.hit_rate
656+
657+
The host's read IOs which could be satisfied by the local client cache.
658+
659+
As measured over the most recent 5m interval.
660+
661+
| Unit | Metric Type | Value Type |
662+
| ---- | ----------- | ---------- |
663+
| % | Gauge | Int |
664+
665+
### vcenter.host.vsan.congestions
666+
667+
The congestions of IOs generated by all vSAN clients in the host.
668+
669+
As measured over the most recent 5m interval.
670+
671+
| Unit | Metric Type | Value Type |
672+
| ---- | ----------- | ---------- |
673+
| {congestions/sec} | Gauge | Double |
674+
675+
### vcenter.host.vsan.latency.avg
676+
677+
The host latency while accessing vSAN storage.
678+
679+
As measured over the most recent 5m interval.
680+
681+
| Unit | Metric Type | Value Type |
682+
| ---- | ----------- | ---------- |
683+
| us | Gauge | Int |
684+
685+
#### Attributes
686+
687+
| Name | Description | Values |
688+
| ---- | ----------- | ------ |
689+
| type | The type of vSAN latency. | Str: ``read``, ``write`` |
690+
691+
### vcenter.host.vsan.operations
692+
693+
The vSAN IOPs of a host.
694+
695+
As measured over the most recent 5m interval.
696+
697+
| Unit | Metric Type | Value Type |
698+
| ---- | ----------- | ---------- |
699+
| {operations/sec} | Gauge | Int |
700+
701+
#### Attributes
702+
703+
| Name | Description | Values |
704+
| ---- | ----------- | ------ |
705+
| type | The type of vSAN operation. | Str: ``read``, ``write``, ``unmap`` |
706+
707+
### vcenter.host.vsan.throughput
708+
709+
The vSAN throughput of a host.
710+
711+
As measured over the most recent 5m interval.
712+
713+
| Unit | Metric Type | Value Type |
714+
| ---- | ----------- | ---------- |
715+
| By/s | Gauge | Double |
716+
717+
#### Attributes
718+
719+
| Name | Description | Values |
720+
| ---- | ----------- | ------ |
721+
| direction | The type of vSAN throughput. | Str: ``read``, ``write`` |
722+
655723
### vcenter.vm.vsan.latency.avg
656724
657725
The virtual machine latency while accessing vSAN storage.

receiver/vcenterreceiver/internal/metadata/generated_config.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/vcenterreceiver/internal/metadata/generated_config_test.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)