Skip to content

Commit

Permalink
Add doc strings to help explain why changes are the way they are
Browse files Browse the repository at this point in the history
  • Loading branch information
leehinman committed Oct 19, 2023
1 parent d075980 commit 4dc26ba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,11 @@ func sanitizeIPs(ips []string) []string {
return validIPs
}

// promoteOutputQueueSettings checks to see if the output
// configuration has queue settings defined and if so it promotes them
// to the top level queue settings. This is done to allow existing
// behavior of specifying queue settings at the top level or like
// elastic-agent that specifies queue settings under the output
func promoteOutputQueueSettings(bc *beatConfig) error {
if bc.Output.IsSet() && bc.Output.Config().Enabled() {
pc := pipeline.Config{}
Expand Down
8 changes: 6 additions & 2 deletions libbeat/outputs/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ import (
// loading an output must return an error.
func Fail(err error) (Group, error) { return Group{}, err }

// Success create a valid output Group response for a set of client instances.
// The first argument is expected to contain a queue config.Namespace.
// Success create a valid output Group response for a set of client
// instances. The first argument is expected to contain a queue
// config.Namespace. The queue config is passed to assign the queue
// factory when elastic-agent reloads the output.
func Success(cfg config.Namespace, batchSize, retry int, clients ...Client) (Group, error) {
var q queue.QueueFactory
if cfg.IsSet() && cfg.Config().Enabled() {
Expand Down Expand Up @@ -75,6 +77,8 @@ func NetworkClients(netclients []NetworkClient) []Client {

// SuccessNet create a valid output Group and creates client instances
// The first argument is expected to contain a queue config.Namespace.
// The queue config is passed to assign the queue factory when
// elastic-agent reloads the output.
func SuccessNet(cfg config.Namespace, loadbalance bool, batchSize, retry int, netclients []NetworkClient) (Group, error) {

if !loadbalance {
Expand Down
10 changes: 8 additions & 2 deletions libbeat/publisher/pipeline/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ type outputController struct {

workerChan chan publisher.Batch

consumer *eventConsumer
workers []outputWorker
consumer *eventConsumer
workers []outputWorker
// The InputQueueSize can be set when the Beat is started, in
// libbeat/cmd/instance/Settings we need to preserve that
// value and pass it into the queue factory. The queue
// factory could be made from elastic-agent output
// configuration reloading which doesn't have access to this
// setting.
inputQueueSize int
}

Expand Down

0 comments on commit 4dc26ba

Please sign in to comment.