From ec2be1b0c1f4d442ea835dad8c27aeca96ad133d Mon Sep 17 00:00:00 2001 From: duncanpo Date: Thu, 14 Nov 2024 13:24:51 -0500 Subject: [PATCH] Update to otel-cpp 1.17.0 --- CMakeLists.txt | 5 ++--- sdk/common/src/resource.cpp | 1 + test/tlogs_sdk.m | 3 ++- test/tmetrics_sdk.m | 3 ++- test/ttrace_sdk.m | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67a72ac..09766a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ if(NOT DEFINED OTEL_CPP_INSTALLED_DIR) include(ExternalProject) set(OTEL_CPP_PROJECT_NAME opentelemetry-cpp) set(OTEL_CPP_GIT_REPOSITORY "https://github.com/open-telemetry/opentelemetry-cpp.git") - set(OTEL_CPP_GIT_TAG "baecbb9") + set(OTEL_CPP_GIT_TAG "fa0a520") set(OTEL_CPP_CXX_STANDARD 14) @@ -209,7 +209,6 @@ if(NOT DEFINED OTEL_CPP_INSTALLED_DIR) set(patch_command "") endif() - # WITH_DEPRECATED_SDK_FACTORY flag is only needed for versions 1.16.0 and 1.16.1, and will be removed in 1.17.0 ExternalProject_Add( ${OTEL_CPP_PROJECT_NAME} GIT_REPOSITORY ${OTEL_CPP_GIT_REPOSITORY} @@ -217,7 +216,7 @@ if(NOT DEFINED OTEL_CPP_INSTALLED_DIR) PREFIX ${OTEL_CPP_PREFIX} UPDATE_DISCONNECTED 1 PATCH_COMMAND ${patch_command} - CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DWITH_OTLP_HTTP=${WITH_OTLP_HTTP} -DWITH_OTLP_GRPC=${WITH_OTLP_GRPC} -DWITH_OTLP_FILE=${WITH_OTLP_FILE} -DBUILD_TESTING=OFF -DWITH_BENCHMARK=OFF -DWITH_DEPRECATED_SDK_FACTORY=OFF -DOPENTELEMETRY_INSTALL=ON -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_CXX_STANDARD=${OTEL_CPP_CXX_STANDARD} -DVCPKG_INSTALLED_DIR=${VCPKG_INSTALLED_DIR} ${TRIPLET_DEFINITIONS} + CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DWITH_OTLP_HTTP=${WITH_OTLP_HTTP} -DWITH_OTLP_GRPC=${WITH_OTLP_GRPC} -DWITH_OTLP_FILE=${WITH_OTLP_FILE} -DBUILD_TESTING=OFF -DWITH_BENCHMARK=OFF -DOPENTELEMETRY_INSTALL=ON -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_CXX_STANDARD=${OTEL_CPP_CXX_STANDARD} -DVCPKG_INSTALLED_DIR=${VCPKG_INSTALLED_DIR} ${TRIPLET_DEFINITIONS} BUILD_BYPRODUCTS ${OTEL_CPP_LIBRARIES} INSTALL_DIR ${OTEL_CPP_PREFIX} INSTALL_COMMAND ${CMAKE_COMMAND} --install . --prefix ${OTEL_CPP_PREFIX} --config $ diff --git a/sdk/common/src/resource.cpp b/sdk/common/src/resource.cpp index e2f760f..9cd5db3 100644 --- a/sdk/common/src/resource.cpp +++ b/sdk/common/src/resource.cpp @@ -6,6 +6,7 @@ #include "opentelemetry-matlab/common/attribute.h" #include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/string_view.h" namespace common = opentelemetry::common; diff --git a/test/tlogs_sdk.m b/test/tlogs_sdk.m index 4248bb4..1a5a5a9 100644 --- a/test/tlogs_sdk.m +++ b/test/tlogs_sdk.m @@ -68,7 +68,8 @@ function testOtlpFileExporter(testCase) % perform test comparisons forceFlush(lp, testCase.ForceFlushTimeout); clear("lg", "lp"); - results = jsondecode(fileread(alias)); + resultstxt = readlines(alias); + results = jsondecode(resultstxt(1)); % check logger name, log body and severity verifyEqual(testCase, string(results.resourceLogs.scopeLogs.scope.name), loggername); diff --git a/test/tmetrics_sdk.m b/test/tmetrics_sdk.m index 2ee2533..a3791e2 100644 --- a/test/tmetrics_sdk.m +++ b/test/tmetrics_sdk.m @@ -97,7 +97,8 @@ function testOtlpFileExporter(testCase) % fetch result forceFlush(p); clear("ct", "mt", "p"); - results = jsondecode(fileread(alias)); + resultstxt = readlines(alias); + results = jsondecode(resultstxt(1)); % verify meter and counter names verifyEqual(testCase, string(results.resourceMetrics.scopeMetrics.metrics.name), countername); diff --git a/test/ttrace_sdk.m b/test/ttrace_sdk.m index 48abd03..ff8671b 100644 --- a/test/ttrace_sdk.m +++ b/test/ttrace_sdk.m @@ -189,7 +189,8 @@ function testOtlpFileExporter(testCase) clear("sp", "tr", "tp"); % perform test comparisons - results = jsondecode(fileread(alias)); + resultstxt = readlines(alias); + results = jsondecode(resultstxt(1)); % check span and tracer names verifyEqual(testCase, string(results.resourceSpans.scopeSpans.spans.name), spanname);