Skip to content

closes #35702 introduce « exec_die » event#35744

Merged
vdemeester merged 1 commit into
moby:masterfrom
ndeloof:35702
Jan 19, 2018
Merged

closes #35702 introduce « exec_die » event#35744
vdemeester merged 1 commit into
moby:masterfrom
ndeloof:35702

Conversation

@ndeloof
Copy link
Copy Markdown
Contributor

@ndeloof ndeloof commented Dec 8, 2017

Signed-off-by: Nicolas De Loof [email protected]

- What I did

Implemented a new event "exec_die" when containerd report exec termination

- How I did it

execConfig is already updated in daemon, just added event logging

- How to verify it

  • docker run -d ubuntu sleep 100
  • docker events (on another terminal)
  • docker exec $ID echo hello

events console will show "exec_die" event

- Description for the changelog

introduce new exec_die event on exec termination

- A picture of a cute animal (not mandatory but encouraged)

download

Comment thread integration/system/event_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be good to t.Fatal(err) here so we have more information about the failure.

Comment thread integration/system/event_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

t.Fatal("timeout hit")

Comment thread integration/system/event_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should probably check the other fields of the event as well, at least the event name

Copy link
Copy Markdown
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Copy Markdown
Member

Some lint issues;

16:11:50 integration/system/event_test.go:1::warning: file is not gofmted with -s (gofmt)
16:11:50 integration/system/event_test.go:1::warning: file is not goimported (goimports)

@thaJeztah
Copy link
Copy Markdown
Member

Can you also squash your commits? Changes look small enough to be in a single commit

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

I'd like to have a quick check with other maintainers tomorrow at the maintainers meeting, but overall this looks good 👍

Comment thread daemon/monitor.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally, I think this PR looks good; I want to double check on this one with other maintainers. I think the other exec requests;

  • have exec_foo:<command and arguments> as event (this was actually a mistake, but we had to keep it for backward-compatibility, and still have to work on improving that)
  • do not have an execId property; I think it's useful, but wondering if we should see this as a separate feature, and also consider adding the attribute to other exec_xx events (so that events can be related to each other)

FWIW, there's some weird things still with the events endpoint (e.g. "custom attributes" and "actual attributes" are merged, and can "overlap"); something that should be looked at

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit "exec_id"

@thaJeztah
Copy link
Copy Markdown
Member

Discussing in the maintainers meeting; can you add a second commit that adds the execId to the other exec events as well? (Where possible) Then we should be able to move this forward 👍

@thaJeztah
Copy link
Copy Markdown
Member

Thanks @ndeloof; overall this LGTM, but I have a couple of small things;

Regarding execId vs exec_id (#35744 (comment)), I had a quick look at existing properties (excluding top-level ID, Status, and From because those are deprecated),
I found timeNano (camelcase) and Actor.Attributes.exitCode (also camelcase), so I think it should be camelcase.

However, it should likely be execID instead of execId

@ndeloof can you change;

  • execId to execID? (unless @cpuguy83 has objections 😅)
  • add a note to the API version history, and document:
    • the new exec_die event type
    • document that the exec_create and exec_start events now also get an additional Actor.Attributes.execID property

Also, we should document properties in the swagger file. Looks like so far we didn't do so, so I'm ok with doing that separately in a follow-up

(example event stream below)

Details
[
  {
    "status": "pull",
    "id": "nginx:alpine",
    "Type": "image",
    "Action": "pull",
    "Actor": {
      "ID": "nginx:alpine",
      "Attributes": {
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "nginx"
      }
    },
    "scope": "local",
    "time": 1514553990,
    "timeNano": 1514553990091358700
  },
  {
    "status": "create",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "create",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo"
      }
    },
    "scope": "local",
    "time": 1514553990,
    "timeNano": 1514553990219607300
  },
  {
    "Type": "network",
    "Action": "connect",
    "Actor": {
      "ID": "1d402bbfdaf4adba234cd5c09e66127cc9066e05b383d80c5a8eb734521bbbcc",
      "Attributes": {
        "container": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
        "name": "bridge",
        "type": "bridge"
      }
    },
    "scope": "local",
    "time": 1514553990,
    "timeNano": 1514553990237711000
  },
  {
    "status": "start",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "start",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo"
      }
    },
    "scope": "local",
    "time": 1514553990,
    "timeNano": 1514553990660905000
  },
  {
    "status": "exec_create: sh ",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "exec_create: sh ",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "execId": "526c1b75e58f8d66344894ecbf6645e53382ec261e3022b95211f53f959f3138",
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo"
      }
    },
    "scope": "local",
    "time": 1514554002,
    "timeNano": 1514554002318149400
  },
  {
    "status": "exec_start: sh ",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "exec_start: sh ",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "execId": "526c1b75e58f8d66344894ecbf6645e53382ec261e3022b95211f53f959f3138",
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo"
      }
    },
    "scope": "local",
    "time": 1514554002,
    "timeNano": 1514554002319235000
  },
  {
    "status": "exec_die",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "exec_die",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "execId": "526c1b75e58f8d66344894ecbf6645e53382ec261e3022b95211f53f959f3138",
        "exitCode": "0",
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo"
      }
    },
    "scope": "local",
    "time": 1514554021,
    "timeNano": 1514554021038903600
  },
  {
    "status": "kill",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "kill",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo",
        "signal": "9"
      }
    },
    "scope": "local",
    "time": 1514554062,
    "timeNano": 1514554062808309000
  },
  {
    "status": "die",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "die",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "exitCode": "137",
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo"
      }
    },
    "scope": "local",
    "time": 1514554063,
    "timeNano": 1514554063068919300
  },
  {
    "Type": "network",
    "Action": "disconnect",
    "Actor": {
      "ID": "1d402bbfdaf4adba234cd5c09e66127cc9066e05b383d80c5a8eb734521bbbcc",
      "Attributes": {
        "container": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
        "name": "bridge",
        "type": "bridge"
      }
    },
    "scope": "local",
    "time": 1514554063,
    "timeNano": 1514554063337964000
  },
  {
    "status": "destroy",
    "id": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
    "from": "nginx:alpine",
    "Type": "container",
    "Action": "destroy",
    "Actor": {
      "ID": "9833812e5cd5abd48b4c55a10cb8276b1790cc142037971c534ba885b2307e05",
      "Attributes": {
        "image": "nginx:alpine",
        "maintainer": "NGINX Docker Maintainers <[email protected]>",
        "name": "foo"
      }
    },
    "scope": "local",
    "time": 1514554063,
    "timeNano": 1514554063457728000
  }
]

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Jan 8, 2018
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Jan 8, 2018
@ndeloof
Copy link
Copy Markdown
Contributor Author

ndeloof commented Jan 8, 2018

@thaJeztah udpated to use "execID" as requested.

@thaJeztah
Copy link
Copy Markdown
Member

@thaJeztah
Copy link
Copy Markdown
Member

oh, and squash commits where needed

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Jan 8, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Jan 8, 2018
Signed-off-by: Nicolas De Loof <[email protected]>
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Jan 8, 2018
@moby moby deleted a comment from GordonTheTurtle Jan 10, 2018
Copy link
Copy Markdown
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐮

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Copy Markdown
Member

Argh it's doing this again;

15:28:41 The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0
15:28:45 The result of hack/generate-swagger-api.sh differs
15:28:45 
15:28:45  M api/types/container/container_wait.go
15:28:45 
15:28:45 Please update api/swagger.yaml with any api changes, then 

Let me try to add a diff to that output (because we had the same problem last time)

@mdlinville
Copy link
Copy Markdown
Contributor

@vdemeester Please add an example of this to https://github.com/docker/cli/blob/master/docs/reference/commandline/events.md so that the docs will be updated. That will need to be cherry-picked into docker/docker-ce. @thaJeztah CC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants