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

Add Kafka OTEL receiver/ingester #2221

Merged
merged 3 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions cmd/opentelemetry-collector/app/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"

"github.com/jaegertracing/jaeger/cmd/ingester/app"
ingestrApp "github.com/jaegertracing/jaeger/cmd/ingester/app"
"github.com/jaegertracing/jaeger/cmd/opentelemetry-collector/app/exporter/cassandra"
"github.com/jaegertracing/jaeger/cmd/opentelemetry-collector/app/exporter/elasticsearch"
"github.com/jaegertracing/jaeger/cmd/opentelemetry-collector/app/exporter/jaegerexporter"
Expand Down Expand Up @@ -59,7 +59,7 @@ func Components(v *viper.Viper) config.Factories {
opts.InitFromViper(v)
return opts
}}
kafkaRec := &kafkaRec.Factory{OptionsFactory: func() *app.Options {
kafkaRec := &kafkaRec.Factory{OptionsFactory: func() *ingestrApp.Options {
opts := kafkaRec.DefaultOptions()
opts.InitFromViper(v)
return opts
Expand Down
4 changes: 2 additions & 2 deletions cmd/opentelemetry-collector/app/receiver/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package kafka
import (
"github.com/open-telemetry/opentelemetry-collector/config/configmodels"

"github.com/jaegertracing/jaeger/cmd/ingester/app"
ingesterApp "github.com/jaegertracing/jaeger/cmd/ingester/app"
)

// Config hold configuration for Jaeger kafka receiver/ingester.
type Config struct {
configmodels.ReceiverSettings `mapstructure:",squash"`
app.Options `mapstructure:",squash"`
ingesterApp.Options `mapstructure:",squash"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func TestLoadConfigAndFlags(t *testing.T) {
assert.Equal(t, "user", kafkaCfg.Options.PlainText.UserName)
assert.Equal(t, "123", kafkaCfg.Options.PlainText.Password)
assert.Equal(t, true, kafkaCfg.Options.TLS.Enabled)
assert.Equal(t, "ca.crt", kafkaCfg.Options.TLS.CAPath)
assert.Equal(t, "key.crt", kafkaCfg.Options.TLS.KeyPath)
assert.Equal(t, "cert.crt", kafkaCfg.Options.TLS.CertPath)
assert.Equal(t, true, kafkaCfg.Options.TLS.SkipHostVerify)
Expand Down
8 changes: 4 additions & 4 deletions cmd/opentelemetry-collector/app/receiver/kafka/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ import (
"github.com/open-telemetry/opentelemetry-collector/config/configmodels"
"github.com/open-telemetry/opentelemetry-collector/consumer"

"github.com/jaegertracing/jaeger/cmd/ingester/app"
ingesterApp "github.com/jaegertracing/jaeger/cmd/ingester/app"
)

const (
TypeStr = "jaeger_kafka"
)

// OptionsFactory returns initialized ingester app.Options structure.
type OptionsFactory func() *app.Options
type OptionsFactory func() *ingesterApp.Options

// DefaultOptions creates Kafka options supported by this receiver.
func DefaultOptions() *app.Options {
return &app.Options{}
func DefaultOptions() *ingesterApp.Options {
return &ingesterApp.Options{}
}

type Factory struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/cmd/ingester/app"
ingesterApp "github.com/jaegertracing/jaeger/cmd/ingester/app"
jConfig "github.com/jaegertracing/jaeger/pkg/config"
)

// TODO failing
func TestCreateTraceReceiver(t *testing.T) {
v, _ := jConfig.Viperize(app.AddFlags)
v, _ := jConfig.Viperize(ingesterApp.AddFlags)
opts := DefaultOptions()
opts.InitFromViper(v)
factory := &Factory{OptionsFactory: func() *app.Options {
factory := &Factory{OptionsFactory: func() *ingesterApp.Options {
return opts
}}
exporter, err := factory.CreateTraceReceiver(context.Background(), component.ReceiverCreateParams{Logger: zap.NewNop()}, factory.CreateDefaultConfig(), nil)
Expand Down