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

server Metricset for Zookeeper Metricbeat module #10341

Merged
merged 10 commits into from
Jan 28, 2019

Conversation

sayden
Copy link
Contributor

@sayden sayden commented Jan 25, 2019

The current metricset uses the srvr 4 letter word command from Zookeeper to extract server information. Includes all the fields that are returned from the mentioned call. It looks like the following:

Zookeeper version: 3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 04:05 GMT
Latency min/avg/max: 1/2/3
Received: 46
Sent: 45
Connections: 1
Outstanding: 0
Zxid: 0x700601132
Mode: standalone
Node count: 4
Proposal sizes last/min/max: -3/-999/-1

You can see how the output is gonna look like in the data.json file.

A better description of the fields is missing. I have just written what I guess what they are but I might be wrong. I'm trying to find a good source of documentation to write a proper description of them.

GA

  • Supported versions are documented
  • Supported operating systems are documented (if applicable)
  • Integration tests
  • System tests
  • Automated checks that all fields are documented
  • Documentation
  • Example data.json exists and an automated way to generate it exists (go test -data)
  • Fields follow naming conventions: https://www.elastic.co/guide/en/beats/devguide/master/event-conventions.html
  • Dashboards exists (if applicable)
  • Kibana Home Tutorial (if applicable)

@sayden sayden added enhancement review Metricbeat Metricbeat Team:Integrations Label for the Integrations team labels Jan 25, 2019
@sayden sayden self-assigned this Jan 25, 2019
@sayden sayden requested review from a team as code owners January 25, 2019 14:48
Copy link
Member

@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.

Looks pretty good already. Left a few minor comments, changelog is missing.

metricbeat/docs/modules/zookeeper.asciidoc Outdated Show resolved Hide resolved
metricbeat/module/zookeeper/server/_meta/data.json Outdated Show resolved Hide resolved
metricbeat/module/zookeeper/server/_meta/fields.yml Outdated Show resolved Hide resolved
metricbeat/module/zookeeper/server/server.go Outdated Show resolved Hide resolved
metricbeat/module/zookeeper/server/server.go Outdated Show resolved Hide resolved
metricbeat/module/zookeeper/server/server.go Outdated Show resolved Hide resolved
return output, nil
}

func parseXid(line string) (common.MapStr, error){
Copy link
Member

Choose a reason for hiding this comment

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

Any chance to get some unit tests for the parse functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe you have missed it but those functions are tested by the global parseSrvr that uses all of them. In that test all possible values are checked so I considered it tested (75% of coverage is achieved too).

Do you want individual tests too or it is enough with the global test?

Copy link
Member

Choose a reason for hiding this comment

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

Works for me for the moment. In general I think we mainly test the "correct" cases but probably also should check the error cases. Not critical here.

"sent": 47,
"version": {
"date": "06/29/2018 04:05 GMT",
"id": "3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03"
Copy link
Member

Choose a reason for hiding this comment

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

The service version should go under service.version as it is an ECS field. Interesting to see that you extraced the date here. @webmat Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Version has been moved to service.version and I have left the date there as version_date. Maybe I should simply remove it as it's something that it's not going to change and it provides not much value?

Copy link
Member

Choose a reason for hiding this comment

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

If you easily can skip the date then let's not add it to the event. Not sure how it would be used.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW - I don't feel there's a use-case for version_date. It's not breaking BC if we introduce it in the future, so we might as well drop it (at least for now).

@sayden sayden added in progress Pull request is currently in progress. and removed review labels Jan 25, 2019
@sayden
Copy link
Contributor Author

sayden commented Jan 25, 2019

Thanks for your comments @ruflin I'll address the necessary changes asap. I have unset the review flag and set in_progress until then and I find a good description for the fields (which I'm going to find in old Zookeeper releases or books... I hope 😄 )

@sayden
Copy link
Contributor Author

sayden commented Jan 25, 2019

@pmoust Forgot to mention about that structured I wrote on the PR. I don't have a strong opinion but if you prefer it that way and @ruflin is happy about it I'm fine too 🙂

Copy link
Contributor

@webmat webmat left a comment

Choose a reason for hiding this comment

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

Left one nice to have suggestion on service fields

"name": "server"
},
"service": {
"address": "localhost:2181",
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice if this was also broken up as service.ip and service.port.

Copy link
Member

Choose a reason for hiding this comment

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

But we would still keep service.address too I would assume. As ip does not match localhost for example.

BTW: This is not something related to this PR as it's done in the module logic. @webmat Could you open a separte issue for this? Nice thing here is we can always add this logic as it's not breaking but addition.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we'd keep service.address as the source of truth.

@sayden sayden force-pushed the feature/mb/zookeeper-server-metricset branch from 0687ce5 to b9e63be Compare January 28, 2019 10:20
@@ -707,7 +707,7 @@ metricbeat.modules:
#------------------------------ ZooKeeper Module ------------------------------
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that this file in x-pack must be manually updated now. @ruflin do you think that I should open an issue to automate this when running make update from OSS?

Copy link
Member

Choose a reason for hiding this comment

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

manually = running mage update in the x-pack directory or manually you mean by hand and CI will not detect it has missing content?

What behaviour do we have in filebeat here?

Copy link
Member

Choose a reason for hiding this comment

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

+1 on creating an issue to follow up on the discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I mean by manually running mage update in x-pack folder. Opening issue #10369

@sayden sayden force-pushed the feature/mb/zookeeper-server-metricset branch from f9e6c11 to b5fab40 Compare January 28, 2019 12:00
@sayden sayden added review and removed in progress Pull request is currently in progress. labels Jan 28, 2019
Copy link
Member

@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.

LGTM. I suggest we backport this to 6.x if there are no major conflicts?

@sayden sayden merged commit 3895a23 into elastic:master Jan 28, 2019
sayden added a commit to sayden/beats that referenced this pull request Jan 28, 2019
(cherry picked from commit 3895a23)

# Conflicts:
#	metricbeat/module/zookeeper/fields.go
#	x-pack/metricbeat/module/mssql/performance/data_integration_test.go
@sayden sayden added the v6.7.0 label Jan 28, 2019
sayden added a commit that referenced this pull request Jan 31, 2019
…module (#10375)

Cherry pick wasn't completed clean as we needed to adjust `service.version` field, which is documented in `fields.yml` on the module as (in master it is in ECS but ECS is not merged in 6.x)
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.

4 participants