From 379204e9ed575829d36f5c4a11e911697b7c4bb9 Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Sat, 5 Jun 2021 11:20:54 -0700 Subject: [PATCH 01/11] Added overloading url function, changed CreateSession value in one unit Test --- .../ext/http/client/curl/http_client_curl.h | 14 ++++++++++++++ .../opentelemetry/ext/http/client/http_client.h | 5 ++++- ext/test/http/curl_http_test.cc | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h index ffdb10985a..161d0a6f6d 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h @@ -6,6 +6,7 @@ #include "http_operation_curl.h" #include "opentelemetry/ext/http/client/http_client.h" #include "opentelemetry/version.h" +#include "opentelemetry/ext/http/common/url_parser.h" #include #include @@ -259,6 +260,19 @@ class HttpClient : public http_client::HttpClient return session; } + std::shared_ptr CreateSession(nostd::string_view url) noexcept override + { + auto parsedUrl = common::UrlParser(std::string(url)); + if (!parsedUrl.success_) { + return std::make_shared(*this, "empty-host", 80); + } + auto session = std::make_shared(*this, parsedUrl.host_, parsedUrl.port_); + auto session_id = ++next_session_id_; + session->SetId(session_id); + sessions_.insert({session_id, session}); + return session; + } + bool CancelAllSessions() noexcept override { for (auto &session : sessions_) diff --git a/ext/include/opentelemetry/ext/http/client/http_client.h b/ext/include/opentelemetry/ext/http/client/http_client.h index 88938dcda5..3827690dd4 100644 --- a/ext/include/opentelemetry/ext/http/client/http_client.h +++ b/ext/include/opentelemetry/ext/http/client/http_client.h @@ -227,7 +227,10 @@ class HttpClient { public: virtual std::shared_ptr CreateSession(nostd::string_view host, - uint16_t port = 80) noexcept = 0; + uint16_t port) noexcept = 0; + + virtual std::shared_ptr CreateSession(nostd::string_view url) noexcept = 0; + virtual bool CancelAllSessions() noexcept = 0; virtual bool FinishAllSessions() noexcept = 0; diff --git a/ext/test/http/curl_http_test.cc b/ext/test/http/curl_http_test.cc index a0678fd9ab..45114a1fec 100644 --- a/ext/test/http/curl_http_test.cc +++ b/ext/test/http/curl_http_test.cc @@ -191,7 +191,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequest) auto session_manager = http_client::HttpClientFactory::Create(); EXPECT_TRUE(session_manager != nullptr); - auto session = session_manager->CreateSession("127.0.0.1", HTTP_PORT); + auto session = session_manager->CreateSession("http://127.0.0.1:19000"); auto request = session->CreateRequest(); request->SetUri("get/"); GetEventHandler *handler = new GetEventHandler(); From 3ccc3bf4d836cdaa9d43c04a0ada4851d0d720d0 Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Mon, 7 Jun 2021 11:16:22 -0700 Subject: [PATCH 02/11] Update Return Value of failed parsed URL --- .../opentelemetry/ext/http/client/curl/http_client_curl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h index 161d0a6f6d..8cd73072bc 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h @@ -264,7 +264,7 @@ class HttpClient : public http_client::HttpClient { auto parsedUrl = common::UrlParser(std::string(url)); if (!parsedUrl.success_) { - return std::make_shared(*this, "empty-host", 80); + return std::make_shared(*this, "", 80); } auto session = std::make_shared(*this, parsedUrl.host_, parsedUrl.port_); auto session_id = ++next_session_id_; From d4a13cb9e43e8f335c3777b40b37c7d4c659ee55 Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Mon, 7 Jun 2021 16:27:33 -0700 Subject: [PATCH 03/11] Fix formatting and remove TODO comment --- .../opentelemetry/ext/http/client/curl/http_client_curl.h | 7 ++++--- ext/include/opentelemetry/ext/http/client/http_client.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h index 8cd73072bc..62e6138599 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h @@ -5,8 +5,8 @@ #include "http_operation_curl.h" #include "opentelemetry/ext/http/client/http_client.h" -#include "opentelemetry/version.h" #include "opentelemetry/ext/http/common/url_parser.h" +#include "opentelemetry/version.h" #include #include @@ -121,7 +121,7 @@ class Session : public http_client::Session { if (host.rfind("http://", 0) != 0 && host.rfind("https://", 0) != 0) { - host_ = "http://" + host; // TODO - https support + host_ = "http://" + host; } else { @@ -263,7 +263,8 @@ class HttpClient : public http_client::HttpClient std::shared_ptr CreateSession(nostd::string_view url) noexcept override { auto parsedUrl = common::UrlParser(std::string(url)); - if (!parsedUrl.success_) { + if (!parsedUrl.success_) + { return std::make_shared(*this, "", 80); } auto session = std::make_shared(*this, parsedUrl.host_, parsedUrl.port_); diff --git a/ext/include/opentelemetry/ext/http/client/http_client.h b/ext/include/opentelemetry/ext/http/client/http_client.h index 3827690dd4..7d3d71bc35 100644 --- a/ext/include/opentelemetry/ext/http/client/http_client.h +++ b/ext/include/opentelemetry/ext/http/client/http_client.h @@ -231,7 +231,7 @@ class HttpClient virtual std::shared_ptr CreateSession(nostd::string_view url) noexcept = 0; - virtual bool CancelAllSessions() noexcept = 0; + virtual bool CancelAllSessions() noexcept = 0; virtual bool FinishAllSessions() noexcept = 0; From 481d4b43ed2e9a740091cf51b2aa57ad1108899a Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Mon, 7 Jun 2021 16:59:36 -0700 Subject: [PATCH 04/11] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16156529c6..e8dcebbc2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Increment the: * PATCH version when you make backwards compatible bug fixes. ## [Unreleased] +* [INSTRUMENTATION] HTTPClient: Add support for full URL argument ([#833](https://github.com/open-telemetry/opentelemetry-cpp/pull/833)) ## [1.0.0-rc1] 2021-06-04 From 2a8b9a8cad32db6d7b77c52bcf0a917f76e7e6cc Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Mon, 7 Jun 2021 23:30:38 -0700 Subject: [PATCH 05/11] Fix linting Change Log error --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8dcebbc2b..671f32b37b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Increment the: * PATCH version when you make backwards compatible bug fixes. ## [Unreleased] + * [INSTRUMENTATION] HTTPClient: Add support for full URL argument ([#833](https://github.com/open-telemetry/opentelemetry-cpp/pull/833)) ## [1.0.0-rc1] 2021-06-04 From 9d289208986a4aa16bd76ad89b3a855d75e47d07 Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Wed, 9 Jun 2021 11:47:31 -0700 Subject: [PATCH 06/11] Deprecated original HTTP method, changed tests to match new singular method, simplified original Session constructor --- .vscode/settings.json | 89 +++++++++++++++++++ CHANGELOG.md | 3 +- .../ext/http/client/curl/http_client_curl.h | 30 ++----- .../ext/http/client/http_client.h | 3 - ext/test/http/curl_http_test.cc | 11 ++- 5 files changed, 103 insertions(+), 33 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..f10c2ee82f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,89 @@ +{ + "files.associations": { + "memory": "cpp", + "iosfwd": "cpp", + "__bit_reference": "cpp", + "__config": "cpp", + "__debug": "cpp", + "__errc": "cpp", + "__functional_base": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__mutex_base": "cpp", + "__node_handle": "cpp", + "__nullptr": "cpp", + "__split_buffer": "cpp", + "__string": "cpp", + "__threading_support": "cpp", + "__tree": "cpp", + "__tuple": "cpp", + "algorithm": "cpp", + "any": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "exception": "cpp", + "forward_list": "cpp", + "fstream": "cpp", + "functional": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "ios": "cpp", + "iostream": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "map": "cpp", + "mutex": "cpp", + "new": "cpp", + "numeric": "cpp", + "optional": "cpp", + "ostream": "cpp", + "random": "cpp", + "ratio": "cpp", + "regex": "cpp", + "set": "cpp", + "span": "cpp", + "sstream": "cpp", + "stack": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "thread": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "utility": "cpp", + "valarray": "cpp", + "variant": "cpp", + "vector": "cpp", + "pointers": "cpp" + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 427d445338..afdb4ac1a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,10 @@ Increment the: ## [Unreleased] -* [INSTRUMENTATION] HTTPClient: Add support for full URL argument ([#833](https://github.com/open-telemetry/opentelemetry-cpp/pull/833)) +* [INSTRUMENTATION] HTTPClient: Change support for full URL argument ([#833](https://github.com/open-telemetry/opentelemetry-cpp/pull/833)) * [EXPORTER] Add OTLP/HTTP+JSON Protocol exporter ([#810](https://github.com/open-telemetry/opentelemetry-cpp/pull/810)) * [EXPORTER] Rename `OtlpExporter` to `OtlpGrpcExporter`, rename `otlp_exporter.h` to `otlp_grpc_exporter.h` ([#810](https://github.com/open-telemetry/opentelemetry-cpp/pull/810)) - ## [1.0.0-rc1] 2021-06-04 * [BUILD] Enable Jaeger exporter build in Windows ([#815](https://github.com/open-telemetry/opentelemetry-cpp/pull/815)) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h index 62e6138599..126b09acf8 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h @@ -116,18 +116,13 @@ class HttpClient; class Session : public http_client::Session { public: - Session(HttpClient &http_client, const std::string &host, uint16_t port = 80) + Session(HttpClient &http_client, + std::string scheme = "http", + const std::string &host = "", + uint16_t port = 80) : http_client_(http_client), is_session_active_(false) { - if (host.rfind("http://", 0) != 0 && host.rfind("https://", 0) != 0) - { - host_ = "http://" + host; - } - else - { - host_ = host; - } - host_ += ":" + std::to_string(port) + "/"; + host_ = scheme + "://" + host + ":" + std::to_string(port) + "/"; } std::shared_ptr CreateRequest() noexcept override @@ -250,24 +245,15 @@ class HttpClient : public http_client::HttpClient // The call (curl_global_init) is not thread safe. Ensure this is called only once. HttpClient() : next_session_id_{0} { curl_global_init(CURL_GLOBAL_ALL); } - std::shared_ptr CreateSession(nostd::string_view host, - uint16_t port = 80) noexcept override - { - auto session = std::make_shared(*this, std::string(host), port); - auto session_id = ++next_session_id_; - session->SetId(session_id); - sessions_.insert({session_id, session}); - return session; - } - std::shared_ptr CreateSession(nostd::string_view url) noexcept override { auto parsedUrl = common::UrlParser(std::string(url)); if (!parsedUrl.success_) { - return std::make_shared(*this, "", 80); + return std::make_shared(*this); } - auto session = std::make_shared(*this, parsedUrl.host_, parsedUrl.port_); + auto session = + std::make_shared(*this, parsedUrl.scheme_, parsedUrl.host_, parsedUrl.port_); auto session_id = ++next_session_id_; session->SetId(session_id); sessions_.insert({session_id, session}); diff --git a/ext/include/opentelemetry/ext/http/client/http_client.h b/ext/include/opentelemetry/ext/http/client/http_client.h index 7d3d71bc35..c86cf4f2cb 100644 --- a/ext/include/opentelemetry/ext/http/client/http_client.h +++ b/ext/include/opentelemetry/ext/http/client/http_client.h @@ -226,9 +226,6 @@ class Session class HttpClient { public: - virtual std::shared_ptr CreateSession(nostd::string_view host, - uint16_t port) noexcept = 0; - virtual std::shared_ptr CreateSession(nostd::string_view url) noexcept = 0; virtual bool CancelAllSessions() noexcept = 0; diff --git a/ext/test/http/curl_http_test.cc b/ext/test/http/curl_http_test.cc index 45114a1fec..31c0d06570 100644 --- a/ext/test/http/curl_http_test.cc +++ b/ext/test/http/curl_http_test.cc @@ -208,7 +208,7 @@ TEST_F(BasicCurlHttpTests, SendPostRequest) auto session_manager = http_client::HttpClientFactory::Create(); EXPECT_TRUE(session_manager != nullptr); - auto session = session_manager->CreateSession("127.0.0.1", HTTP_PORT); + auto session = session_manager->CreateSession("http://127.0.0.1:19000"); auto request = session->CreateRequest(); request->SetUri("post/"); request->SetMethod(http_client::Method::Post); @@ -235,8 +235,7 @@ TEST_F(BasicCurlHttpTests, RequestTimeout) auto session_manager = http_client::HttpClientFactory::Create(); EXPECT_TRUE(session_manager != nullptr); - auto session = - session_manager->CreateSession("222.222.222.200", HTTP_PORT); // Non Existing address + auto session = session_manager->CreateSession("222.222.222.200:19000"); // Non Existing address auto request = session->CreateRequest(); request->SetUri("get/"); GetEventHandler *handler = new GetEventHandler(); @@ -309,14 +308,14 @@ TEST_F(BasicCurlHttpTests, GetBaseUri) { curl::HttpClient session_manager; - auto session = session_manager.CreateSession("127.0.0.1", 80); + auto session = session_manager.CreateSession("127.0.0.1:80"); ASSERT_EQ(std::static_pointer_cast(session)->GetBaseUri(), "http://127.0.0.1:80/"); - session = session_manager.CreateSession("https://127.0.0.1", 443); + session = session_manager.CreateSession("https://127.0.0.1:443"); ASSERT_EQ(std::static_pointer_cast(session)->GetBaseUri(), "https://127.0.0.1:443/"); - session = session_manager.CreateSession("http://127.0.0.1", 31339); + session = session_manager.CreateSession("http://127.0.0.1:31339"); ASSERT_EQ(std::static_pointer_cast(session)->GetBaseUri(), "http://127.0.0.1:31339/"); } From fe2c73e5de33a4e14bb7628cfcca83b642018bac Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Wed, 9 Jun 2021 11:49:05 -0700 Subject: [PATCH 07/11] Delete settings.json --- .vscode/settings.json | 89 ------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index f10c2ee82f..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "files.associations": { - "memory": "cpp", - "iosfwd": "cpp", - "__bit_reference": "cpp", - "__config": "cpp", - "__debug": "cpp", - "__errc": "cpp", - "__functional_base": "cpp", - "__hash_table": "cpp", - "__locale": "cpp", - "__mutex_base": "cpp", - "__node_handle": "cpp", - "__nullptr": "cpp", - "__split_buffer": "cpp", - "__string": "cpp", - "__threading_support": "cpp", - "__tree": "cpp", - "__tuple": "cpp", - "algorithm": "cpp", - "any": "cpp", - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "cinttypes": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "codecvt": "cpp", - "complex": "cpp", - "condition_variable": "cpp", - "csignal": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "exception": "cpp", - "forward_list": "cpp", - "fstream": "cpp", - "functional": "cpp", - "future": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "ios": "cpp", - "iostream": "cpp", - "istream": "cpp", - "iterator": "cpp", - "limits": "cpp", - "list": "cpp", - "locale": "cpp", - "map": "cpp", - "mutex": "cpp", - "new": "cpp", - "numeric": "cpp", - "optional": "cpp", - "ostream": "cpp", - "random": "cpp", - "ratio": "cpp", - "regex": "cpp", - "set": "cpp", - "span": "cpp", - "sstream": "cpp", - "stack": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "thread": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "typeinfo": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "utility": "cpp", - "valarray": "cpp", - "variant": "cpp", - "vector": "cpp", - "pointers": "cpp" - } -} \ No newline at end of file From 0ea406efd6c16eb13b4e4d8ea65ed25e5dfdac95 Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Thu, 10 Jun 2021 22:32:42 -0700 Subject: [PATCH 08/11] Fix old uses of CreateSession --- exporters/elasticsearch/src/es_log_exporter.cc | 2 +- ext/test/w3c_tracecontext_test/main.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exporters/elasticsearch/src/es_log_exporter.cc b/exporters/elasticsearch/src/es_log_exporter.cc index 28d59ac4f8..b17950f867 100644 --- a/exporters/elasticsearch/src/es_log_exporter.cc +++ b/exporters/elasticsearch/src/es_log_exporter.cc @@ -140,7 +140,7 @@ sdk::common::ExportResult ElasticsearchLogExporter::Export( } // Create a connection to the ElasticSearch instance - auto session = http_client_->CreateSession(options_.host_, options_.port_); + auto session = http_client_->CreateSession(options_.host_ + options_.port_); auto request = session->CreateRequest(); // Populate the request with headers and methods diff --git a/ext/test/w3c_tracecontext_test/main.cc b/ext/test/w3c_tracecontext_test/main.cc index c2c834f317..9a2d197ead 100644 --- a/ext/test/w3c_tracecontext_test/main.cc +++ b/ext/test/w3c_tracecontext_test/main.cc @@ -105,7 +105,7 @@ void send_request(opentelemetry::ext::http::client::curl::HttpClient &client, Uri uri{url}; - auto session = client.CreateSession(uri.host, uri.port); + auto session = client.CreateSession(uri.host + uri.port); auto request = session->CreateRequest(); request->SetMethod(opentelemetry::ext::http::client::Method::Post); From 6ecbebfd466b4cce5b0dcac0992dd5da734bd8c9 Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Thu, 10 Jun 2021 23:12:09 -0700 Subject: [PATCH 09/11] Fixing main.cc Create Session --- ext/include/opentelemetry/ext/http/client/http_client.h | 2 +- ext/test/w3c_tracecontext_test/main.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/include/opentelemetry/ext/http/client/http_client.h b/ext/include/opentelemetry/ext/http/client/http_client.h index c86cf4f2cb..4e3e9845e0 100644 --- a/ext/include/opentelemetry/ext/http/client/http_client.h +++ b/ext/include/opentelemetry/ext/http/client/http_client.h @@ -45,7 +45,7 @@ Async Request: }; HttpClient httpClient; // implementer can provide singleton implementation for it - auto session = httpClient.createSession("localhost", 8000); + auto session = httpClient.createSession("localhost" + 8000); auto request = session->CreateRequest(); request->AddHeader(..); SimpleResponseHandler res_handler; diff --git a/ext/test/w3c_tracecontext_test/main.cc b/ext/test/w3c_tracecontext_test/main.cc index 9a2d197ead..bc0f9bd65d 100644 --- a/ext/test/w3c_tracecontext_test/main.cc +++ b/ext/test/w3c_tracecontext_test/main.cc @@ -105,7 +105,7 @@ void send_request(opentelemetry::ext::http::client::curl::HttpClient &client, Uri uri{url}; - auto session = client.CreateSession(uri.host + uri.port); + auto session = client.CreateSession(url); auto request = session->CreateRequest(); request->SetMethod(opentelemetry::ext::http::client::Method::Post); From 2be9bd561350f9efa068caf6863fea5b2797af7b Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Thu, 10 Jun 2021 23:50:42 -0700 Subject: [PATCH 10/11] Final fix to CreateSession bugs --- exporters/elasticsearch/src/es_log_exporter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/elasticsearch/src/es_log_exporter.cc b/exporters/elasticsearch/src/es_log_exporter.cc index b17950f867..a6d51d8733 100644 --- a/exporters/elasticsearch/src/es_log_exporter.cc +++ b/exporters/elasticsearch/src/es_log_exporter.cc @@ -140,7 +140,7 @@ sdk::common::ExportResult ElasticsearchLogExporter::Export( } // Create a connection to the ElasticSearch instance - auto session = http_client_->CreateSession(options_.host_ + options_.port_); + auto session = http_client_->CreateSession(options_. + std::to_string(options_.port)); auto request = session->CreateRequest(); // Populate the request with headers and methods From 365e18dd3fb19cc1eea973adf6a7249409cd7279 Mon Sep 17 00:00:00 2001 From: Oliver Hamuy Date: Fri, 11 Jun 2021 00:14:10 -0700 Subject: [PATCH 11/11] Fix CreateSession Bugs --- exporters/elasticsearch/src/es_log_exporter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/elasticsearch/src/es_log_exporter.cc b/exporters/elasticsearch/src/es_log_exporter.cc index a6d51d8733..c7201db907 100644 --- a/exporters/elasticsearch/src/es_log_exporter.cc +++ b/exporters/elasticsearch/src/es_log_exporter.cc @@ -140,7 +140,7 @@ sdk::common::ExportResult ElasticsearchLogExporter::Export( } // Create a connection to the ElasticSearch instance - auto session = http_client_->CreateSession(options_. + std::to_string(options_.port)); + auto session = http_client_->CreateSession(options_.host_ + std::to_string(options_.port_)); auto request = session->CreateRequest(); // Populate the request with headers and methods