From 0afdfd58f1025fff2fe7ba60987f0b5157cd0fe5 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 29 Jan 2024 21:40:11 +0530 Subject: [PATCH 01/27] add elasticsearch for jeager-v2 Signed-off-by: Harshvir Potpose --- cmd/jaeger/es_config.yaml | 34 +++++++++++++++++++ .../extension/jaegerstorage/config.go | 6 ++-- .../extension/jaegerstorage/extension.go | 17 ++++++++++ plugin/storage/es/factory.go | 15 ++++++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 cmd/jaeger/es_config.yaml diff --git a/cmd/jaeger/es_config.yaml b/cmd/jaeger/es_config.yaml new file mode 100644 index 00000000000..21a8c001bd6 --- /dev/null +++ b/cmd/jaeger/es_config.yaml @@ -0,0 +1,34 @@ +service: + extensions: [jaeger_storage, jaeger_query] + pipelines: + traces: + receivers: [otlp] + processors: [batch] + exporters: [jaeger_storage_exporter] + +extensions: + jaeger_query: + trace_storage: es_main + trace_storage_archive: es_archive + ui_config: ./cmd/jaeger/config-ui.json + + jaeger_storage: + elasticsearch: + es_main: + server_urls: http://127.0.0.1:9200 + log_level: "error" + es_archive: + server_urls: http://127.0.0.1:9200 + log_level: "error" +receivers: + otlp: + protocols: + grpc: + http: + +processors: + batch: + +exporters: + jaeger_storage_exporter: + trace_storage: es_main diff --git a/cmd/jaeger/internal/extension/jaegerstorage/config.go b/cmd/jaeger/internal/extension/jaegerstorage/config.go index db32f6c79cd..795331eab2a 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/config.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/config.go @@ -7,14 +7,16 @@ import ( "fmt" "reflect" + esCfg "github.com/jaegertracing/jaeger/pkg/es/config" memoryCfg "github.com/jaegertracing/jaeger/pkg/memory/config" badgerCfg "github.com/jaegertracing/jaeger/plugin/storage/badger" ) // Config has the configuration for jaeger-query, type Config struct { - Memory map[string]memoryCfg.Configuration `mapstructure:"memory"` - Badger map[string]badgerCfg.NamespaceConfig `mapstructure:"badger"` + Memory map[string]memoryCfg.Configuration `mapstructure:"memory"` + Badger map[string]badgerCfg.NamespaceConfig `mapstructure:"badger"` + Elasticsearch map[string]esCfg.Configuration `mapstructure:"elasticsearch"` // TODO add other storage types here // TODO how will this work with 3rd party storage implementations? // Option: instead of looking for specific name, check interface. diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index ae743313046..38eadfb718e 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -15,6 +15,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/plugin/storage/badger" + "github.com/jaegertracing/jaeger/plugin/storage/es" "github.com/jaegertracing/jaeger/plugin/storage/memory" "github.com/jaegertracing/jaeger/storage" ) @@ -88,6 +89,22 @@ func (s *storageExt) Start(ctx context.Context, host component.Host) error { s.factories[name] = factory } + for name, e := range s.config.Elasticsearch { + if _, ok := s.factories[name]; ok { + return fmt.Errorf("duplicate elasticsearch storage name %s", name) + } + var err error + factory, err := es.NewFactoryWithConfig( + e, + metrics.NullFactory, + s.logger.With(zap.String("storage_name", name)), + ) + if err != nil { + return fmt.Errorf("failed to initialize elasticsearch storage: %w", err) + } + s.factories[name] = factory + + } // TODO add support for other backends return nil } diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index 8ce0de4f386..cd2b514da07 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -83,6 +83,21 @@ func NewFactory() *Factory { } } +func NewFactoryWithConfig( + cfg config.Configuration, + metricsFactory metrics.Factory, + logger *zap.Logger, +) (*Factory, error) { + f := NewFactory() + f.InitFromOptions(Options{Primary: namespaceConfig{Configuration: cfg}, + others: make(map[string]*namespaceConfig)}) + err := f.Initialize(metricsFactory, logger) + if err != nil { + return nil, err + } + return f, nil +} + // AddFlags implements plugin.Configurable func (f *Factory) AddFlags(flagSet *flag.FlagSet) { f.Options.AddFlags(flagSet) From c60bf5a5b7f342bcf55907982f9e734b8dd24ea3 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 29 Jan 2024 21:49:34 +0530 Subject: [PATCH 02/27] fix Signed-off-by: Harshvir Potpose --- plugin/storage/es/factory.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index cd2b514da07..1fc2b0e1d53 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -89,8 +89,10 @@ func NewFactoryWithConfig( logger *zap.Logger, ) (*Factory, error) { f := NewFactory() - f.InitFromOptions(Options{Primary: namespaceConfig{Configuration: cfg}, - others: make(map[string]*namespaceConfig)}) + f.InitFromOptions(Options{ + Primary: namespaceConfig{Configuration: cfg}, + others: make(map[string]*namespaceConfig), + }) err := f.Initialize(metricsFactory, logger) if err != nil { return nil, err From a47bb3563bdc44d50035082816efe8c294c02675 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Tue, 30 Jan 2024 01:53:27 +0530 Subject: [PATCH 03/27] add tests Signed-off-by: Harshvir Potpose --- .../extension/jaegerstorage/extension_test.go | 73 +++++++++++++++++++ plugin/storage/es/factory_test.go | 20 +++++ 2 files changed, 93 insertions(+) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go index 2ec6c05306e..9ba45ddd319 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go @@ -6,6 +6,8 @@ package jaegerstorage import ( "context" "fmt" + "net/http" + "net/http/httptest" "testing" "github.com/stretchr/testify/require" @@ -16,9 +18,11 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.uber.org/zap" + esCfg "github.com/jaegertracing/jaeger/pkg/es/config" memoryCfg "github.com/jaegertracing/jaeger/pkg/memory/config" "github.com/jaegertracing/jaeger/pkg/metrics" badgerCfg "github.com/jaegertracing/jaeger/plugin/storage/badger" + "github.com/jaegertracing/jaeger/plugin/storage/es" "github.com/jaegertracing/jaeger/storage" "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" @@ -27,6 +31,7 @@ import ( const ( memstoreName = "memstore" badgerName = "badgerstore" + esName = "esstore" ) type storageHost struct { @@ -188,6 +193,74 @@ func TestBadgerStorageExtensionError(t *testing.T) { require.EqualError(t, err, "failed to initialize badger storage: Error Creating Dir: \"\" error: mkdir : no such file or directory") } +func TestESStorageExtension(t *testing.T) { + ctx := context.Background() + telemetrySettings := component.TelemetrySettings{ + Logger: zap.NewNop(), + TracerProvider: nooptrace.NewTracerProvider(), + MeterProvider: noopmetric.NewMeterProvider(), + } + + mockEsServerResponse := []byte(` + { + "Version": { + "Number": "6" + } + } + `) + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Write(mockEsServerResponse) + })) + + defer server.Close() + config := &Config{ + Elasticsearch: map[string]esCfg.Configuration{ + esName: { + Servers: []string{server.URL}, + LogLevel: "error", + }, + }, + } + + require.NoError(t, config.Validate()) + + extensionFactory := NewFactory() + storageExtension, err := extensionFactory.CreateExtension(ctx, extension.CreateSettings{ + ID: ID, + TelemetrySettings: telemetrySettings, + BuildInfo: component.NewDefaultBuildInfo(), + }, config) + require.NoError(t, err) + + host := componenttest.NewNopHost() + err = storageExtension.Start(ctx, host) + require.NoError(t, err) + + err = storageExtension.Start(ctx, host) + t.Cleanup(func() { require.NoError(t, storageExtension.Shutdown(ctx)) }) + require.Error(t, err) + require.EqualError(t, err, fmt.Sprintf("duplicate elasticsearch storage name %s", esName)) +} + +func TestESStorageExtensionError(t *testing.T) { + ctx := context.Background() + factory, _ := es.NewFactoryWithConfig(esCfg.Configuration{}, metrics.NullFactory, zap.NewNop()) + ext := storageExt{ + config: &Config{ + Elasticsearch: map[string]esCfg.Configuration{ + esName: {}, + }, + }, + logger: zap.NewNop(), + factories: map[string]storage.Factory{"elasticsearch": factory}, + } + err := ext.Start(ctx, componenttest.NewNopHost()) + require.Error(t, err) + fmt.Println(err) + require.EqualError(t, err, "failed to initialize elasticsearch storage: failed to create primary Elasticsearch client: no servers specified") +} + func makeStorageExtension(t *testing.T, memstoreName string) component.Component { extensionFactory := NewFactory() diff --git a/plugin/storage/es/factory_test.go b/plugin/storage/es/factory_test.go index d3e1d34ab4a..98cd29e5fc8 100644 --- a/plugin/storage/es/factory_test.go +++ b/plugin/storage/es/factory_test.go @@ -263,6 +263,26 @@ func TestInitFromOptions(t *testing.T) { assert.Equal(t, o.Get(archiveNamespace), f.archiveConfig) } +func TestESStorageFactoryWithConfig(t *testing.T) { + cfg := escfg.Configuration{} + _, err := NewFactoryWithConfig(cfg, metrics.NullFactory, zap.NewNop()) + require.Error(t, err) + require.ErrorContains(t, err, "failed to create primary Elasticsearch client") + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Write(mockEsServerResponse) + })) + defer server.Close() + + cfg = escfg.Configuration{ + Servers: []string{server.URL}, + LogLevel: "error", + } + factory, err := NewFactoryWithConfig(cfg, metrics.NullFactory, zap.NewNop()) + require.NoError(t, err) + defer factory.Close() +} + func TestPasswordFromFile(t *testing.T) { defer testutils.VerifyGoLeaksOnce(t) t.Run("primary client", func(t *testing.T) { From 430a0ce30a9ee67918bcd80fb2d76a8242fcd179 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 5 Feb 2024 22:13:10 +0530 Subject: [PATCH 04/27] use separate index_prefix in archive storage Signed-off-by: Harshvir Potpose --- cmd/jaeger/es_config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/jaeger/es_config.yaml b/cmd/jaeger/es_config.yaml index 21a8c001bd6..87085813869 100644 --- a/cmd/jaeger/es_config.yaml +++ b/cmd/jaeger/es_config.yaml @@ -20,6 +20,7 @@ extensions: es_archive: server_urls: http://127.0.0.1:9200 log_level: "error" + index_prefix: "jaeger-archive" receivers: otlp: protocols: From d8d493986853642c727c8c00614004deefdd7840 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:51:08 +0530 Subject: [PATCH 05/27] Update cmd/jaeger/internal/extension/jaegerstorage/extension.go Co-authored-by: Yuri Shkuro Signed-off-by: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com> --- cmd/jaeger/internal/extension/jaegerstorage/extension.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index 38eadfb718e..52b83aa792e 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -93,7 +93,6 @@ func (s *storageExt) Start(ctx context.Context, host component.Host) error { if _, ok := s.factories[name]; ok { return fmt.Errorf("duplicate elasticsearch storage name %s", name) } - var err error factory, err := es.NewFactoryWithConfig( e, metrics.NullFactory, From da38c6a82a84258aef604bb71c8b792ad7f0e376 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:51:15 +0530 Subject: [PATCH 06/27] Update cmd/jaeger/internal/extension/jaegerstorage/extension.go Co-authored-by: Yuri Shkuro Signed-off-by: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com> --- cmd/jaeger/internal/extension/jaegerstorage/extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index 52b83aa792e..3f4b511cc64 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -89,7 +89,7 @@ func (s *storageExt) Start(ctx context.Context, host component.Host) error { s.factories[name] = factory } - for name, e := range s.config.Elasticsearch { + for name, cfg := range s.config.Elasticsearch { if _, ok := s.factories[name]; ok { return fmt.Errorf("duplicate elasticsearch storage name %s", name) } From 001e4a0c8ce6b90b2418467bff6a81aa9c6789fb Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Tue, 6 Feb 2024 12:57:03 +0530 Subject: [PATCH 07/27] fix Signed-off-by: Harshvir Potpose --- cmd/jaeger/internal/extension/jaegerstorage/extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index 3f4b511cc64..32302e7eab9 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -94,7 +94,7 @@ func (s *storageExt) Start(ctx context.Context, host component.Host) error { return fmt.Errorf("duplicate elasticsearch storage name %s", name) } factory, err := es.NewFactoryWithConfig( - e, + cfg, metrics.NullFactory, s.logger.With(zap.String("storage_name", name)), ) From 9aa2c26ead9a0323974fd0face0ecc202259d82e Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Wed, 7 Feb 2024 13:54:22 +0530 Subject: [PATCH 08/27] refactor tests Signed-off-by: Harshvir Potpose --- .../extension/jaegerstorage/extension_test.go | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go index 9f65f782895..b7e6e72b1c7 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go @@ -6,6 +6,8 @@ package jaegerstorage import ( "context" "fmt" + "net/http" + "net/http/httptest" "testing" "github.com/stretchr/testify/require" @@ -16,6 +18,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.uber.org/zap" + esCfg "github.com/jaegertracing/jaeger/pkg/es/config" memoryCfg "github.com/jaegertracing/jaeger/pkg/memory/config" "github.com/jaegertracing/jaeger/pkg/metrics" badgerCfg "github.com/jaegertracing/jaeger/plugin/storage/badger" @@ -151,6 +154,43 @@ func TestBadgerStorageExtensionError(t *testing.T) { require.ErrorContains(t, err, "/bad/path") } +func TestESStorageExtension(t *testing.T) { + mockEsServerResponse := []byte(` + { + "Version": { + "Number": "6" + } + } + `) + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Write(mockEsServerResponse) + })) + defer server.Close() + storageExtension := makeStorageExtenion(t, &Config{ + Elasticsearch: map[string]esCfg.Configuration{ + "foo": { + Servers: []string{server.URL}, + LogLevel: "error", + }, + }, + }) + ctx := context.Background() + err := storageExtension.Start(ctx, componenttest.NewNopHost()) + require.NoError(t, err) + require.NoError(t, storageExtension.Shutdown(ctx)) +} + +func TestESStorageExtensionError(t *testing.T) { + ext := makeStorageExtenion(t, &Config{ + Elasticsearch: map[string]esCfg.Configuration{ + "foo": {}, + }, + }) + err := ext.Start(context.Background(), componenttest.NewNopHost()) + require.ErrorContains(t, err, "failed to initialize elasticsearch storage") + require.ErrorContains(t, err, "no servers specified") +} + func noopTelemetrySettings() component.TelemetrySettings { return component.TelemetrySettings{ Logger: zap.L(), From c5c20ceda86f9368d17f840989180c80a634d0d3 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Wed, 7 Feb 2024 16:32:47 +0530 Subject: [PATCH 09/27] fix Signed-off-by: Harshvir Potpose --- cmd/jaeger/internal/extension/jaegerstorage/extension_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go index b7e6e72b1c7..d482345dd8b 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go @@ -88,6 +88,9 @@ func TestStorageExtensionNameConflict(t *testing.T) { Badger: map[string]badgerCfg.NamespaceConfig{ "foo": {}, }, + Elasticsearch: map[string]esCfg.Configuration{ + "foo": {}, + }, }) err := storageExtension.Start(context.Background(), componenttest.NewNopHost()) require.ErrorContains(t, err, "duplicate") From 236067ced113018606768f1aa6b0f04b1d03f86e Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Sat, 17 Feb 2024 01:59:58 +0530 Subject: [PATCH 10/27] add annotations Signed-off-by: Harshvir Potpose --- pkg/es/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index 1549156cff6..a7057a1225a 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -45,7 +45,7 @@ import ( // Configuration describes the configuration properties needed to connect to an ElasticSearch cluster type Configuration struct { - Servers []string `mapstructure:"server_urls"` + Servers []string `mapstructure:"server_urls" validate:"required,min=1,dive,url"` RemoteReadClusters []string `mapstructure:"remote_read_clusters"` Username string `mapstructure:"username"` Password string `mapstructure:"password" json:"-"` From 72c5c42b8f5b9b9ed7b8050db55bd838dcfc870b Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Sat, 17 Feb 2024 02:00:49 +0530 Subject: [PATCH 11/27] fix Signed-off-by: Harshvir Potpose --- .../internal/extension/jaegerstorage/extension_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go index d482345dd8b..f8d37f7e9ce 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go @@ -88,9 +88,6 @@ func TestStorageExtensionNameConflict(t *testing.T) { Badger: map[string]badgerCfg.NamespaceConfig{ "foo": {}, }, - Elasticsearch: map[string]esCfg.Configuration{ - "foo": {}, - }, }) err := storageExtension.Start(context.Background(), componenttest.NewNopHost()) require.ErrorContains(t, err, "duplicate") @@ -186,12 +183,15 @@ func TestESStorageExtension(t *testing.T) { func TestESStorageExtensionError(t *testing.T) { ext := makeStorageExtenion(t, &Config{ Elasticsearch: map[string]esCfg.Configuration{ - "foo": {}, + "foo": { + Servers: []string{"badurl"}, + LogLevel: "error", + }, }, }) err := ext.Start(context.Background(), componenttest.NewNopHost()) require.ErrorContains(t, err, "failed to initialize elasticsearch storage") - require.ErrorContains(t, err, "no servers specified") + require.ErrorContains(t, err, "no Elasticsearch node available") } func noopTelemetrySettings() component.TelemetrySettings { From 79130b4214dcd3c068ce86ededffbc250556f338 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Sun, 18 Feb 2024 14:31:52 +0530 Subject: [PATCH 12/27] remove left over yaml annotations Signed-off-by: Harshvir Potpose --- pkg/es/config/config.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index a7057a1225a..41f28fc75a9 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -54,13 +54,13 @@ type Configuration struct { AllowTokenFromContext bool `mapstructure:"-"` Sniffer bool `mapstructure:"sniffer"` // https://github.com/olivere/elastic/wiki/Sniffing SnifferTLSEnabled bool `mapstructure:"sniffer_tls_enabled"` - MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query - MaxSpanAge time.Duration `yaml:"max_span_age" mapstructure:"-"` // configures the maximum lookback on span reads - NumShards int64 `yaml:"shards" mapstructure:"num_shards"` - NumReplicas int64 `yaml:"replicas" mapstructure:"num_replicas"` - PrioritySpanTemplate int64 `yaml:"priority_span_template" mapstructure:"priority_span_template"` - PriorityServiceTemplate int64 `yaml:"priority_service_template" mapstructure:"priority_service_template"` - PriorityDependenciesTemplate int64 `yaml:"priority_dependencies_template" mapstructure:"priority_dependencies_template"` + MaxDocCount int `mapstructure:"-"` + MaxSpanAge time.Duration `mapstructure:"-"` + NumShards int64 `mapstructure:"num_shards"` + NumReplicas int64 `mapstructure:"num_replicas"` + PrioritySpanTemplate int64 `mapstructure:"priority_span_template"` + PriorityServiceTemplate int64 `mapstructure:"priority_service_template"` + PriorityDependenciesTemplate int64 `mapstructure:"priority_dependencies_template"` Timeout time.Duration `validate:"min=500" mapstructure:"-"` BulkSize int `mapstructure:"-"` BulkWorkers int `mapstructure:"-"` From e373c3df29683bf88e964560ec7782d4f37ff78e Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Sun, 18 Feb 2024 14:32:22 +0530 Subject: [PATCH 13/27] add docker compose for debug Signed-off-by: Harshvir Potpose --- cmd/jaeger/Dockerfile.debug | 11 +++++++++ cmd/jaeger/docker-compose.yaml | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 cmd/jaeger/Dockerfile.debug create mode 100644 cmd/jaeger/docker-compose.yaml diff --git a/cmd/jaeger/Dockerfile.debug b/cmd/jaeger/Dockerfile.debug new file mode 100644 index 00000000000..053b516f7b9 --- /dev/null +++ b/cmd/jaeger/Dockerfile.debug @@ -0,0 +1,11 @@ +FROM alpine:latest + +WORKDIR /app + +COPY jaeger-linux-amd64 /app/ + +RUN chmod +x /app/jaeger-linux-amd64 + +EXPOSE 5775/udp 6831/udp 6832/udp 5778 16686 14268 14250 9200 + +ENTRYPOINT ["/app/jaeger-linux-amd64"] \ No newline at end of file diff --git a/cmd/jaeger/docker-compose.yaml b/cmd/jaeger/docker-compose.yaml new file mode 100644 index 00000000000..baa2a859a68 --- /dev/null +++ b/cmd/jaeger/docker-compose.yaml @@ -0,0 +1,45 @@ +version: '3.7' + +services: + elasticsearch: + image: elasticsearch:8.12.0 + container_name: elasticsearch + environment: + - discovery.type=single-node + - xpack.security.enabled=false + ports: + - "9200:9200" + healthcheck: + test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health | grep -vq '\"status\":\"red\"'"] + interval: 10s + timeout: 5s + retries: 5 + networks: + - esnet + + jaeger: + build: + context: ./ + dockerfile: Dockerfile.debug + container_name: jaeger + ports: + - "16686:16686" + - "6831:6831/udp" + - "6832:6832/udp" + - "5778:5778" + - "14268:14268" + - "14250:14250" + depends_on: + elasticsearch: + condition: service_healthy + networks: + - esnet + volumes: + - ./es_config.yaml:/app/es_config.yaml + - ./config-ui.json:/app/cmd/jaeger/config-ui.json + command: ["--config", "/app/es_config.yaml"] + restart: always + +networks: + esnet: + driver: bridge From e646a3ff3985d50a9ff530f792b50a3d37d90c98 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Sun, 18 Feb 2024 14:33:03 +0530 Subject: [PATCH 14/27] fix Signed-off-by: Harshvir Potpose --- cmd/jaeger/es_config.yaml | 6 ++++-- plugin/storage/es/factory.go | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/jaeger/es_config.yaml b/cmd/jaeger/es_config.yaml index 87085813869..d2469807996 100644 --- a/cmd/jaeger/es_config.yaml +++ b/cmd/jaeger/es_config.yaml @@ -15,12 +15,14 @@ extensions: jaeger_storage: elasticsearch: es_main: - server_urls: http://127.0.0.1:9200 + server_urls: http://elasticsearch:9200 log_level: "error" + num_shards: 5 es_archive: - server_urls: http://127.0.0.1:9200 + server_urls: http://elasticsearch:9200 log_level: "error" index_prefix: "jaeger-archive" + num_shards: 5 receivers: otlp: protocols: diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index 1fc2b0e1d53..310697dd784 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -89,6 +89,7 @@ func NewFactoryWithConfig( logger *zap.Logger, ) (*Factory, error) { f := NewFactory() + cfg.MaxDocCount = defaultMaxDocCount f.InitFromOptions(Options{ Primary: namespaceConfig{Configuration: cfg}, others: make(map[string]*namespaceConfig), From e61cf78b31ee09d5aab6cb81c6900104d74df795 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 19 Feb 2024 13:47:54 +0530 Subject: [PATCH 15/27] revert changes Signed-off-by: Harshvir Potpose --- pkg/es/config/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index 41f28fc75a9..56f147620bd 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -54,8 +54,8 @@ type Configuration struct { AllowTokenFromContext bool `mapstructure:"-"` Sniffer bool `mapstructure:"sniffer"` // https://github.com/olivere/elastic/wiki/Sniffing SnifferTLSEnabled bool `mapstructure:"sniffer_tls_enabled"` - MaxDocCount int `mapstructure:"-"` - MaxSpanAge time.Duration `mapstructure:"-"` + MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query + MaxSpanAge time.Duration `yaml:"max_span_age" mapstructure:"-"` // configures the maximum lookback on span reads NumShards int64 `mapstructure:"num_shards"` NumReplicas int64 `mapstructure:"num_replicas"` PrioritySpanTemplate int64 `mapstructure:"priority_span_template"` From 6824ec4351328322db0ca05573aad2e4f490b9e5 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 19 Feb 2024 13:49:59 +0530 Subject: [PATCH 16/27] fix Signed-off-by: Harshvir Potpose --- pkg/es/config/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index 56f147620bd..02e031a65d9 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -54,8 +54,8 @@ type Configuration struct { AllowTokenFromContext bool `mapstructure:"-"` Sniffer bool `mapstructure:"sniffer"` // https://github.com/olivere/elastic/wiki/Sniffing SnifferTLSEnabled bool `mapstructure:"sniffer_tls_enabled"` - MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query - MaxSpanAge time.Duration `yaml:"max_span_age" mapstructure:"-"` // configures the maximum lookback on span reads + MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query + MaxSpanAge time.Duration `mapstructure:"-"` // configures the maximum lookback on span reads NumShards int64 `mapstructure:"num_shards"` NumReplicas int64 `mapstructure:"num_replicas"` PrioritySpanTemplate int64 `mapstructure:"priority_span_template"` From 66f63b5b8c5f5987c821f2fed8c3669c59714e6d Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 19 Feb 2024 17:48:59 +0530 Subject: [PATCH 17/27] rename es_config.yaml to config-elasticsearch.yaml Signed-off-by: Harshvir Potpose --- cmd/jaeger/{es_config.yaml => config-elasticsearch.yaml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename cmd/jaeger/{es_config.yaml => config-elasticsearch.yaml} (87%) diff --git a/cmd/jaeger/es_config.yaml b/cmd/jaeger/config-elasticsearch.yaml similarity index 87% rename from cmd/jaeger/es_config.yaml rename to cmd/jaeger/config-elasticsearch.yaml index d2469807996..b3fd9513612 100644 --- a/cmd/jaeger/es_config.yaml +++ b/cmd/jaeger/config-elasticsearch.yaml @@ -15,11 +15,11 @@ extensions: jaeger_storage: elasticsearch: es_main: - server_urls: http://elasticsearch:9200 + server_urls: http://localhost:9200 log_level: "error" num_shards: 5 es_archive: - server_urls: http://elasticsearch:9200 + server_urls: http://localhost:9200 log_level: "error" index_prefix: "jaeger-archive" num_shards: 5 From a86760cc7fcf07392c9c86d21bd2925176abfd5f Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Tue, 20 Feb 2024 17:38:38 +0530 Subject: [PATCH 18/27] set UseReadWriteAliases to true in config file Signed-off-by: Harshvir Potpose --- cmd/jaeger/config-elasticsearch.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/jaeger/config-elasticsearch.yaml b/cmd/jaeger/config-elasticsearch.yaml index b3fd9513612..7297f7c4009 100644 --- a/cmd/jaeger/config-elasticsearch.yaml +++ b/cmd/jaeger/config-elasticsearch.yaml @@ -17,12 +17,13 @@ extensions: es_main: server_urls: http://localhost:9200 log_level: "error" - num_shards: 5 + index_prefix: "jaeger-main" + use_aliases: true es_archive: server_urls: http://localhost:9200 log_level: "error" index_prefix: "jaeger-archive" - num_shards: 5 + use_aliases: true receivers: otlp: protocols: From 7ad3b0d9572955058296a127a597a8183852db17 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Tue, 20 Feb 2024 17:39:07 +0530 Subject: [PATCH 19/27] remove debug docker compose and dockerfile Signed-off-by: Harshvir Potpose --- cmd/jaeger/Dockerfile.debug | 11 --------- cmd/jaeger/docker-compose.yaml | 45 ---------------------------------- 2 files changed, 56 deletions(-) delete mode 100644 cmd/jaeger/Dockerfile.debug delete mode 100644 cmd/jaeger/docker-compose.yaml diff --git a/cmd/jaeger/Dockerfile.debug b/cmd/jaeger/Dockerfile.debug deleted file mode 100644 index 053b516f7b9..00000000000 --- a/cmd/jaeger/Dockerfile.debug +++ /dev/null @@ -1,11 +0,0 @@ -FROM alpine:latest - -WORKDIR /app - -COPY jaeger-linux-amd64 /app/ - -RUN chmod +x /app/jaeger-linux-amd64 - -EXPOSE 5775/udp 6831/udp 6832/udp 5778 16686 14268 14250 9200 - -ENTRYPOINT ["/app/jaeger-linux-amd64"] \ No newline at end of file diff --git a/cmd/jaeger/docker-compose.yaml b/cmd/jaeger/docker-compose.yaml deleted file mode 100644 index baa2a859a68..00000000000 --- a/cmd/jaeger/docker-compose.yaml +++ /dev/null @@ -1,45 +0,0 @@ -version: '3.7' - -services: - elasticsearch: - image: elasticsearch:8.12.0 - container_name: elasticsearch - environment: - - discovery.type=single-node - - xpack.security.enabled=false - ports: - - "9200:9200" - healthcheck: - test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health | grep -vq '\"status\":\"red\"'"] - interval: 10s - timeout: 5s - retries: 5 - networks: - - esnet - - jaeger: - build: - context: ./ - dockerfile: Dockerfile.debug - container_name: jaeger - ports: - - "16686:16686" - - "6831:6831/udp" - - "6832:6832/udp" - - "5778:5778" - - "14268:14268" - - "14250:14250" - depends_on: - elasticsearch: - condition: service_healthy - networks: - - esnet - volumes: - - ./es_config.yaml:/app/es_config.yaml - - ./config-ui.json:/app/cmd/jaeger/config-ui.json - command: ["--config", "/app/es_config.yaml"] - restart: always - -networks: - esnet: - driver: bridge From 8dc35cbffae506dd660d22527dcc5429489b7f88 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Tue, 20 Feb 2024 17:40:21 +0530 Subject: [PATCH 20/27] add validator to validate config Signed-off-by: Harshvir Potpose --- .../internal/extension/jaegerstorage/extension_test.go | 2 +- pkg/es/config/config.go | 10 ++++++++-- plugin/storage/es/factory.go | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go index f8d37f7e9ce..ec8676d01a8 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go @@ -191,7 +191,7 @@ func TestESStorageExtensionError(t *testing.T) { }) err := ext.Start(context.Background(), componenttest.NewNopHost()) require.ErrorContains(t, err, "failed to initialize elasticsearch storage") - require.ErrorContains(t, err, "no Elasticsearch node available") + require.ErrorContains(t, err, "badurl") } func noopTelemetrySettings() component.TelemetrySettings { diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index 02e031a65d9..e9598cbdd61 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -29,6 +29,7 @@ import ( "sync" "time" + "github.com/asaskevich/govalidator" esV8 "github.com/elastic/go-elasticsearch/v8" "github.com/olivere/elastic" "go.uber.org/zap" @@ -45,7 +46,7 @@ import ( // Configuration describes the configuration properties needed to connect to an ElasticSearch cluster type Configuration struct { - Servers []string `mapstructure:"server_urls" validate:"required,min=1,dive,url"` + Servers []string `mapstructure:"server_urls" valid:"required,url"` RemoteReadClusters []string `mapstructure:"remote_read_clusters"` Username string `mapstructure:"username"` Password string `mapstructure:"password" json:"-"` @@ -61,7 +62,7 @@ type Configuration struct { PrioritySpanTemplate int64 `mapstructure:"priority_span_template"` PriorityServiceTemplate int64 `mapstructure:"priority_service_template"` PriorityDependenciesTemplate int64 `mapstructure:"priority_dependencies_template"` - Timeout time.Duration `validate:"min=500" mapstructure:"-"` + Timeout time.Duration `valid:"min=500" mapstructure:"-"` BulkSize int `mapstructure:"-"` BulkWorkers int `mapstructure:"-"` BulkActions int `mapstructure:"-"` @@ -467,3 +468,8 @@ func loadTokenFromFile(path string) (string, error) { } return strings.TrimRight(string(b), "\r\n"), nil } + +func (c *Configuration) Validate() error { + _, err := govalidator.ValidateStruct(c) + return err +} diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index 310697dd784..0713a011000 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -89,6 +89,9 @@ func NewFactoryWithConfig( logger *zap.Logger, ) (*Factory, error) { f := NewFactory() + if err := cfg.Validate(); err != nil { + return nil, err + } cfg.MaxDocCount = defaultMaxDocCount f.InitFromOptions(Options{ Primary: namespaceConfig{Configuration: cfg}, From 07445628eff7aa860ad849689fc7b03620a35571 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Wed, 21 Feb 2024 00:06:43 +0530 Subject: [PATCH 21/27] fix Signed-off-by: Harshvir Potpose --- cmd/jaeger/internal/extension/jaegerstorage/extension_test.go | 2 +- plugin/storage/es/factory.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go index ec8676d01a8..0ee7ed1c173 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go @@ -184,7 +184,7 @@ func TestESStorageExtensionError(t *testing.T) { ext := makeStorageExtenion(t, &Config{ Elasticsearch: map[string]esCfg.Configuration{ "foo": { - Servers: []string{"badurl"}, + Servers: []string{"http://badurl"}, LogLevel: "error", }, }, diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index 0713a011000..805b19a4a91 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -93,6 +93,7 @@ func NewFactoryWithConfig( return nil, err } cfg.MaxDocCount = defaultMaxDocCount + cfg.Enabled = true f.InitFromOptions(Options{ Primary: namespaceConfig{Configuration: cfg}, others: make(map[string]*namespaceConfig), From 275786cf4b8bc35b24bab56fe3e5f8a8ed6d07e4 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Wed, 21 Feb 2024 00:33:01 +0530 Subject: [PATCH 22/27] fix Signed-off-by: Harshvir Potpose --- plugin/storage/es/factory_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugin/storage/es/factory_test.go b/plugin/storage/es/factory_test.go index 98cd29e5fc8..f6c6d23385f 100644 --- a/plugin/storage/es/factory_test.go +++ b/plugin/storage/es/factory_test.go @@ -264,17 +264,11 @@ func TestInitFromOptions(t *testing.T) { } func TestESStorageFactoryWithConfig(t *testing.T) { - cfg := escfg.Configuration{} - _, err := NewFactoryWithConfig(cfg, metrics.NullFactory, zap.NewNop()) - require.Error(t, err) - require.ErrorContains(t, err, "failed to create primary Elasticsearch client") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write(mockEsServerResponse) })) defer server.Close() - - cfg = escfg.Configuration{ + cfg := escfg.Configuration{ Servers: []string{server.URL}, LogLevel: "error", } @@ -283,6 +277,16 @@ func TestESStorageFactoryWithConfig(t *testing.T) { defer factory.Close() } +func TestESStorageFactoryWithConfigError(t *testing.T) { + cfg := escfg.Configuration{ + Servers: []string{"http://badurl"}, + LogLevel: "error", + } + _, err := NewFactoryWithConfig(cfg, metrics.NullFactory, zap.NewNop()) + require.Error(t, err) + require.ErrorContains(t, err, "failed to create primary Elasticsearch client") +} + func TestPasswordFromFile(t *testing.T) { defer testutils.VerifyGoLeaksOnce(t) t.Run("primary client", func(t *testing.T) { From 3763aa97484f56addc5caad29d24d362e7eca873 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 26 Feb 2024 01:55:35 +0530 Subject: [PATCH 23/27] fix Signed-off-by: Harshvir Potpose --- plugin/storage/es/factory.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index 805b19a4a91..6ec074c4ae1 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -88,15 +88,24 @@ func NewFactoryWithConfig( metricsFactory metrics.Factory, logger *zap.Logger, ) (*Factory, error) { - f := NewFactory() if err := cfg.Validate(); err != nil { return nil, err } + cfg.MaxDocCount = defaultMaxDocCount cfg.Enabled = true + + archive := make(map[string]*namespaceConfig) + archive[archiveNamespace] = &namespaceConfig{ + Configuration: cfg, + namespace: archiveNamespace, + } + + f := NewFactory() f.InitFromOptions(Options{ - Primary: namespaceConfig{Configuration: cfg}, - others: make(map[string]*namespaceConfig), + Primary: namespaceConfig{Configuration: cfg, + namespace: primaryNamespace}, + others: archive, }) err := f.Initialize(metricsFactory, logger) if err != nil { From 495daafa0c5bfcf0166f3ceae4dca6046b819c7d Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 26 Feb 2024 02:05:53 +0530 Subject: [PATCH 24/27] fix lint Signed-off-by: Harshvir Potpose --- plugin/storage/es/factory.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index 6ec074c4ae1..5187ac5db7a 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -103,8 +103,10 @@ func NewFactoryWithConfig( f := NewFactory() f.InitFromOptions(Options{ - Primary: namespaceConfig{Configuration: cfg, - namespace: primaryNamespace}, + Primary: namespaceConfig{ + Configuration: cfg, + namespace: primaryNamespace, + }, others: archive, }) err := f.Initialize(metricsFactory, logger) From 0f7d2f1a0cb6286b0fce710ad09f3f76a6a28415 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 26 Feb 2024 23:38:33 +0530 Subject: [PATCH 25/27] add test for cfg validation Signed-off-by: Harshvir Potpose --- pkg/es/config/config.go | 2 +- plugin/storage/es/factory_test.go | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index e9598cbdd61..6fc76db5615 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -62,7 +62,7 @@ type Configuration struct { PrioritySpanTemplate int64 `mapstructure:"priority_span_template"` PriorityServiceTemplate int64 `mapstructure:"priority_service_template"` PriorityDependenciesTemplate int64 `mapstructure:"priority_dependencies_template"` - Timeout time.Duration `valid:"min=500" mapstructure:"-"` + Timeout time.Duration `mapstructure:"-"` BulkSize int `mapstructure:"-"` BulkWorkers int `mapstructure:"-"` BulkActions int `mapstructure:"-"` diff --git a/plugin/storage/es/factory_test.go b/plugin/storage/es/factory_test.go index f6c6d23385f..b004f6e73f0 100644 --- a/plugin/storage/es/factory_test.go +++ b/plugin/storage/es/factory_test.go @@ -277,6 +277,39 @@ func TestESStorageFactoryWithConfig(t *testing.T) { defer factory.Close() } +func TestConfigurationValidation(t *testing.T) { + testCases := []struct { + name string + cfg escfg.Configuration + wantErr bool + }{ + { + name: "valid configuration", + cfg: escfg.Configuration{ + Servers: []string{"http://localhost:9200"}, + }, + wantErr: false, + }, + { + name: "missing servers", + cfg: escfg.Configuration{}, + wantErr: true, + }, + } + for _, test := range testCases { + t.Run(test.name, func(t *testing.T) { + err := test.cfg.Validate() + if test.wantErr { + assert.Error(t, err) + _, err = NewFactoryWithConfig(test.cfg, metrics.NullFactory, zap.NewNop()) + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) + } + +} func TestESStorageFactoryWithConfigError(t *testing.T) { cfg := escfg.Configuration{ Servers: []string{"http://badurl"}, From a6cec262009c8cbd30f8bfa3b48c99ecb3b467fd Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Mon, 26 Feb 2024 23:41:49 +0530 Subject: [PATCH 26/27] fix lint Signed-off-by: Harshvir Potpose --- plugin/storage/es/factory_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/storage/es/factory_test.go b/plugin/storage/es/factory_test.go index b004f6e73f0..252126f667b 100644 --- a/plugin/storage/es/factory_test.go +++ b/plugin/storage/es/factory_test.go @@ -308,8 +308,8 @@ func TestConfigurationValidation(t *testing.T) { } }) } - } + func TestESStorageFactoryWithConfigError(t *testing.T) { cfg := escfg.Configuration{ Servers: []string{"http://badurl"}, From 915e83f3344499a0dafa973bf15ff7aff29d56fb Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Tue, 27 Feb 2024 00:56:57 +0530 Subject: [PATCH 27/27] fix Signed-off-by: Harshvir Potpose --- plugin/storage/es/factory_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/storage/es/factory_test.go b/plugin/storage/es/factory_test.go index 252126f667b..039552c574b 100644 --- a/plugin/storage/es/factory_test.go +++ b/plugin/storage/es/factory_test.go @@ -300,11 +300,11 @@ func TestConfigurationValidation(t *testing.T) { t.Run(test.name, func(t *testing.T) { err := test.cfg.Validate() if test.wantErr { - assert.Error(t, err) + require.Error(t, err) _, err = NewFactoryWithConfig(test.cfg, metrics.NullFactory, zap.NewNop()) - assert.Error(t, err) + require.Error(t, err) } else { - assert.NoError(t, err) + require.NoError(t, err) } }) }