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

[Improvement] Optimize events handling and migrate to official docker client #224

Open
stokito opened this issue Nov 15, 2020 · 0 comments

Comments

@stokito
Copy link
Contributor

stokito commented Nov 15, 2020

In connector/docker.go:67 to subscribe to events ctop uses AddEventListener() from fsouza/go-dockerclient.
The problem is that there is a lot of types of events so ctop filters out all except of events with container type:

if e.Type != "container" {
	continue
}

In fact docker Monitor Events API has a param filters that can be set to {"type":["container"]} to subscribe only to container events.
If we'll use then we may improve performance and remove the if e.Type != "container" { continue } line.
The problem is that the fsouza/go-dockerclient doesn't have a binding to filter param. We can create a PR but the go-dockerclient package seems obsolete and "was created before Docker had an official Go SDK. For new projects, using the official SDK is probably more appropriate as go-dockerclient lags behind the official SDK".
The official Docker Go SDK already supports the filters param:

So what do you think about to migrate to Official Docker SDK? If we migrate then we can the filters param.
As far I see ctop uses only few API calls and can be easily migrated to Official SDK but maybe I don't know something.

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

1 participant