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
Conversation
23e762a
to
4852f79
Compare
0c881b3
to
cfd710d
Compare
evt = self.clean_fields(evt) | ||
self.assert_fields_are_documented(evt) | ||
|
||
def clean_fields(self, evt): |
There was a problem hiding this comment.
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()
?
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/lables/labels/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fxied
cfd710d
to
156ecbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1a3b3b6
to
9ad29d7
Compare
9ad29d7
to
5511471
Compare
Part of #2629