containerd/cmd/ctr
Stephen J Day af2d7f0e55
events: initial support for filters
This change further plumbs the components required for implementing
event filters. Specifically, we now have the ability to filter on the
`topic` and `namespace`.

In the course of implementing this functionality, it was found that
there were mismatches in the events API that created extra serialization
round trips. A modification to `typeurl.MarshalAny` and a clear
separation between publishing and forwarding allow us to avoid these
serialization issues.

Unfortunately, this has required a few tweaks to the GRPC API, so this
is a breaking change. `Publish` and `Forward` have been clearly separated in
the GRPC API. `Publish` honors the contextual namespace and performs
timestamping while `Forward` simply validates and forwards. The behavior
of `Subscribe` is to propagate events for all namespaces unless
specifically filtered (and hence the relation to this particular change.

The following is an example of using filters to monitor the task events
generated while running the [bucketbench tool](https://github.com/estesp/bucketbench):

```
$ ctr events 'topic~=/tasks/.+,namespace==bb'
...
2017-07-28 22:19:51.78944874 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-6-8","pid":25889}
2017-07-28 22:19:51.791893688 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-4-8","pid":25882}
2017-07-28 22:19:51.792608389 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-2-9","pid":25860}
2017-07-28 22:19:51.793035217 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-5-6","pid":25869}
2017-07-28 22:19:51.802659622 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-0-7","pid":25877}
2017-07-28 22:19:51.805192898 +0000 UTC   bb        /tasks/start   {"container_id":"bb-ctr-3-6","pid":25856}
2017-07-28 22:19:51.832374931 +0000 UTC   bb        /tasks/exit   {"container_id":"bb-ctr-8-6","id":"bb-ctr-8-6","pid":25864,"exited_at":"2017-07-28T22:19:51.832013043Z"}
2017-07-28 22:19:51.84001249 +0000 UTC   bb        /tasks/exit   {"container_id":"bb-ctr-2-9","id":"bb-ctr-2-9","pid":25860,"exited_at":"2017-07-28T22:19:51.839717714Z"}
2017-07-28 22:19:51.840272635 +0000 UTC   bb        /tasks/exit   {"container_id":"bb-ctr-7-6","id":"bb-ctr-7-6","pid":25855,"exited_at":"2017-07-28T22:19:51.839796335Z"}
...
```

In addition to the events changes, we now display the namespace origin
of the event in the cli tool.

This will be followed by a PR to add individual field filtering for the
events API for each event type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-31 12:53:18 -07:00
..
apply.go cmd/dist: completely remove dist command 2017-07-14 15:48:39 -07:00
attach.go update to github.com/sirupsen/logrus v1.0.0 2017-07-21 15:39:14 -07:00
checkpoint.go Remove protos from Go client API 2017-07-12 14:32:37 -07:00
content.go cmd/{ctr, dist}: move content command to ctr 2017-07-14 15:31:36 -07:00
delete.go cmd/ctr: allow deleting multiple containers at once 2017-07-27 15:30:35 -07:00
events.go events: initial support for filters 2017-07-31 12:53:18 -07:00
exec.go update to github.com/sirupsen/logrus v1.0.0 2017-07-21 15:39:14 -07:00
export.go client: add Import() and Export() for importing/exporting image in OCI format 2017-07-28 04:47:53 +00:00
fetch.go comment: dist -> ctr 2017-07-16 14:45:56 +00:00
fetchobject.go cmd/dist: completely remove dist command 2017-07-14 15:48:39 -07:00
images.go client: add Import() and Export() for importing/exporting image in OCI format 2017-07-28 04:47:53 +00:00
import.go client: add Import() and Export() for importing/exporting image in OCI format 2017-07-28 04:47:53 +00:00
info.go containerd: remove GRPC service export 2017-07-12 16:57:47 -07:00
kill.go Add 'ArgsUsage' for some ctr sub-cmds 2017-06-15 16:04:11 +08:00
labels.go cmd/{ctr,dist}: label can be a verb 2017-07-13 14:36:13 -07:00
list.go cmd/ctr: container list should not look up image 2017-07-17 14:51:36 -07:00
main_unix.go Initial windows runtime work 2017-04-07 09:20:44 -07:00
main.go cmd/ctr: allow deleting multiple containers at once 2017-07-27 15:30:35 -07:00
namespaces.go cmd/{ctr,dist}: label can be a verb 2017-07-13 14:36:13 -07:00
pause.go Port ctr to use client 2017-06-06 14:53:50 -07:00
pprof_unix.go Update ctr so it works again on windows 2017-07-21 18:19:48 +02:00
pprof_windows.go Update ctr so it works again on windows 2017-07-21 18:19:48 +02:00
pprof.go Update ctr so it works again on windows 2017-07-21 18:19:48 +02:00
ps.go Add Exec IDs 2017-07-06 15:23:08 -07:00
pull.go cmd/dist: completely remove dist command 2017-07-14 15:48:39 -07:00
push.go cmd/dist: completely remove dist command 2017-07-14 15:48:39 -07:00
pushobject.go cmd/dist: completely remove dist command 2017-07-14 15:48:39 -07:00
resume.go Port ctr to use client 2017-06-06 14:53:50 -07:00
rootfs.go cmd/dist: completely remove dist command 2017-07-14 15:48:39 -07:00
run_unix.go client, ctr: allow specifying unmanaged rootfs dir 2017-07-28 04:45:04 +00:00
run_windows.go update to github.com/sirupsen/logrus v1.0.0 2017-07-21 15:39:14 -07:00
run.go client, ctr: allow specifying unmanaged rootfs dir 2017-07-28 04:45:04 +00:00
shim.go update to github.com/sirupsen/logrus v1.0.0 2017-07-21 15:39:14 -07:00
signals_linux.go Partial port to Darwin and FreeBSD 2017-05-04 18:11:53 +01:00
signals_unix.go Partial port to Darwin and FreeBSD 2017-05-04 18:11:53 +01:00
snapshot.go snapshot: replace "readonly" with View snapshot type 2017-07-24 16:58:01 -07:00
utils_unix.go prepareStdio: use named return for err 2017-05-24 15:34:39 +01:00
utils_windows.go forward all signals to the container 2017-04-22 01:46:57 +03:00
utils.go update to github.com/sirupsen/logrus v1.0.0 2017-07-21 15:39:14 -07:00
version.go Port ctr to use client 2017-06-06 14:53:50 -07:00