-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Currently, the ContainerService has an Events method that emits events for container lifecycle operations. The intent of this issue is to bring that event system to the wider subsystems.
The current Event type is specific to execution related use cases.
We also have a package to allow the emission of events through a common, context-based interface. Event emitters should leverage this interface to decouple the event emission code from event propagation. We should make it easy to setup a context with an event emitter that allows all subsystems to send out events.
The key to this work is defining a common envelope for emitting events. The current type, events.Envelope defines some of the necessary parts but we'll need to define a protobuf version, as well. We can start with something like this:
type Envelope struct {
Timestamp time.Time
Topic string // defines slash-oriented topic-heirarchy
Event interface{}
}
We can match this with a protobuf type as follows:
message Envelope {
Timestamp timestamp = 1;
string topic = 2;
google.protobuf.Any event = 3;
}Events can be filtered by topic. Let's say we have the following topics:
/service/container/exit
/service/container/oom
/service/content/write
/service/image/register
/plugin/register
/plugin/error
One could select all events from services with the following event filter, based on glob matching:
/service/**
If you want to know which plugins are registered, you could push in a filter like this:
/plugin/register
Effectively, we can control which aspects of an event can be filtered by selecting the topic in which it is published. Understanding the behavior of containerd from a consumer can be done by selecting one or more of these topics.
Tasks:
- Define common
Eventsservice - Define event envelope to hold subsystem specific events.
- Port the
ContainerServiceevents to use the new service - Add support from various other subsystems
- Image Service
- Content Service
- Rootfs Service