Skip to content

Commit

Permalink
[libbeat] Fix dropped queue feature metadata / remove unused helper (e…
Browse files Browse the repository at this point in the history
…lastic#17666) (elastic#17756)

(cherry picked from commit a067c4a)
  • Loading branch information
faec committed Apr 24, 2020
1 parent 59a11f6 commit 1205e19
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
- Require logger as first parameter for `outputs.elasticsearch.client#BulkReadItemStatus`. {pull}16761[16761]
- 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]
- Remove `queue.Feature` and replace `queue.RegisterType` with `queue.RegisterQueueType`. {pull}17666[17666]

==== Bugfixes

Expand Down
17 changes: 7 additions & 10 deletions libbeat/publisher/queue/memqueue/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ import (
"github.com/elastic/beats/v7/libbeat/publisher/queue"
)

// Feature exposes a memory queue.
var Feature = queue.Feature("mem",
create,
feature.MakeDetails(
"Memory queue",
"Buffer events in memory before sending to the output.",
feature.Stable),
)

type broker struct {
done chan struct{}

Expand Down Expand Up @@ -81,7 +72,13 @@ type chanList struct {
}

func init() {
queue.RegisterType("mem", create)
queue.RegisterQueueType(
"mem",
create,
feature.MakeDetails(
"Memory queue",
"Buffer events in memory before sending to the output.",
feature.Stable))
}

func create(
Expand Down
14 changes: 4 additions & 10 deletions libbeat/publisher/queue/queue_reg.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (
)

// Namespace is the feature namespace for queue definition.
var Namespace = "libbeat.queue"
const Namespace = "libbeat.queue"

// RegisterType registers a new queue type.
func RegisterType(name string, fn Factory) {
f := Feature(name, fn, feature.MakeDetails(name, "", feature.Undefined))
feature.MustRegister(f)
// RegisterQueueType registers a new queue type.
func RegisterQueueType(name string, factory Factory, details feature.Details) {
feature.MustRegister(feature.New(Namespace, name, factory, details))
}

// FindFactory retrieves a queue types constructor. Returns nil if queue type is unknown
Expand All @@ -43,8 +42,3 @@ func FindFactory(name string) Factory {

return factory
}

// Feature creates a new type of queue.
func Feature(name string, factory Factory, description feature.Details) *feature.Feature {
return feature.New(Namespace, name, factory, description)
}
16 changes: 7 additions & 9 deletions libbeat/publisher/queue/spool/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ import (
"github.com/elastic/go-txfile"
)

// Feature exposes a spooling to disk queue.
var Feature = queue.Feature("spool", create,
feature.MakeDetails(
"Memory queue",
"Buffer events in memory before sending to the output.",
feature.Beta),
)

func init() {
queue.RegisterType("spool", create)
queue.RegisterQueueType(
"spool",
create,
feature.MakeDetails(
"Disk spool",
"Buffer events in disk spool before sending to the output.",
feature.Beta))
}

func create(
Expand Down

0 comments on commit 1205e19

Please sign in to comment.