Subscribe to docker stats and place some in the Container topology.#217
Subscribe to docker stats and place some in the Container topology.#217tomwilkie wants to merge 2 commits intoweaveworks:masterfrom
Conversation
22dd54a to
4608de6
Compare
probe/main.go
Outdated
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
Note this introduces a startup lag (as it connects all the stats go routines on the main thread). This should be moved off to a background thread (and parallelised?) |
4608de6 to
5422bc6
Compare
probe/tag/docker_tagger.go
Outdated
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
There's a lot of manual mutex locking going on. Since you already have a goroutine handling Docker events, why not thread all user requests through it, too? Then you can eliminate all the locks. |
|
Yes the locking makes me nervous; going to an actor model seems appropriate here. I was always considering having our own Container struct, and moving all the stats & updating stuff into that. Then docker mapper is responsible for creating / removing containers in response to events. We should probably also break out the mapper & topology logic to be a client of this type. |
probe/tag/docker_tagger.go
Outdated
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
I've been reading this for awhile and am having trouble building and keeping a mental model of what's happening. There's a lot of action at a distance, mutating the DockerTagger struct in-place. The preponderance of mutex-locking is an artifact of that. I think it would benefit from a single loop() method handling user requests, events from the Docker daemon, and events from individual /container/foo/stats streams. |
b27ec9c to
854f957
Compare
|
@peterbourgon I didn't go full actor on this, but I've rationalised the flow and locking. Let me know what you think. There is a lot of potential for refactoring here, but I'd prefer to save anything major for another PR. |
854f957 to
a2adaa2
Compare
probe/tag/docker_tagger.go
Outdated
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
Much, much easier to understand. Thanks a bunch. LGTM. |
|
Going to hold off on this until post 0.3 |
a2adaa2 to
047d503
Compare
Work towards #114