Skip to content
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

Update sarama to master + SASL fix #2798

Merged
merged 3 commits into from
Oct 18, 2016
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
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ https://github.com/elastic/beats/compare/v5.0.0-rc1...master[Check the HEAD diff
*Affecting all Beats*

- Fix kafka output re-trying batches with too large events. {issue}2735[2735]
- Fix kafka output protocol error if `version: 0.10` is configured. {issue}2651[2651]
- Fix kafka output connection closed by broker on SASL/PLAIN. {issue}2717[2717]

*Metricbeat*

Expand Down
5 changes: 4 additions & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ import:
- package: github.com/miekg/dns
version: 5d001d020961ae1c184f9f8152fdc73810481677
- package: github.com/Shopify/sarama
version: v1.10.0
version: fix/sasl-handshake
repo: https://github.com/urso/sarama
- package: github.com/rcrowley/go-metrics
version: ab2277b1c5d15c3cba104e9cbddbdfc622df5ad8
- package: github.com/klauspost/crc32
version: v1.0
- package: github.com/golang/snappy
Expand Down
24 changes: 22 additions & 2 deletions libbeat/outputs/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import (
"errors"
"fmt"
"strings"
"sync"
"time"

"github.com/Shopify/sarama"
metrics "github.com/rcrowley/go-metrics"
"github.com/rcrowley/go-metrics/exp"

"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/common/op"
Expand Down Expand Up @@ -35,11 +38,26 @@ const (
defaultMaxWaitRetry = 60 * time.Second
)

var kafkaMetricsRegistryInstance metrics.Registry

func init() {
sarama.Logger = kafkaLogger{}

reg := metrics.NewPrefixedRegistry("libbeat.kafka.")

// Note: registers /debug/metrics handler for displaying all expvar counters
exp.Exp(reg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will that also include our other expvars under /debug/metrics? If yes, it's kind of strange to register them here, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, debug/metrics will display all expvars.

kafkaMetricsRegistryInstance = reg

outputs.RegisterOutputPlugin("kafka", New)
}

var kafkaMetricsOnce sync.Once

func kafkaMetricsRegistry() metrics.Registry {
return kafkaMetricsRegistryInstance
}

var debugf = logp.MakeDebug("kafka")

var (
Expand Down Expand Up @@ -71,8 +89,9 @@ var (
"0.9": sarama.V0_9_0_1,

"0.10.0.0": sarama.V0_10_0_0,
"0.10.0": sarama.V0_10_0_0,
"0.10": sarama.V0_10_0_0,
"0.10.0.1": sarama.V0_10_0_1,
"0.10.0": sarama.V0_10_0_1,
"0.10": sarama.V0_10_0_1,
}
)

Expand Down Expand Up @@ -313,5 +332,6 @@ func newKafkaConfig(config *kafkaConfig) (*sarama.Config, error) {
}
k.Version = version

k.MetricRegistry = kafkaMetricsRegistry()
return k, nil
}
1 change: 1 addition & 0 deletions vendor/github.com/Shopify/sarama/.github/ISSUE_TEMPLATE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/Shopify/sarama/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 133 additions & 5 deletions vendor/github.com/Shopify/sarama/broker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/Shopify/sarama/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions vendor/github.com/Shopify/sarama/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading