Skip to content

Commit 719c60f

Browse files
authored
Revert "Change OTLP HTTP content_type default to binary (#2558)" (#2562)
This reverts commit a883dc7.
1 parent a883dc7 commit 719c60f

14 files changed

+6
-154
lines changed

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ Increment the:
1515

1616
## [Unreleased]
1717

18-
* [SDK] Change OTLP HTTP content_type default to binary
19-
[#2558](https://github.com/open-telemetry/opentelemetry-cpp/pull/2558)
20-
2118
## [1.14.1] 2024-02-23
2219

2320
* [SDK] Restore Recordable API compatibility with versions < 1.14.0

exporters/otlp/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ cc_library(
104104
cc_library(
105105
name = "otlp_http_client",
106106
srcs = [
107-
"src/otlp_http.cc",
108107
"src/otlp_http_client.cc",
109108
],
110109
hdrs = [

exporters/otlp/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ if(WITH_OTLP_GRPC)
108108
endif()
109109

110110
if(WITH_OTLP_HTTP)
111-
add_library(opentelemetry_exporter_otlp_http_client src/otlp_http.cc
112-
src/otlp_http_client.cc)
111+
add_library(opentelemetry_exporter_otlp_http_client src/otlp_http_client.cc)
113112
set_target_properties(opentelemetry_exporter_otlp_http_client
114113
PROPERTIES EXPORT_NAME otlp_http_client)
115114
set_target_version(opentelemetry_exporter_otlp_http_client)

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_environment.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ std::string GetOtlpDefaultHttpTracesEndpoint();
4141
std::string GetOtlpDefaultHttpMetricsEndpoint();
4242
std::string GetOtlpDefaultHttpLogsEndpoint();
4343

44-
std::string GetOtlpDefaultHttpTracesProtocol();
45-
std::string GetOtlpDefaultHttpMetricsProtocol();
46-
std::string GetOtlpDefaultHttpLogsProtocol();
47-
4844
// Compatibility with OTELCPP 1.8.2
4945
inline std::string GetOtlpDefaultHttpEndpoint()
5046
{

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#pragma once
55

6-
#include "opentelemetry/common/macros.h"
7-
#include "opentelemetry/nostd/string_view.h"
86
#include "opentelemetry/sdk/version/version.h"
97

108
OPENTELEMETRY_BEGIN_NAMESPACE
@@ -26,9 +24,6 @@ enum class HttpRequestContentType
2624
kBinary,
2725
};
2826

29-
OPENTELEMETRY_EXPORT HttpRequestContentType
30-
GetOtlpHttpProtocolFromString(nostd::string_view name) noexcept;
31-
3227
} // namespace otlp
3328
} // namespace exporter
3429
OPENTELEMETRY_END_NAMESPACE

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ struct OtlpHttpClientOptions
5252
/** SSL options. */
5353
ext::http::client::HttpSslOptions ssl_options;
5454

55-
// By default, post binary data
56-
HttpRequestContentType content_type = HttpRequestContentType::kBinary;
55+
// By default, post json data
56+
HttpRequestContentType content_type = HttpRequestContentType::kJson;
5757

5858
// If convert bytes into hex. By default, we will convert all bytes but id into base64
5959
// This option is ignored if content_type is not kJson

exporters/otlp/src/otlp_environment.cc

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -207,78 +207,6 @@ std::string GetOtlpDefaultHttpLogsEndpoint()
207207
return kDefault;
208208
}
209209

210-
std::string GetOtlpDefaultHttpTracesProtocol()
211-
{
212-
constexpr char kSignalEnv[] = "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL";
213-
constexpr char kGenericEnv[] = "OTEL_EXPORTER_OTLP_PROTOCOL";
214-
constexpr char kDefault[] = "http/protobuf";
215-
216-
std::string value;
217-
bool exists;
218-
219-
exists = sdk_common::GetStringEnvironmentVariable(kSignalEnv, value);
220-
if (exists)
221-
{
222-
return value;
223-
}
224-
225-
exists = sdk_common::GetStringEnvironmentVariable(kGenericEnv, value);
226-
if (exists)
227-
{
228-
return value;
229-
}
230-
231-
return kDefault;
232-
}
233-
234-
std::string GetOtlpDefaultHttpMetricsProtocol()
235-
{
236-
constexpr char kSignalEnv[] = "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL";
237-
constexpr char kGenericEnv[] = "OTEL_EXPORTER_OTLP_PROTOCOL";
238-
constexpr char kDefault[] = "http/protobuf";
239-
240-
std::string value;
241-
bool exists;
242-
243-
exists = sdk_common::GetStringEnvironmentVariable(kSignalEnv, value);
244-
if (exists)
245-
{
246-
return value;
247-
}
248-
249-
exists = sdk_common::GetStringEnvironmentVariable(kGenericEnv, value);
250-
if (exists)
251-
{
252-
return value;
253-
}
254-
255-
return kDefault;
256-
}
257-
258-
std::string GetOtlpDefaultHttpLogsProtocol()
259-
{
260-
constexpr char kSignalEnv[] = "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL";
261-
constexpr char kGenericEnv[] = "OTEL_EXPORTER_OTLP_PROTOCOL";
262-
constexpr char kDefault[] = "http/protobuf";
263-
264-
std::string value;
265-
bool exists;
266-
267-
exists = sdk_common::GetStringEnvironmentVariable(kSignalEnv, value);
268-
if (exists)
269-
{
270-
return value;
271-
}
272-
273-
exists = sdk_common::GetStringEnvironmentVariable(kGenericEnv, value);
274-
if (exists)
275-
{
276-
return value;
277-
}
278-
279-
return kDefault;
280-
}
281-
282210
bool GetOtlpDefaultGrpcTracesIsInsecure()
283211
{
284212
std::string endpoint = GetOtlpDefaultGrpcTracesEndpoint();

exporters/otlp/src/otlp_http.cc

Lines changed: 0 additions & 26 deletions
This file was deleted.

exporters/otlp/src/otlp_http_exporter_options.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace otlp
1717
OtlpHttpExporterOptions::OtlpHttpExporterOptions()
1818
{
1919
url = GetOtlpDefaultHttpTracesEndpoint();
20-
content_type = GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpTracesProtocol());
20+
content_type = HttpRequestContentType::kJson;
2121
json_bytes_mapping = JsonBytesMappingKind::kHexId;
2222
use_json_name = false;
2323
console_debug = false;

exporters/otlp/src/otlp_http_log_record_exporter_options.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace otlp
1717
OtlpHttpLogRecordExporterOptions::OtlpHttpLogRecordExporterOptions()
1818
{
1919
url = GetOtlpDefaultHttpLogsEndpoint();
20-
content_type = GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpLogsProtocol());
20+
content_type = HttpRequestContentType::kJson;
2121
json_bytes_mapping = JsonBytesMappingKind::kHexId;
2222
use_json_name = false;
2323
console_debug = false;

0 commit comments

Comments
 (0)