From b1cf143131896eaff4684392ada4fb4b14c3b70f Mon Sep 17 00:00:00 2001 From: Maxime Leblanc Date: Mon, 7 Oct 2024 12:02:12 +0200 Subject: [PATCH] [EXPORTER] Fix crash in ElasticsearchLogRecordExporter when 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 bfc1ad3d64..1cf7fb7d97 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());