Commit Graph

24 Commits

Author SHA1 Message Date
David Calavera 61634758c4 Extract api types to version packages.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-30 14:14:27 -04:00
Tibor Vass b08f071e18 Revert "Merge pull request #16228 from duglin/ContextualizeEvents"
Although having a request ID available throughout the codebase is very
valuable, the impact of requiring a Context as an argument to every
function in the codepath of an API request, is too significant and was
not properly understood at the time of the review.

Furthermore, mixing API-layer code with non-API-layer code makes the
latter usable only by API-layer code (one that has a notion of Context).

This reverts commit de41640435, reversing
changes made to 7daeecd42d.

Signed-off-by: Tibor Vass <tibor@docker.com>

Conflicts:
	api/server/container.go
	builder/internals.go
	daemon/container_unix.go
	daemon/create.go
2015-09-29 14:26:51 -04:00
Doug Davis 26b1064967 Add context.RequestID to event stream
This PR adds a "request ID" to each event generated, the 'docker events'
stream now looks like this:

```
2015-09-10T15:02:50.000000000-07:00 [reqid: c01e3534ddca] de7c5d4ca927253cf4e978ee9c4545161e406e9b5a14617efb52c658b249174a: (from ubuntu) create
```
Note the `[reqID: c01e3534ddca]` part, that's new.

Each HTTP request will generate its own unique ID. So, if you do a
`docker build` you'll see a series of events all with the same reqID.
This allow for log processing tools to determine which events are all related
to the same http request.

I didn't propigate the context to all possible funcs in the daemon,
I decided to just do the ones that needed it in order to get the reqID
into the events. I'd like to have people review this direction first, and
if we're ok with it then I'll make sure we're consistent about when
we pass around the context - IOW, make sure that all funcs at the same level
have a context passed in even if they don't call the log funcs - this will
ensure we're consistent w/o passing it around for all calls unnecessarily.

ping @icecrime @calavera @crosbymichael

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-24 11:56:37 -07:00
Hu Keping 3b443abec2 Comment: add description for some code which hard to understand
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-22 09:34:49 +08:00
Morgan Bauer 2d5d606fd3
refactor stats to not use internal data structures
- refactor to make it easier to split the api in the future
 - addition to check the existing test case and make sure it contains
   some expected output

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-09-16 17:28:52 -07:00
Hu Keping d3379946ec Refactor the statistics of network in docker stats
For now docker stats will sum the rxbytes, txbytes, etc. of all
the interfaces.

It is OK for the output of CLI `docker stats` but not good for
the API response, especially when the container is in sereval
subnets.

It's better to leave these origianl data to user.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-15 15:40:34 +08:00
Brian Goff dc8a39036b Don't lookup container 4 times for stats
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-09-08 10:12:46 -04:00
Alessandro Boch 56fdb05258 Docker changes for libnetwork Sandbox
- Ground-work for integrating with user namespace support

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-09-02 17:24:56 -07:00
Morgan Bauer abd72d4008
golint fixes for daemon/ package
- some method names were changed to have a 'Locking' suffix, as the
 downcased versions already existed, and the existing functions simply
 had locks around the already downcased version.
 - deleting unused functions
 - package comment
 - magic numbers replaced by golang constants
 - comments all over

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-08-27 22:07:42 -07:00
Zhang Wei 3d6617ffe7 fix golint warnings/errors on package api/types/
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-08-07 09:43:43 +08:00
Alexander Morozov c86189d554 Update libcontainer
Replaced github.com/docker/libcontainer with
github.com/opencontainers/runc/libcontaier.
Also I moved AppArmor profile generation to docker.

Main idea of this update is to fix mounting cgroups inside containers.
After updating docker on CI we can even remove dind.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-16 16:02:26 -07:00
Alessandro Boch 8b40e44c39 Stats API to retrieve nw stats from libnetwork
- Container networking statistics are no longer
  retrievable from libcontainer after the introduction
  of libnetwork. This change adds the missing code
  for docker daemon to retireve the nw stats from
  Endpoint.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-07-01 11:15:16 -07:00
Shijiang Wei 1cbf5a54da fix the goroutine leak in the stats API if the container is not running
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-06-23 19:38:15 +08:00
Brian Goff 855a056af7 Fixes content-type/length for stats stream=false
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-06-12 13:06:06 -04:00
Lei Jitang 96123a1fd5 Add docker stats --no-stream show cpu usage
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-05-31 01:25:51 +08:00
John Howard 48f1cb4ebe Windows: refactor stats
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-20 09:08:45 -07:00
Brian Goff f3023a93d1 Allow pulling stats once and disconnecting.
Adds a `stream` query param to the stats API which allows API users to
only collect one stats entry and disconnect instead of keeping the
connection alive to stream more stats.

Also adds a `--no-stream` flag to `docker stats` which does the same

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-05-04 10:49:13 -04:00
Antonio Murdaca 65a056345c Remove jobs from stats
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-13 08:33:53 +02:00
Antonio Murdaca c79b9bab54 Remove engine.Status and replace it with standard go error
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-25 22:32:08 +01:00
Alexander Morozov 68ba5f0b69 Execdriver implementation on new libcontainer API
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-06 14:46:58 -08:00
Michael Crosby 7fed7d7eb4 Move stats api types into api/types package
Move the stats structs from the api/stats package into a new package
api/types that will contain all the api structs for docker's api request
and responses.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-02-24 10:47:47 -08:00
Michael Crosby 2f46b7601a Add pubsub package to handle robust publisher
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-20 20:21:46 -08:00
Michael Crosby 2d4fc1de05 Refactor usage calc for CPU and system usage
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-20 20:21:46 -08:00
Michael Crosby 4f174aa792 Evict stopped containers
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-20 20:21:46 -08:00