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

ElasticSearch http client URL is wrongly formated #3079

Closed
MaxLeb opened this issue Oct 4, 2024 · 2 comments · Fixed by #3081
Closed

ElasticSearch http client URL is wrongly formated #3079

MaxLeb opened this issue Oct 4, 2024 · 2 comments · Fixed by #3081
Assignees
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@MaxLeb
Copy link

MaxLeb commented Oct 4, 2024

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 :)

@MaxLeb MaxLeb added the bug Something isn't working label Oct 4, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 4, 2024
@MaxLeb
Copy link
Author

MaxLeb commented Oct 4, 2024

Proposed patch:
0001-EXPORTER-Fix-ElasticsearchLogRecordExporter-http-cli.patch

@marcalff
Copy link
Member

marcalff commented Oct 4, 2024

Thanks @MaxLeb for the report and the fix.

Please file a PR so it can be processed (CI, review, merge).

I see you have other fixes as well, PR also welcome for these.

@owent owent self-assigned this Oct 7, 2024
@marcalff marcalff added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants