8 #include <condition_variable>
15 #include <unordered_map>
17 #include "opentelemetry/exporters/otlp/otlp_environment.h"
18 #include "opentelemetry/exporters/otlp/otlp_http.h"
19 #include "opentelemetry/ext/http/client/http_client.h"
20 #include "opentelemetry/nostd/string_view.h"
21 #include "opentelemetry/nostd/variant.h"
22 #include "opentelemetry/sdk/common/exporter_utils.h"
23 #include "opentelemetry/sdk/common/thread_instrumentation.h"
24 #include "opentelemetry/version.h"
73 std::chrono::system_clock::duration
timeout;
91 std::shared_ptr<sdk::common::ThreadInstrumentation>(
nullptr);
95 bool input_ssl_insecure_skip_verify,
109 bool input_use_json_name,
110 bool input_console_debug,
111 std::chrono::system_clock::duration input_timeout,
113 std::uint32_t input_retry_policy_max_attempts,
114 std::chrono::duration<float> input_retry_policy_initial_backoff,
115 std::chrono::duration<float> input_retry_policy_max_backoff,
116 float input_retry_policy_backoff_multiplier,
117 const std::shared_ptr<sdk::common::ThreadInstrumentation> &input_thread_instrumentation,
118 std::size_t input_concurrent_sessions = 64,
119 std::size_t input_max_requests_per_connection = 8,
123 input_ssl_insecure_skip_verify,
124 input_ssl_ca_cert_path,
125 input_ssl_ca_cert_string,
126 input_ssl_client_key_path,
127 input_ssl_client_key_string,
128 input_ssl_client_cert_path,
129 input_ssl_client_cert_string,
133 input_ssl_cipher_suite),
141 retry_policy{input_retry_policy_max_attempts, input_retry_policy_initial_backoff,
142 input_retry_policy_max_backoff, input_retry_policy_backoff_multiplier},
183 const google::protobuf::Message &message,
195 const google::protobuf::Message &message,
197 std::size_t max_running_requests) noexcept;
210 bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept;
217 void ReleaseSession(
const opentelemetry::ext::http::client::Session &session) noexcept;
232 struct HttpSessionData
234 std::shared_ptr<opentelemetry::ext::http::client::Session> session;
235 std::shared_ptr<opentelemetry::ext::http::client::EventHandler> event_handle;
237 HttpSessionData() =
default;
239 explicit HttpSessionData(
240 std::shared_ptr<opentelemetry::ext::http::client::Session> &&input_session,
241 std::shared_ptr<opentelemetry::ext::http::client::EventHandler> &&input_handle)
242 : session(
std::
move(input_session)), event_handle(
std::
move(input_handle))
252 const google::protobuf::Message &message,
259 void addSession(HttpSessionData &&session_data) noexcept;
267 bool cleanupGCSessions() noexcept;
284 std::atomic<
bool> is_shutdown_;
293 std::
string http_uri_;
299 std::list<HttpSessionData> gc_sessions_;
301 std::recursive_mutex session_manager_lock_;
303 std::mutex session_waker_lock_;
304 std::condition_variable session_waker_;
305 std::atomic<
size_t> start_session_counter_;
306 std::atomic<
size_t> finished_session_counter_;