Skip to content

Make size of event queue configurable #535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/tetragon/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const (

keyRBSize = "rb-size"
keyRBSizeTotal = "rb-size-total"

keyEventQueueSize = "event-queue-size"
)

var (
Expand Down Expand Up @@ -133,4 +135,6 @@ func readAndSetFlags() {

cpuProfile = viper.GetString(keyCpuProfile)
memProfile = viper.GetString(keyMemProfile)

option.Config.EventQueueSize = viper.GetUint(keyEventQueueSize)
}
1 change: 1 addition & 0 deletions cmd/tetragon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func execute() error {
flags.String(keyCiliumBPF, "", "Cilium BPF directory")
flags.Bool(keyEnableProcessCred, false, "Enable process_cred events")
flags.Bool(keyEnableProcessNs, false, "Enable namespace information in process_exec and process_kprobe events")
flags.Uint(keyEventQueueSize, 10000, "Set the size of the internal event queue.")

// Config files
flags.String(keyConfigFile, "", "Configuration file to load from")
Expand Down
2 changes: 2 additions & 0 deletions pkg/option/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type config struct {

RBSize int
RBSizeTotal int

EventQueueSize uint
}

var (
Expand Down
7 changes: 6 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/cilium/tetragon/pkg/health"
"github.com/cilium/tetragon/pkg/logger"
"github.com/cilium/tetragon/pkg/metrics/eventmetrics"
"github.com/cilium/tetragon/pkg/option"
"github.com/cilium/tetragon/pkg/sensors"
"github.com/cilium/tetragon/pkg/version"
)
Expand Down Expand Up @@ -64,8 +65,12 @@ func NewServer(ctx context.Context, wg *sync.WaitGroup, notifier notifier, obser
}

func newListener() *getEventsListener {
var chanSize uint = 10000
if option.Config.EventQueueSize > 0 {
chanSize = option.Config.EventQueueSize
}
return &getEventsListener{
events: make(chan *tetragon.GetEventsResponse, 100),
events: make(chan *tetragon.GetEventsResponse, chanSize),
}
}

Expand Down