File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ type ContainerWatcher interface {
23
23
GetContainerCollection () * containercollection.ContainerCollection
24
24
GetSocketEnricher () * socketenricher.SocketEnricher
25
25
GetContainerSelector () * containercollection.ContainerSelector
26
+ RegisterContainerReceiver (receiver ContainerReceiver )
27
+ UnregisterContainerReceiver (receiver ContainerReceiver )
26
28
}
27
29
28
30
type CustomTracerInitializer interface {
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ type ContainerWatcher struct {
76
76
// Third party components
77
77
thirdPartyTracersInitializers mapset.Set [containerwatcher.CustomTracerInitializer ]
78
78
thirdPartyEnricher containerwatcher.TaskBasedEnricher
79
+ thirdPartyContainerReceivers mapset.Set [containerwatcher.ContainerReceiver ]
79
80
80
81
// Cache and state
81
82
objectCache objectcache.ObjectCache
@@ -380,6 +381,15 @@ func (cw *ContainerWatcher) GetContainerSelector() *containercollection.Containe
380
381
return & cw .containerSelector
381
382
}
382
383
384
+ func (cw * ContainerWatcher ) RegisterContainerReceiver (receiver containerwatcher.ContainerReceiver ) {
385
+ cw .thirdPartyContainerReceivers .Add (receiver )
386
+ }
387
+
388
+ // UnregisterContainerReceiver unregisters a container receiver
389
+ func (cw * ContainerWatcher ) UnregisterContainerReceiver (receiver containerwatcher.ContainerReceiver ) {
390
+ cw .thirdPartyContainerReceivers .Remove (receiver )
391
+ }
392
+
383
393
func (cw * ContainerWatcher ) eventProcessingLoop () {
384
394
ticker := time .NewTicker (50 * time .Millisecond )
385
395
defer ticker .Stop ()
Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ func (cw *ContainerWatcher) StartContainerCollection(ctx context.Context) error
57
57
cw .networkStreamClient .ContainerCallback ,
58
58
}
59
59
60
+ for receiver := range cw .thirdPartyContainerReceivers .Iter () {
61
+ cw .callbacks = append (cw .callbacks , receiver .ContainerCallback )
62
+ }
63
+
60
64
// Define the different options for the container collection instance
61
65
opts := []containercollection.ContainerCollectionOption {
62
66
// Get Notifications from the container collection
You can’t perform that action at this time.
0 commit comments