Component(s)
receiver/vcenter
What happened?
Description
The vcenter receiver's vSAN metrics scraper crashes when the vSphere API returns an empty SampleInfo field on VsanPerfEntityMetricCSV. This happens when a vSAN cluster, host, or VM has no recent performance data (e.g., freshly provisioned cluster, or vSAN performance service temporarily unavailable).
The error propagates as a scraper error and blocks ALL metrics collection for that scrape cycle — not just vSAN metrics. Every 30-second scrape produces the same error, so no vcenter metrics are collected at all while the condition persists.
Root cause: in client.go:convertVSANResultToMetricResults(), strings.Split("", ",") on an empty SampleInfo returns [""] (a slice with one empty string). The loop passes "" to fmt.Sprintf("%s %s", "", localZone) producing " UTC", which time.Parse("2006-01-02 15:04:05 MST", " UTC") cannot parse.
Steps to Reproduce
- Configure the vcenter receiver against a vCenter with vSAN enabled
- Ensure at least one vSAN cluster has no recent performance data (newly added cluster, or vSAN performance service restarting)
- The receiver will fail on every scrape cycle with the timestamp parse error
Expected Result
The receiver should skip vSAN entities with empty SampleInfo gracefully and continue collecting all other metrics (VM, host, cluster, datastore, resource pool).
Actual Result
The entire scrape fails with:
Error scraping metrics: failed to retrieve vSAN metrics for Clusters:
problem processing cluster-domclient:* [*] vSAN metrics for cluster domain-c711164:
problem parsing timestamp from : parsing time " UTC" as "2006-01-02 15:04:05 MST":
cannot parse " UTC" as "2006"
No metrics are collected for the affected scrape cycle.
Collector version
0.146.0
Environment information
Environment
OS: RHEL 9 (container: golang:1.25-bookworm builder, distroless runtime)
Collector built with OCB v0.146.1
vSphere: vCenter 8.x with vSAN enabled across 2 clusters
OpenTelemetry Collector configuration
receivers:
vcenter:
endpoint: https://vcenter.example.com
username: ${env:VCENTER_USERNAME}
password: ${env:VCENTER_PASSWORD}
collection_interval: 30s
tls:
insecure_skip_verify: true
Log output
problem parsing timestamp from : parsing time " UTC" as "2006-01-02 15:04:05 MST": cannot parse " UTC" as "2006"; ... vSAN metrics for cluster domain-c1001: ...
Additional context
Related to #42208 (closed — same error, attributed to Grafana Alloy wrapping, but the root cause is in the upstream receiver code at client.go:543).
Proposed fix: add a nil/empty guard in convertVSANResultToMetricResults() before the timestamp parsing loop. If SampleInfo is empty, return empty metric results instead of failing. Also TrimSpace individual timestamp strings to handle trailing whitespace from the vSAN API.
timeStrings := strings.Split(vSANResult.SampleInfo, ",")
// Guard: vSAN API may return empty SampleInfo when a cluster/host has
// no recent performance data.
if len(timeStrings) == 0 || (len(timeStrings) == 1 && strings.TrimSpace(timeStrings[0]) == "") {
return &metricResults, nil
}
timestamps := []time.Time{}
for _, timeString := range timeStrings {
timeString = strings.TrimSpace(timeString)
if timeString == "" {
continue
}
// ... existing parse logic ...
}
vcenter-vsan-empty-timestamp.patch
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Component(s)
receiver/vcenter
What happened?
Description
The vcenter receiver's vSAN metrics scraper crashes when the vSphere API returns an empty
SampleInfofield onVsanPerfEntityMetricCSV. This happens when a vSAN cluster, host, or VM has no recent performance data (e.g., freshly provisioned cluster, or vSAN performance service temporarily unavailable).The error propagates as a scraper error and blocks ALL metrics collection for that scrape cycle — not just vSAN metrics. Every 30-second scrape produces the same error, so no vcenter metrics are collected at all while the condition persists.
Root cause: in
client.go:convertVSANResultToMetricResults(),strings.Split("", ",")on an emptySampleInforeturns[""](a slice with one empty string). The loop passes""tofmt.Sprintf("%s %s", "", localZone)producing" UTC", whichtime.Parse("2006-01-02 15:04:05 MST", " UTC")cannot parse.Steps to Reproduce
Expected Result
The receiver should skip vSAN entities with empty
SampleInfogracefully and continue collecting all other metrics (VM, host, cluster, datastore, resource pool).Actual Result
The entire scrape fails with:
Error scraping metrics: failed to retrieve vSAN metrics for Clusters:
problem processing cluster-domclient:* [*] vSAN metrics for cluster domain-c711164:
problem parsing timestamp from : parsing time " UTC" as "2006-01-02 15:04:05 MST":
cannot parse " UTC" as "2006"
No metrics are collected for the affected scrape cycle.
Collector version
0.146.0
Environment information
Environment
OS: RHEL 9 (container: golang:1.25-bookworm builder, distroless runtime)
Collector built with OCB v0.146.1
vSphere: vCenter 8.x with vSAN enabled across 2 clusters
OpenTelemetry Collector configuration
Log output
Additional context
Related to #42208 (closed — same error, attributed to Grafana Alloy wrapping, but the root cause is in the upstream receiver code at client.go:543).
Proposed fix: add a nil/empty guard in convertVSANResultToMetricResults() before the timestamp parsing loop. If SampleInfo is empty, return empty metric results instead of failing. Also TrimSpace individual timestamp strings to handle trailing whitespace from the vSAN API.
vcenter-vsan-empty-timestamp.patch
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.