diff --git a/CHANGELOG.md b/CHANGELOG.md index e8379620fb..4e6f37e89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ Breaking changes: * CMake options `WITH_OTLP_HTTP_SSL_PREVIEW` and `WITH_OTLP_HTTP_SSL_TLS_PREVIEW` are removed. Building opentelemetry-cpp without SSL support is no longer possible. +* [#2480] Change default OTLP Http Exporter content type from kJson to kBInary + See The default is http/protobuf, which means binary, [HERE](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specify-protocol ## [1.13.0] 2023-12-06 diff --git a/exporters/otlp/src/otlp_http_exporter_options.cc b/exporters/otlp/src/otlp_http_exporter_options.cc index 3b8c6ad5b8..e605d0b260 100644 --- a/exporters/otlp/src/otlp_http_exporter_options.cc +++ b/exporters/otlp/src/otlp_http_exporter_options.cc @@ -17,7 +17,7 @@ namespace otlp OtlpHttpExporterOptions::OtlpHttpExporterOptions() { url = GetOtlpDefaultHttpTracesEndpoint(); - content_type = HttpRequestContentType::kJson; + content_type = HttpRequestContentType::kBinary; json_bytes_mapping = JsonBytesMappingKind::kHexId; use_json_name = false; console_debug = false; diff --git a/exporters/otlp/src/otlp_http_log_record_exporter_options.cc b/exporters/otlp/src/otlp_http_log_record_exporter_options.cc index 2f58bce768..5042701377 100644 --- a/exporters/otlp/src/otlp_http_log_record_exporter_options.cc +++ b/exporters/otlp/src/otlp_http_log_record_exporter_options.cc @@ -17,7 +17,7 @@ namespace otlp OtlpHttpLogRecordExporterOptions::OtlpHttpLogRecordExporterOptions() { url = GetOtlpDefaultHttpLogsEndpoint(); - content_type = HttpRequestContentType::kJson; + content_type = HttpRequestContentType::kBinary; json_bytes_mapping = JsonBytesMappingKind::kHexId; use_json_name = false; console_debug = false; diff --git a/exporters/otlp/src/otlp_http_metric_exporter_options.cc b/exporters/otlp/src/otlp_http_metric_exporter_options.cc index ffcd502bd4..27dcfd7ccb 100644 --- a/exporters/otlp/src/otlp_http_metric_exporter_options.cc +++ b/exporters/otlp/src/otlp_http_metric_exporter_options.cc @@ -17,7 +17,7 @@ namespace otlp OtlpHttpMetricExporterOptions::OtlpHttpMetricExporterOptions() { url = GetOtlpDefaultMetricsEndpoint(); - content_type = HttpRequestContentType::kJson; + content_type = HttpRequestContentType::kBinary; json_bytes_mapping = JsonBytesMappingKind::kHexId; use_json_name = false; console_debug = false; diff --git a/exporters/otlp/test/otlp_http_exporter_test.cc b/exporters/otlp/test/otlp_http_exporter_test.cc index 63f919c6cc..dd35122715 100644 --- a/exporters/otlp/test/otlp_http_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_exporter_test.cc @@ -197,7 +197,7 @@ class OtlpHttpExporterTestPeer : public ::testing::Test void ExportJsonIntegrationTestAsync() { auto mock_otlp_client = - OtlpHttpExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson, true); + OtlpHttpExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary, true); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; auto exporter = GetExporter(std::unique_ptr{mock_otlp_http_client}); diff --git a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc index 611bebb541..3239dc58ba 100644 --- a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc @@ -107,7 +107,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test void ExportJsonIntegrationTest() { auto mock_otlp_client = - OtlpHttpLogRecordExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson); + OtlpHttpLogRecordExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; auto exporter = GetExporter(std::unique_ptr{mock_otlp_http_client}); @@ -221,7 +221,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test void ExportJsonIntegrationTestAsync() { auto mock_otlp_client = OtlpHttpLogRecordExporterTestPeer::GetMockOtlpHttpClient( - HttpRequestContentType::kJson, true); + HttpRequestContentType::kBinary, true); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; auto exporter = GetExporter(std::unique_ptr{mock_otlp_http_client}); diff --git a/exporters/otlp/test/otlp_http_metric_exporter_test.cc b/exporters/otlp/test/otlp_http_metric_exporter_test.cc index def56682d3..0279cc40e0 100644 --- a/exporters/otlp/test/otlp_http_metric_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_metric_exporter_test.cc @@ -117,7 +117,7 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test ) { auto mock_otlp_client = - OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson + OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary #ifdef ENABLE_ASYNC_EXPORT , async_mode @@ -293,7 +293,7 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test ) { auto mock_otlp_client = - OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson + OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary #ifdef ENABLE_ASYNC_EXPORT , async_mode @@ -483,7 +483,7 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test ) { auto mock_otlp_client = - OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson + OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary #ifdef ENABLE_ASYNC_EXPORT , async_mode