Skip to content

Commit

Permalink
[receiver/vcenter] Print the correct error message if VM fetch fails (o…
Browse files Browse the repository at this point in the history
…pen-telemetry#15685)

Print the correct error message if VM fetch fails
  • Loading branch information
neelayu authored and shalper2 committed Dec 6, 2022
1 parent 68763d5 commit 9241e69
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .chloggen/vcenter-err.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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: Print the correct error message if VM fetch fails.

# One or more tracking issues related to the change
issues: [15682]

# (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:
4 changes: 2 additions & 2 deletions receiver/vcenterreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (vc *vcenterClient) Clusters(ctx context.Context, datacenter *object.Datace
vc.finder = vc.finder.SetDatacenter(datacenter)
clusters, err := vc.finder.ClusterComputeResourceList(ctx, "*")
if err != nil {
return []*object.ClusterComputeResource{}, err
return []*object.ClusterComputeResource{}, fmt.Errorf("unable to get cluster lists: %w", err)
}
return clusters, nil
}
Expand All @@ -118,7 +118,7 @@ func (vc *vcenterClient) ResourcePools(ctx context.Context) ([]*object.ResourceP
func (vc *vcenterClient) VMs(ctx context.Context) ([]*object.VirtualMachine, error) {
vms, err := vc.finder.VirtualMachineList(ctx, "*")
if err != nil {
return nil, fmt.Errorf("unable to retrieve resource pools: %w", err)
return nil, fmt.Errorf("unable to retrieve vms: %w", err)
}
return vms, err
}
Expand Down

0 comments on commit 9241e69

Please sign in to comment.