From db8c04c3e44d6ac4689f918bd0d2d0363b894db0 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:56 +0530 Subject: [PATCH] [jaeger-v2] Add support for Opensearch (#5257) ## Which problem is this PR solving? - part of #4843 ## Description of the changes - Added OpenSearch support in jaeger-V2. - Reused the existing Elasticsearch factory for OpenSearch. ## How was this change tested? - tested locally by running jaeger-v2 with newly added opensearch config-file. - Run the opensearch container: ```bash docker run --rm --name opensearch -p 9200:9200 -e "discovery.type=single-node" opensearchproject/opensearch:1.3.0 ``` - Execute below to run jaeger-V2 ```bash go run -tags=ui ./cmd/jaeger/. --config ./cmd/jaeger/config-opensearch.yaml ``` ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Harshvir Potpose Signed-off-by: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com> --- cmd/jaeger/config-opensearch.yaml | 54 +++++++++++++++++++ .../extension/jaegerstorage/config.go | 1 + .../extension/jaegerstorage/extension.go | 7 +++ 3 files changed, 62 insertions(+) create mode 100644 cmd/jaeger/config-opensearch.yaml diff --git a/cmd/jaeger/config-opensearch.yaml b/cmd/jaeger/config-opensearch.yaml new file mode 100644 index 00000000000..7debd780ee6 --- /dev/null +++ b/cmd/jaeger/config-opensearch.yaml @@ -0,0 +1,54 @@ +service: + extensions: [jaeger_storage, jaeger_query] + pipelines: + traces: + receivers: [otlp] + processors: [batch] + exporters: [jaeger_storage_exporter] + +extensions: + jaeger_query: + trace_storage: os_main + trace_storage_archive: os_archive + ui_config: ./cmd/jaeger/config-ui.json + + jaeger_storage: + opensearch: + os_main: + server_urls: https://localhost:9200 + log_level: "error" + index_prefix: "jaeger-main" + use_aliases: true + username: "admin" + password: "admin" + tls: + enabled: true + skip_host_verify: true + tags_as_fields: + all: true + + os_archive: + server_urls: https://localhost:9200 + log_level: "error" + index_prefix: "jaeger-archive" + use_aliases: true + username: "admin" + password: "admin" + tls: + enabled: true + skip_host_verify: true + tags_as_fields: + all: true + +receivers: + otlp: + protocols: + grpc: + http: + +processors: + batch: + +exporters: + jaeger_storage_exporter: + trace_storage: os_main diff --git a/cmd/jaeger/internal/extension/jaegerstorage/config.go b/cmd/jaeger/internal/extension/jaegerstorage/config.go index 44636000724..10afd448c9e 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/config.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/config.go @@ -19,6 +19,7 @@ type Config struct { Memory map[string]memoryCfg.Configuration `mapstructure:"memory"` Badger map[string]badgerCfg.NamespaceConfig `mapstructure:"badger"` GRPC map[string]grpcCfg.Configuration `mapstructure:"grpc"` + Opensearch map[string]esCfg.Configuration `mapstructure:"opensearch"` Elasticsearch map[string]esCfg.Configuration `mapstructure:"elasticsearch"` Cassandra map[string]cassandraCfg.Configuration `mapstructure:"cassandra"` // TODO add other storage types here diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index 2f292ad030f..f718ca8cef0 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -130,6 +130,12 @@ func (s *storageExt) Start(ctx context.Context, host component.Host) error { cfg: s.config.Elasticsearch, builder: es.NewFactoryWithConfig, } + osStarter := &starter[esCfg.Configuration, *es.Factory]{ + ext: s, + storageKind: "opensearch", + cfg: s.config.Opensearch, + builder: es.NewFactoryWithConfig, + } cassandraStarter := &starter[cassandraCfg.Configuration, *cassandra.Factory]{ ext: s, storageKind: "cassandra", @@ -142,6 +148,7 @@ func (s *storageExt) Start(ctx context.Context, host component.Host) error { badgerStarter.build, grpcStarter.build, esStarter.build, + osStarter.build, cassandraStarter.build, // TODO add support for other backends }