Skip to content

Commit

Permalink
[receiver/vcenter] Adds Initial Support for VM Templates (#32831)
Browse files Browse the repository at this point in the history
**Description:** <Describe what has changed.>
- The Cluster `vcenter.cluster.vm.count` metric now does not include
templates in the returned values.
- A new (default disabled with warning) Cluster
`vcenter.cluster.vm_template.count`metric is added to count only VM
templates.
- VM Template Resource Attributes `vcenter.vm_template.name` and
`vcenter.vm_template.id` have been added (default disabled with
warning). If disabled, resources will no longer be created for VM
templates.
- Trimmed down VM Template metrics to a single expected metric.
- Fixed integration test build tag that was accidentally removed in
previous PR

**Link to tracking Issue:** <Issue number if applicable>
#32821 

**Testing:** <Describe what testing was performed and which tests were
added.>
Unit/integration tests updated and tested. Local environment tested.

**Documentation:** <Describe the documentation added.>
New documentation generated based on the metadata.
  • Loading branch information
StefanKurek authored May 3, 2024
1 parent f584d29 commit e2388c2
Show file tree
Hide file tree
Showing 20 changed files with 436 additions and 25 deletions.
27 changes: 27 additions & 0 deletions .chloggen/fix_vcenter-vm-template-add.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# 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: "Adds initially disabled functionality for VM Templates"

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

# (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:

# 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]
1 change: 1 addition & 0 deletions receiver/vcenterreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (vc *vcenterClient) VMs(ctx context.Context) ([]mo.VirtualMachine, error) {
err = v.Retrieve(ctx, []string{"VirtualMachine"}, []string{
"config.hardware.numCPU",
"config.instanceUuid",
"config.template",
"runtime.powerState",
"runtime.maxCpuUsage",
"summary.quickStats.guestMemoryUsage",
Expand Down
10 changes: 10 additions & 0 deletions receiver/vcenterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,14 @@ metrics:
enabled: true
```
### vcenter.cluster.vm_template.count
The number of virtual machine templates in the cluster.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {virtual_machine_templates} | Sum | Int | Cumulative | false |
### vcenter.vm.memory.utilization
The memory utilization of the VM.
Expand All @@ -480,3 +488,5 @@ The memory utilization of the VM.
| vcenter.virtual_app.name | The name of the vApp. | Any Str | false |
| vcenter.vm.id | The instance UUID of the virtual machine. | Any Str | true |
| vcenter.vm.name | The name of the virtual machine. | Any Str | true |
| vcenter.vm_template.id | The instance UUID of the virtual machine template. | Any Str | false |
| vcenter.vm_template.name | The name of the virtual machine template. | Any Str | false |
2 changes: 2 additions & 0 deletions receiver/vcenterreceiver/integration_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package vcenterreceiver // import github.com/open-telemetry/opentelemetry-collector-contrib/receiver/vcenterreceiver

import (
Expand Down
12 changes: 12 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.

80 changes: 80 additions & 0 deletions receiver/vcenterreceiver/internal/metadata/generated_metrics.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 e2388c2

Please sign in to comment.