Skip to content

ElasticSearch http client URL is wrongly formated #3079

@MaxLeb

Description

@MaxLeb

Describe your environment

Using a manually built version of OpenTelemetry 1.16.1 on macOS with :

-DWITH_EXAMPLES=OFF
-DWITH_OTLP_HTTP=ON
-DBUILD_TESTING=OFF
-DWITH_OTLP_GRPC=OFF
-DWITH_LOGS_PREVIEW=ON
-DOPENTELEMETRY_INSTALL=ON
-DBUILD_SHARED_LIBS=OFF
-DWITH_ASYNC_EXPORT_PREVIEW=ON
-DCMAKE_CXX_STANDARD=17
-DWITH_ELASTICSEARCH=ON

Steps to reproduce

The usage is pretty simple:

First an init of the exporter with a single log record processor:

opentelemetry::exporter::logs::ElasticsearchExporterOptions opts(
,
9200,
"logs",
30,
true);

auto elkExporter = std::make_uniqueopentelemetry::exporter::logs::ElasticsearchLogRecordExporter(opts);

auto elkProcessor = opentelemetry::sdk::logs::SimpleLogRecordProcessorFactory::Create(std::move(elkExporter));

std::shared_ptropentelemetry::logs::LoggerProvider provider = opentelemetry::sdk::logs::LoggerProviderFactory::Create(
std::move(elkProcessor), resource);

opentelemetry::logs::Provider::SetLoggerProvider(provider);

m_Logger = provider->GetLogger("MyLogger", SOURCE_NAME);
Then, when logs needs to be sent a call to m_Logger.EmitLogRecord(xxx)

What is the expected behavior?
Host targeted by the exporter should have the <host>:<port> format/

What is the actual behavior?
The exporter was reporting this error opentelemetry: [ES Log Exporter] Connection to elasticsearch failed.
When adding the reason to the string it was outputing this: Could not resolve host: elastic.mydomain.com9200 (missing :)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions