diff --git a/cmd/opentelemetry-collector/app/exporter/kafka/factory.go b/cmd/opentelemetry-collector/app/exporter/kafka/factory.go index f34d8340c042..45092bb6acde 100644 --- a/cmd/opentelemetry-collector/app/exporter/kafka/factory.go +++ b/cmd/opentelemetry-collector/app/exporter/kafka/factory.go @@ -29,10 +29,10 @@ const ( TypeStr = "jaeger_kafka" ) -// OptionsFactory returns initialized es.OptionsFactory structure. +// OptionsFactory returns initialized kafka.Options structure. type OptionsFactory func() *kafka.Options -// DefaultOptions creates Kadka options supported by this exporter. +// DefaultOptions creates Kafka options supported by this exporter. func DefaultOptions() *kafka.Options { return &kafka.Options{} } diff --git a/cmd/opentelemetry-collector/app/exporter/kafka/factory_test.go b/cmd/opentelemetry-collector/app/exporter/kafka/factory_test.go index e56ce8a4e22b..2bb8f0cdebc5 100644 --- a/cmd/opentelemetry-collector/app/exporter/kafka/factory_test.go +++ b/cmd/opentelemetry-collector/app/exporter/kafka/factory_test.go @@ -29,16 +29,19 @@ import ( func TestCreateTraceExporter(t *testing.T) { v, _ := jConfig.Viperize(DefaultOptions().AddFlags) + opts := DefaultOptions() + opts.InitFromViper(v) factory := &Factory{OptionsFactory: func() *kafka.Options { - opts := DefaultOptions() - opts.InitFromViper(v) return opts }} exporter, err := factory.CreateTraceExporter(zap.NewNop(), factory.CreateDefaultConfig()) require.Nil(t, exporter) assert.EqualError(t, err, "kafka: client has run out of available brokers to talk to (Is your cluster reachable?)") +} - exporter, err = factory.CreateTraceExporter(zap.NewNop(), nil) +func TestCreateTraceExporter_nilConfig(t *testing.T) { + factory := &Factory{} + exporter, err := factory.CreateTraceExporter(zap.NewNop(), nil) require.Nil(t, exporter) assert.EqualError(t, err, "could not cast configuration to jaeger_kafka") } diff --git a/pkg/kafka/auth/kerberos.go b/pkg/kafka/auth/kerberos.go index 66c9ac396e65..5fce43048e91 100644 --- a/pkg/kafka/auth/kerberos.go +++ b/pkg/kafka/auth/kerberos.go @@ -22,11 +22,11 @@ import ( type KerberosConfig struct { ServiceName string `mapstructure:"service_name"` Realm string `mapstructure:"realm"` - UseKeyTab bool `mapstructure:"use_key_tab"` + UseKeyTab bool `mapstructure:"use_keytab"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` ConfigPath string `mapstructure:"config_file"` - KeyTabPath string `mapstructure:"key_tab_file"` + KeyTabPath string `mapstructure:"keytab_file"` } func setKerberosConfiguration(config *KerberosConfig, saramaConfig *sarama.Config) {