Skip to content

Commit c5ad161

Browse files
authored
[EXPORTER] Allow custom HttpClient in OTLP HTTP (#3930)
1 parent af66d8d commit c5ad161

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ Increment the:
5151
* [CODE HEALTH] Fix clang-tidy performance enum size warnings
5252
[#3923](https://github.com/open-telemetry/opentelemetry-cpp/pull/3923)
5353

54+
* [EXPORTER] Allow custom HttpClient in OTLP HTTP
55+
[#3930](https://github.com/open-telemetry/opentelemetry-cpp/pull/3930)
56+
5457
Important changes:
5558

5659
* [BUILD] Revisit EventLogger deprecation

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_client.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ class OtlpHttpClient
158158
*/
159159
explicit OtlpHttpClient(OtlpHttpClientOptions &&options);
160160

161+
/**
162+
* Create an OtlpHttpClient using the specified http client.
163+
* @param options the Otlp http client options to be used for exporting
164+
* @param http_client the http client to be used for exporting
165+
*/
166+
OtlpHttpClient(OtlpHttpClientOptions &&options,
167+
std::shared_ptr<ext::http::client::HttpClient> http_client);
168+
161169
~OtlpHttpClient();
162170
OtlpHttpClient(const OtlpHttpClient &) = delete;
163171
OtlpHttpClient &operator=(const OtlpHttpClient &) = delete;
@@ -266,20 +274,6 @@ class OtlpHttpClient
266274
*/
267275
bool cleanupGCSessions() noexcept;
268276

269-
// For testing
270-
friend class OtlpHttpExporterTestPeer;
271-
friend class OtlpHttpLogRecordExporterTestPeer;
272-
friend class OtlpHttpMetricExporterTestPeer;
273-
274-
/**
275-
* Create an OtlpHttpClient using the specified http client.
276-
* Only tests can call this constructor directly.
277-
* @param options the Otlp http client options to be used for exporting
278-
* @param http_client the http client to be used for exporting
279-
*/
280-
OtlpHttpClient(OtlpHttpClientOptions &&options,
281-
std::shared_ptr<ext::http::client::HttpClient> http_client);
282-
283277
// Stores if this HTTP client had its Shutdown() method called
284278
std::atomic<bool> is_shutdown_;
285279

0 commit comments

Comments
 (0)