Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV Format #32

Open
rlankfo opened this issue Jul 28, 2022 · 0 comments
Open

CSV Format #32

rlankfo opened this issue Jul 28, 2022 · 0 comments

Comments

@rlankfo
Copy link
Member

rlankfo commented Jul 28, 2022

According to the documentation, we should be able to get QueryPerf responses back in CSV format. This would be preferred to the default XML format.

When attempting this against a live environment, I'm seeing the following panic from govmomi:

panic: expected type *types.PerfEntityMetric, got: *types.PerfEntityMetricCSV

goroutine 52 [running]:
github.com/vmware/govmomi/performance.(*Manager).ToMetricSeries(0xc000345180, 0x11c66c0, 0xc000036088, 0xc000525a40, 0x2, 0x2, 0xc, 0xc000524420, 0xc000524400, 0x1, ...)
        /home/rlankfo/go/pkg/mod/github.com/vmware/govmomi@v0.27.2/performance/manager.go:453 +0x745
github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collect(0xc0002c5ca0, 0x11c66c0, 0xc000036088, 0xc0003b1e40, 0x0, 0x0, 0x0, 0x0, 0xc000524420, 0xc000524400, ...)
        /home/rlankfo/vmware_exporter/vsphere/collector.go:168 +0x490
github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectChunk(0xc0002c5ca0, 0x11c66c0, 0xc000036088, 0xc000033b00, 0xc0003b1e40, 0x0, 0x0, 0x0, 0x0, 0xc000524420, ...)
        /home/rlankfo/vmware_exporter/vsphere/collector.go:141 +0x328
github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectResource.func1(0xc0004752d0, 0xc0003e2a40, 0xc0002c5ca0, 0x11c66c0, 0xc000036088, 0xc000033b00, 0xc0003b1e40, 0x0, 0x0, 0x0, ...)
        /home/rlankfo/vmware_exporter/vsphere/collector.go:111 +0x13a
created by github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectResource
        /home/rlankfo/vmware_exporter/vsphere/collector.go:108 +0x7fa

Here's a link to a Java example in the docs that uses CSV format: https://developer.vmware.com/docs/1132/vsphere-web-services-sdk-programming-guide/doc/PG_Performance.18.4.html

The document also talks about casting PerfEntityMetricBase objects to use the CSV format:

When you specify “csv” format, you must cast the returned PerfEntityMetricBase objects into PerfEntityMetricCSV
objects. Both the sampling information and the collected data are encoded as comma-separated values suitable for
display in tabular format.

I thought govmomi would probably handle the type conversions / casting but doesn't seem to be the case. Need to investigate this further.

@marctc marctc self-assigned this Aug 2, 2022
@marctc marctc removed their assignment Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants