Skip to content

Commit

Permalink
[libbeat] Clarify field name / remove redundant semaphore creation (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
faec authored and syepes committed Apr 9, 2020
1 parent 879879a commit db9a4ed
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
- The `libbeat/outputs/tls.go` file has been removed. All exported symbols in that file (`libbeat/outputs.*`) are now available as `libbeat/common/tlscommon.*`. {pull}16734[16734]
- The newly generated Beats are using go modules to manage dependencies. {pull}16288[16288]
- Extract Elasticsearch client logic from `outputs/elasticsearch` package into new `esclientleg` package. {pull}16150[16150]
- Rename `queue.BufferConfig.Events` to `queue.BufferConfig.MaxEvents`. {pull}17622[17622]

==== Bugfixes

Expand Down
6 changes: 1 addition & 5 deletions libbeat/publisher/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ func New(
return nil, err
}

if count := p.queue.BufferConfig().Events; count > 0 {
p.eventSema = newSema(count)
}

maxEvents := p.queue.BufferConfig().Events
maxEvents := p.queue.BufferConfig().MaxEvents
if maxEvents <= 0 {
// Maximum number of events until acker starts blocking.
// Only active if pipeline can drop events.
Expand Down
2 changes: 1 addition & 1 deletion libbeat/publisher/queue/memqueue/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (b *broker) Close() error {

func (b *broker) BufferConfig() queue.BufferConfig {
return queue.BufferConfig{
Events: b.bufSize,
MaxEvents: b.bufSize,
}
}

Expand Down
4 changes: 3 additions & 1 deletion libbeat/publisher/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ type Queue interface {
// but still dropping events, the pipeline can use the buffer information,
// to define an upper bound of events being active in the pipeline.
type BufferConfig struct {
Events int // can be <= 0, if queue can not determine limit
// MaxEvents is the maximum number of events the queue can hold at capacity.
// A value <= 0 means there is no fixed limit.
MaxEvents int
}

// ProducerConfig as used by the Pipeline to configure some custom callbacks
Expand Down
2 changes: 1 addition & 1 deletion libbeat/publisher/queue/spool/spool.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *diskSpool) Close() error {

// BufferConfig returns the queue initial buffer settings.
func (s *diskSpool) BufferConfig() queue.BufferConfig {
return queue.BufferConfig{Events: -1}
return queue.BufferConfig{MaxEvents: -1}
}

// Producer creates a new queue producer for publishing events.
Expand Down

0 comments on commit db9a4ed

Please sign in to comment.