Skip to content

Add data.json files for vsphere module. WIP #4209

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

Merged
merged 1 commit into from
May 11, 2017
Merged

Add data.json files for vsphere module. WIP #4209

merged 1 commit into from
May 11, 2017

Conversation

amandahla
Copy link

@amandahla amandahla commented May 4, 2017

Related to #4028

Todo:

  • Data.json for metric Host
  • Data.json for metric Datastore
  • Data.json for metric Virtualmachine
  • Dashboard

@amandahla amandahla changed the title Add data.json files for vsphere module Add data.json files for vsphere module #WIP May 4, 2017
@elasticmachine
Copy link
Collaborator

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

@amandahla amandahla changed the title Add data.json files for vsphere module #WIP Add data.json files for vsphere module WIP May 4, 2017
@elasticmachine
Copy link
Collaborator

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

@amandahla amandahla changed the title Add data.json files for vsphere module WIP Add data.json files for vsphere module. WIP May 4, 2017
@ruflin
Copy link
Collaborator

ruflin commented May 4, 2017

It would be nice if they would be auto generated with generate-json. If you have a local setup and the data tests, you could run go test -tags=integration github.com/elastic/beats/metricbeat/module/vsphere/... -data

@amandahla
Copy link
Author

@ruflin I'm not sure if it's right but I included TestData on the tests so now the data.json file is generated based on simulator data.

@ruflin
Copy link
Collaborator

ruflin commented May 4, 2017

@amandahla That actually sounds great.

@ruflin
Copy link
Collaborator

ruflin commented May 4, 2017

jenkins, test it

@amandahla
Copy link
Author

@ruflin I made a Kibana Dashboard for this module with a few visualizations. Can I commit here or open another PR? Thanks!

@ruflin
Copy link
Collaborator

ruflin commented May 4, 2017

Nice. Lets open a new PR so we can merge this one sooner.

@andrewkroh
Copy link
Member

Hi @amandahla, in master, I'm seeing some test failures. Maybe they are already fixed by this PR, if not could you please take a look. Let me know if you need any more info.

From jenkins on linux:

command [go test -cover -coverprofile /tmp/gotestcover-647607641 github.com/elastic/beats/metricbeat/module/vsphere/datastore]: exit status 1
--- FAIL: TestFetchEventContents (0.01s)
	datastore_test.go:45: vsphere/datastore event: {
		  "capacity": {
		    "free": {
		      "bytes": 480915800064
		    },
		    "total": {
		      "bytes": 506726043648
		    },
		    "used": {
		      "bytes": 25810243584,
		      "pct": 5
		    }
		  },
		  "datacenter": "ha-datacenter",
		  "fstype": "local",
		  "name": "LocalDS_0"
		}
	assertions.go:225: 
                        
	Error Trace:	datastore_test.go:62
		
	Error:		Should be true
		
FAIL

From a windows vm:

PS C:\Gopath\src\github.com\elastic\beats\metricbeat\module\vsphere\datastore> go test -v                                                                                        
=== RUN   TestFetchEventContents                                                                                                                                                 
--- FAIL: TestFetchEventContents (0.01s)                                                                                                                                         
panic: runtime error: integer divide by zero [recovered]                                                                                                                         
        panic: runtime error: integer divide by zero                                                                                                                             
                                                                                                                                                                                 
goroutine 22 [running]:                                                                                                                                                          
panic(0xd03e00, 0xc04200a050)                                                                                                                                                    
        C:/go1.7.3/src/runtime/panic.go:500 +0x1af                                                                                                                               
testing.tRunner.func1(0xc042074180)                                                                                                                                              
        C:/go1.7.3/src/testing/testing.go:579 +0x264                                                                                                                             
panic(0xd03e00, 0xc04200a050)                                                                                                                                                    
        C:/go1.7.3/src/runtime/panic.go:458 +0x251                                                                                                                               
github.com/elastic/beats/metricbeat/module/vsphere/datastore.(*MetricSet).Fetch(0xc0422359e0, 0x0, 0x0, 0x0, 0x0, 0x0)                                                           
        C:/Gopath/src/github.com/elastic/beats/metricbeat/module/vsphere/datastore/datastore.go:107 +0x1235                                                                      
github.com/elastic/beats/metricbeat/module/vsphere/datastore.TestFetchEventContents(0xc042074180)                                                                                
        C:/Gopath/src/github.com/elastic/beats/metricbeat/module/vsphere/datastore/datastore_test.go:38 +0x71a                                                                   
testing.tRunner(0xc042074180, 0xf6bec0)                                                                                                                                          
        C:/go1.7.3/src/testing/testing.go:610 +0x88                                                                                                                              
created by testing.(*T).Run                                                                                                                                                      
        C:/go1.7.3/src/testing/testing.go:646 +0x2f3                                                                                                                             
exit status 2                                                                                                                                                                    
FAIL    github.com/elastic/beats/metricbeat/module/vsphere/datastore    0.106s

@andrewkroh
Copy link
Member

I opened #4220 for the above issue.

@ruflin
Copy link
Collaborator

ruflin commented May 5, 2017

@amandahla Could you squash your commits into 1 commit and rebase on master? Also run make fmt and make update to make sure the build passes.

@ruflin
Copy link
Collaborator

ruflin commented May 5, 2017

jenkins, test it

f := find.NewFinder(m.Client, true)
if f == nil {
return nil, errors.New("Finder undefined for vsphere.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
error strings should not be capitalized or end with punctuation or a newline

@ruflin
Copy link
Collaborator

ruflin commented May 9, 2017

@amandahla PR looks good to me. Could you rebase again on master and fix the golint issue above?

@andrewkroh andrewkroh added in progress Pull request is currently in progress. Metricbeat Metricbeat labels May 9, 2017
@ruflin
Copy link
Collaborator

ruflin commented May 10, 2017

jenkins, test it

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a merge problem. The fixes from https://github.com/elastic/beats/pull/4220/files are lost.

@@ -62,7 +62,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
func (m *MetricSet) Fetch() ([]common.MapStr, error) {
f := find.NewFinder(m.Client, true)
if f == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately find.NewFinder is lacking godocs to document the function's contract. But based on the implementation, the function cannot return nil so this check is unnecessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewkroh Sorry, maybe my rebase went wrong. I'll correct this and remove this check. In another PR, I'll see if it's possible to use the new package view instead of finder (like here)

@andrewkroh andrewkroh added review and removed in progress Pull request is currently in progress. labels May 10, 2017
Copy link
Collaborator

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There still seem to be some rebase issues. Did you rebase on top of the most recent version of master? Things seem to be in the diff which shouldn't. Not sure what happened.

@@ -29,7 +29,7 @@ type MetricSet struct {
}

func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
logp.Experimental("The vsphere host metricset is experimental")
logp.Warn("EXPERIMENTAL: The vsphere host metricset is experimental")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not be reverted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I tried to make the same as here so I change this warning.
https://github.com/elastic/beats/pull/4220/files

@@ -30,7 +30,7 @@ type MetricSet struct {
}

func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
logp.Experimental("The vsphere virtualmachine metricset is experimental")
logp.Warn("EXPERIMENTAL: The vsphere virtualmachine metricset is experimental")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not be reverted.

@andrewkroh
Copy link
Member

jenkins, test it

@andrewkroh andrewkroh merged commit 6852499 into elastic:master May 11, 2017
@monicasarbu
Copy link
Contributor

@amandahla Thank you for your PR. It would be nice if you could a Kibana dashboard as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants