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

Add system tests to check document fields for docker module #2971

Merged
merged 1 commit into from Nov 18, 2016

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Nov 9, 2016

Part of #2629

@ruflin ruflin added review Metricbeat Metricbeat labels Nov 9, 2016
@ruflin ruflin mentioned this pull request Nov 9, 2016
19 tasks
@ruflin ruflin force-pushed the mb-docker-improvements branch 3 times, most recently from 23e762a to 4852f79 Compare November 10, 2016 14:14
@ruflin ruflin added in progress Pull request is currently in progress. and removed review labels Nov 10, 2016
@ruflin ruflin force-pushed the mb-docker-improvements branch 4 times, most recently from 0c881b3 to cfd710d Compare November 15, 2016 14:26
@ruflin ruflin added review and removed in progress Pull request is currently in progress. labels Nov 15, 2016
evt = self.clean_fields(evt)
self.assert_fields_are_documented(evt)

def clean_fields(self, evt):
Copy link
Member

Choose a reason for hiding this comment

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

That's a generic name. How about remove_labels_and_ports()?

Copy link
Member Author

Choose a reason for hiding this comment

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

renamed

self.assert_fields_are_documented(evt)

def clean_fields(self, evt):
# TODO: How to handle lables and ports?
Copy link
Member

Choose a reason for hiding this comment

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

We can't validate the labels so think this handling is good. Also there's typo in the comment s/lables/labels/, but I think the comment can be removed.

ports is an array of objects and I don't think we have a way to document the fields of those objects, do we? We could document the field as docker.container.ports.ip for example and ignore the fact that ports is an array. Then I think we would just need to update the python code for flatten_object to step into arrays then the assert_fields_are_documented would properly validate those fields from the objects in the array.

Copy link
Member Author

Choose a reason for hiding this comment

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

I prefer to skip this for the moment as I wanted to look into how we can perhaps change the ports structure. But I agree, having something like described above could not only be useful here.

@@ -50,6 +50,8 @@ func FetchStats(client *docker.Client) ([]DockerStat, error) {

containersList := []DockerStat{}
for _, container := range containers {
// This is currently very inefficient as docker calculates the average for each request,
// means each request will take at least 1s. Getting all stats at once is implemented here: https://github.com/docker/docker/pull/25361
containersList = append(containersList, exportContainerStats(client, &container))
Copy link
Member

Choose a reason for hiding this comment

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

Any idea how long each request takes? Does each request block for some time period so that it can take two samples in order to calculate a delta or percentage?

Copy link
Member Author

Choose a reason for hiding this comment

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

Each request takes at least 2 seconds: https://github.com/docker/docker/blob/master/cli/command/container/stats_helpers.go#L148 I'm planing to open an issue in Docker to discuss if there could be flag that raw flags are shipped. There is also moby/moby#25361 which will be useful to fetch all stats for the containers at once.

output = self.read_output_json()
evt = output[0]

# TODO: How to handle lables and ports?
Copy link
Member

Choose a reason for hiding this comment

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

s/lables/labels/

Copy link
Member Author

Choose a reason for hiding this comment

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

fxied

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.

LGTM

@ruflin ruflin force-pushed the mb-docker-improvements branch 3 times, most recently from 1a3b3b6 to 9ad29d7 Compare November 17, 2016 16:03
@andrewkroh andrewkroh merged commit 647ed86 into elastic:master Nov 18, 2016
@ruflin ruflin deleted the mb-docker-improvements branch November 18, 2016 13:21
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.

None yet

2 participants