DataDog / agent-payload

Payload format description for communication between the agent and the Datadog backend
BSD 3-Clause "New" or "Revised" License
21 stars 19 forks source link

Add owner to contlcycle.ContainerEvent #241

Closed sblumenthal closed 1 year ago

sblumenthal commented 1 year ago

This PR adds the ability to attach the owner of a container object to a ContainerEvent payload.

There are two things I want to call out here: 1) I pulled out ObjectKind from EventsPayload to be its own enum, so that it could be shared between both EventsPayload and Owner. I am not sure if this refactor is against best practice or anything, as the type that was autogenerated changed (but the possible values, and the field name, did not). 2) I pulled ObjectKind out from EventsPayload so that we would not need to update two different enums when adding support for more event types, like say ECS tasks. However, this could lead to some confusion, where an owner kind of Container is technically valid at the payload level for an owner attached to a ContainerEvent, which seems not ideal.

Both of my concerns above would be fixed by defining a new enum for Container Owner Type, but I wanted to avoid doing this to prevent repeating ourselves. I am happy to make this change though.

Reviewers: please see the review guidelines.