|
12 | 12 | #include "opentelemetry/ext/http/client/http_client_factory.h" |
13 | 13 | #include "opentelemetry/ext/http/common/url_parser.h" |
14 | 14 |
|
15 | | -#include "nlohmann/json.hpp" |
16 | | - |
17 | 15 | #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" |
18 | 16 |
|
19 | 17 | #include <mutex> |
20 | 18 | #include "google/protobuf/message.h" |
21 | 19 | #include "google/protobuf/reflection.h" |
22 | 20 | #include "google/protobuf/stubs/common.h" |
| 21 | +#include "nlohmann/json.hpp" |
23 | 22 |
|
24 | 23 | #if defined(GOOGLE_PROTOBUF_VERSION) && GOOGLE_PROTOBUF_VERSION >= 3007000 |
25 | 24 | # include "google/protobuf/stubs/strutil.h" |
@@ -362,7 +361,7 @@ static void ConvertGenericMessageToJson(nlohmann::json &value, |
362 | 361 | } |
363 | 362 | } |
364 | 363 |
|
365 | | -static bool SerializeToHttpBody(http_client::Body &output, const google::protobuf::Message &message) |
| 364 | +bool SerializeToHttpBody(http_client::Body &output, const google::protobuf::Message &message) |
366 | 365 | { |
367 | 366 | auto body_size = message.ByteSizeLong(); |
368 | 367 | if (body_size > 0) |
@@ -566,6 +565,11 @@ OtlpHttpClient::OtlpHttpClient(OtlpHttpClientOptions &&options) |
566 | 565 | : options_(options), http_client_(http_client::HttpClientFactory::Create()) |
567 | 566 | {} |
568 | 567 |
|
| 568 | +OtlpHttpClient::OtlpHttpClient(OtlpHttpClientOptions &&options, |
| 569 | + std::shared_ptr<ext::http::client::HttpClient> http_client) |
| 570 | + : options_(options), http_client_(http_client) |
| 571 | +{} |
| 572 | + |
569 | 573 | // ----------------------------- HTTP Client methods ------------------------------ |
570 | 574 | opentelemetry::sdk::common::ExportResult OtlpHttpClient::Export( |
571 | 575 | const google::protobuf::Message &message) noexcept |
|
0 commit comments