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

fix #294 #295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions kafka_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type kafkaOpts struct {
tlsInsecureSkipTLSVerify bool
kafkaVersion string
useZooKeeperLag bool
uriZookeeper []string
uriZookeeper string
labels string
metadataRefreshInterval string
serviceName string
Expand Down Expand Up @@ -236,7 +236,7 @@ func NewExporter(opts kafkaOpts, topicFilter string, groupFilter string) (*Expor

if opts.useZooKeeperLag {
glog.V(DEBUG).Infoln("Using zookeeper lag, so connecting to zookeeper")
zookeeperClient, err = kazoo.NewKazoo(opts.uriZookeeper, nil)
zookeeperClient, err = kazoo.NewKazooFromConnectionString(opts.uriZookeeper, nil)
if err != nil {
return nil, errors.Wrap(err, "error connecting to zookeeper")
}
Expand Down Expand Up @@ -726,7 +726,7 @@ func main() {
toFlagBoolVar("tls.insecure-skip-tls-verify", "If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.", false, "false", &opts.tlsInsecureSkipTLSVerify)
toFlagStringVar("kafka.version", "Kafka broker version", sarama.V2_0_0_0.String(), &opts.kafkaVersion)
toFlagBoolVar("use.consumelag.zookeeper", "if you need to use a group from zookeeper", false, "false", &opts.useZooKeeperLag)
toFlagStringsVar("zookeeper.server", "Address (hosts) of zookeeper server.", "localhost:2181", &opts.uriZookeeper)
toFlagStringVar("zookeeper.server", "Address (hosts) of zookeeper server.", "localhost:2181", &opts.uriZookeeper)
toFlagStringVar("kafka.labels", "Kafka cluster name", "", &opts.labels)
toFlagStringVar("refresh.metadata", "Metadata refresh interval", "30s", &opts.metadataRefreshInterval)
toFlagBoolVar("offset.show-all", "Whether show the offset/lag for all consumer group, otherwise, only show connected consumer groups", true, "true", &opts.offsetShowAll)
Expand Down
5 changes: 3 additions & 2 deletions simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
"errors"
"github.com/Shopify/sarama"
"io/ioutil"
"log"
"net/http"
"testing"
"time"

"github.com/Shopify/sarama"
)

var bootstrap_servers = []string{"localhost:9092"}
Expand Down Expand Up @@ -65,7 +66,7 @@ func execute(handler func(response *http.Response)) {
func runServer() {
opts := kafkaOpts{}
opts.uri = bootstrap_servers
opts.uriZookeeper = []string{"localhost:2181"}
opts.uriZookeeper = "localhost:2181"
opts.kafkaVersion = sarama.V1_0_0_0.String()
opts.metadataRefreshInterval = "30s"
setup("localhost:9304", "/metrics", ".*", ".*", false, opts, nil)
Expand Down