Skip to content

Commit

Permalink
[receiver/vcenter] Adds vCenter VSAN Host metrics (#34063)
Browse files Browse the repository at this point in the history
**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]>
  • Loading branch information
BominRahmani and StefanKurek authored Jul 26, 2024
1 parent 44e48ba commit 8c25e9f
Show file tree
Hide file tree
Showing 17 changed files with 1,090 additions and 27 deletions.
33 changes: 33 additions & 0 deletions .chloggen/add-vcenter-vsan-host-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# 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 vCenter vSAN host metrics."

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

# (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: |
Introduces the following vSAN host metrics to the vCenter receiver:
- vcenter.host.vsan.throughput
- vcenter.host.vsan.iops
- vcenter.host.vsan.congestions
- vcenter.host.vsan.cache.hit_rate
- vcenter.host.vsan.latency.avg
# 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]
19 changes: 18 additions & 1 deletion receiver/vcenterreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func (vc *vcenterClient) HostSystems(ctx context.Context, containerMoRef vt.Mana
"summary.hardware.memorySize",
"summary.hardware.numCpuCores",
"summary.hardware.cpuMhz",
"config.vsanHostConfig.clusterInfo.nodeUuid",
"summary.quickStats.overallMemoryUsage",
"summary.quickStats.overallCpuUsage",
"summary.overallStatus",
Expand Down Expand Up @@ -366,12 +367,18 @@ type VSANMetricDetails struct {
type vSANQueryType string

const (
VSANQueryTypeHosts vSANQueryType = "host-domclient:*"
VSANQueryTypeVirtualMachines vSANQueryType = "virtual-machine:*"
)

// getLabelsForQueryType returns the appropriate labels for each query type
func (vc *vcenterClient) getLabelsForQueryType(queryType vSANQueryType) []string {
switch queryType {
case VSANQueryTypeHosts:
return []string{
"iopsRead", "iopsWrite", "throughputRead", "throughputWrite",
"latencyAvgRead", "latencyAvgWrite", "congestion", "clientCacheHitRate",
}
case VSANQueryTypeVirtualMachines:
return []string{
"iopsRead", "iopsWrite", "throughputRead", "throughputWrite",
Expand All @@ -382,7 +389,17 @@ func (vc *vcenterClient) getLabelsForQueryType(queryType vSANQueryType) []string
}
}

// VSANVirtualMachines returns back virtual machine vSAN performance metrics
// VSANHosts returns host VSAN performance metrics for a group of clusters
func (vc *vcenterClient) VSANHosts(
ctx context.Context,
clusterRefs []*vt.ManagedObjectReference,
) (*VSANQueryResults, error) {
results, err := vc.vSANQuery(ctx, VSANQueryTypeHosts, clusterRefs)
err = vc.handleVSANError(err, VSANQueryTypeHosts)
return results, err
}

// VSANVirtualMachines returns virtual machine vSAN performance metrics for a group of clusters
func (vc *vcenterClient) VSANVirtualMachines(
ctx context.Context,
clusterRefs []*vt.ManagedObjectReference,
Expand Down
68 changes: 68 additions & 0 deletions receiver/vcenterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,74 @@ metrics:
enabled: true
```
### vcenter.host.vsan.cache.hit_rate
The host's read IOs which could be satisfied by the local client cache.
As measured over the most recent 5m interval.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| % | Gauge | Int |
### vcenter.host.vsan.congestions
The congestions of IOs generated by all vSAN clients in the host.
As measured over the most recent 5m interval.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {congestions/sec} | Gauge | Double |
### vcenter.host.vsan.latency.avg
The host latency while accessing vSAN storage.
As measured over the most recent 5m interval.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| us | Gauge | Int |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| type | The type of vSAN latency. | Str: ``read``, ``write`` |
### vcenter.host.vsan.operations
The vSAN IOPs of a host.
As measured over the most recent 5m interval.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {operations/sec} | Gauge | Int |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| type | The type of vSAN operation. | Str: ``read``, ``write``, ``unmap`` |
### vcenter.host.vsan.throughput
The vSAN throughput of a host.
As measured over the most recent 5m interval.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By/s | Gauge | Double |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| direction | The type of vSAN throughput. | Str: ``read``, ``write`` |
### vcenter.vm.vsan.latency.avg
The virtual machine latency while accessing vSAN storage.
Expand Down
20 changes: 20 additions & 0 deletions receiver/vcenterreceiver/internal/metadata/generated_config.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.

Loading

0 comments on commit 8c25e9f

Please sign in to comment.