Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Add a blocking get stats interface #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pmorton
Copy link

@pmorton pmorton commented Mar 28, 2015

Hi - I am working on an application that consumes the dockerclient api! (woot) Specifically I am working with the stats API. The implementation of the stats API in this library and great and seems well suited for short lived client application. I am writing a daemon that will monitor the stats and have some additional requirements that don't seem to work well with the current implementation.

  1. When an error occurs that causes the go routine to exit, I need to know the error and the container ID that it is related to.
  2. I need to be able to ask a specific stats monitor (go routine) to stop politely
  3. I would prefer to use channels over callbacks for `stat`` processing.

Thoughts?

uri := fmt.Sprintf("%s/%s/containers/%s/stats", client.URL.String(), APIVersion, id)
resp, err := client.HTTPClient.Get(uri)
if err != nil {
errorChan <- ContainerError{Error: err, ContainerId: id}
Copy link
Owner

Choose a reason for hiding this comment

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

I agree with the errorChan when the stats stream is open, but should we use an error code return for opening the stream (and check this http req)?

I am not sure about this one (what's the easiest for the dev), it's an honest question. Also, tests?

@ehazlett
Copy link
Collaborator

Yeah I'm not sure either. When I added the original implementation I was thinking along the lines of the event stream which handles things that way (callback).

+1 for stopping events for a single container.

@donhcd
Copy link
Collaborator

donhcd commented Apr 6, 2015

@pmorton @ehazlett #71 handles the 3 requests that pmorton listed above - could you take a look at it? it has slightly more complex logic, but it's been tested and it works

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants