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

OTel Cassandra/Elasticsearch Exporter queue defaults #2533

Merged
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
7 changes: 6 additions & 1 deletion cmd/opentelemetry/app/exporter/cassandraexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/exporter/exporterhelper"

collector_app "github.com/jaegertracing/jaeger/cmd/collector/app"
"github.com/jaegertracing/jaeger/plugin/storage/cassandra"
)

Expand Down Expand Up @@ -54,14 +55,18 @@ func (Factory) Type() configmodels.Type {
// This function implements OTEL component.ExporterFactoryBase interface.
func (f Factory) CreateDefaultConfig() configmodels.Exporter {
opts := f.OptionsFactory()
queueSettings := exporterhelper.CreateDefaultQueueSettings()
queueSettings.NumConsumers = collector_app.DefaultNumWorkers
queueSettings.QueueSize = collector_app.DefaultQueueSize

return &Config{
ExporterSettings: configmodels.ExporterSettings{
TypeVal: TypeStr,
NameVal: TypeStr,
},
TimeoutSettings: exporterhelper.CreateDefaultTimeoutSettings(),
RetrySettings: exporterhelper.CreateDefaultRetrySettings(),
QueueSettings: exporterhelper.CreateDefaultQueueSettings(),
QueueSettings: queueSettings,
Options: *opts,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"go.opentelemetry.io/collector/config/configerror"
"go.opentelemetry.io/collector/config/configmodels"

collector_app "github.com/jaegertracing/jaeger/cmd/collector/app"
jConfig "github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/plugin/storage/cassandra"
)
Expand All @@ -44,6 +45,9 @@ func TestCreateTraceExporter(t *testing.T) {
func TestCreateDefaultConfig(t *testing.T) {
factory := Factory{OptionsFactory: DefaultOptions}
cfg := factory.CreateDefaultConfig()

assert.Equal(t, collector_app.DefaultNumWorkers, cfg.(*Config).NumConsumers)
assert.Equal(t, collector_app.DefaultQueueSize, cfg.(*Config).QueueSize)
assert.NotNil(t, cfg, "failed to create default config")
assert.NoError(t, configcheck.ValidateConfig(cfg))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/exporter/exporterhelper"

collector_app "github.com/jaegertracing/jaeger/cmd/collector/app"
"github.com/jaegertracing/jaeger/plugin/storage/es"
)

Expand Down Expand Up @@ -54,6 +55,10 @@ var _ component.ExporterFactory = (*Factory)(nil)
// CreateDefaultConfig returns default configuration of Factory.
// This function implements OTEL component.ExporterFactoryBase interface.
func (f Factory) CreateDefaultConfig() configmodels.Exporter {
queueSettings := exporterhelper.CreateDefaultQueueSettings()
queueSettings.NumConsumers = collector_app.DefaultNumWorkers
queueSettings.QueueSize = collector_app.DefaultQueueSize

opts := f.OptionsFactory()
return &Config{
ExporterSettings: configmodels.ExporterSettings{
Expand All @@ -62,7 +67,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Exporter {
},
TimeoutSettings: exporterhelper.CreateDefaultTimeoutSettings(),
RetrySettings: exporterhelper.CreateDefaultRetrySettings(),
QueueSettings: exporterhelper.CreateDefaultQueueSettings(),
QueueSettings: queueSettings,
Options: *opts,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"go.opentelemetry.io/collector/config/configmodels"
"go.uber.org/zap"

collector_app "github.com/jaegertracing/jaeger/cmd/collector/app"
jConfig "github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/plugin/storage/es"
)
Expand Down Expand Up @@ -61,6 +62,9 @@ func TestCreateMetricsExporter(t *testing.T) {
func TestCreateDefaultConfig(t *testing.T) {
factory := Factory{OptionsFactory: DefaultOptions}
cfg := factory.CreateDefaultConfig()
assert.Equal(t, collector_app.DefaultNumWorkers, cfg.(*Config).NumConsumers)
assert.Equal(t, collector_app.DefaultQueueSize, cfg.(*Config).QueueSize)

assert.NotNil(t, cfg, "failed to create default config")
assert.NoError(t, configcheck.ValidateConfig(cfg))
}
Expand Down