From 0ea1f2c6442ac53f567077633865930794649699 Mon Sep 17 00:00:00 2001 From: Maxime Leblanc Date: Tue, 8 Oct 2024 09:12:37 +0200 Subject: [PATCH] [EXPORTER] Fix crash in ElasticsearchLogRecordExporter when (#3082) using constructor with user given options (#3078) Closes #3078 --- .../elasticsearch/src/es_log_record_exporter.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exporters/elasticsearch/src/es_log_record_exporter.cc b/exporters/elasticsearch/src/es_log_record_exporter.cc index f464df5006..1ec786a198 100644 --- a/exporters/elasticsearch/src/es_log_record_exporter.cc +++ b/exporters/elasticsearch/src/es_log_record_exporter.cc @@ -288,7 +288,12 @@ class AsyncResponseHandler : public http_client::EventHandler #endif ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter() - : options_{ElasticsearchExporterOptions()}, + : ElasticsearchLogRecordExporter(ElasticsearchExporterOptions()) +{} + +ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter( + const ElasticsearchExporterOptions &options) + : options_{options}, http_client_{ext::http::client::HttpClientFactory::Create()} #ifdef ENABLE_ASYNC_EXPORT , @@ -301,11 +306,6 @@ ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter() #endif } -ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter( - const ElasticsearchExporterOptions &options) - : options_{options}, http_client_{ext::http::client::HttpClientFactory::Create()} -{} - std::unique_ptr ElasticsearchLogRecordExporter::MakeRecordable() noexcept { return std::unique_ptr(new ElasticSearchRecordable());