opentelemetry-cpp: version update and extra configurability (#390485)

authored by Peder Bergebakken Sundt and committed by GitHub 19b85461 533ea474

+62 -41
+26 -20
pkgs/by-name/op/opentelemetry-cpp/0001-Disable-tests-requiring-network-access.patch
··· 1 diff --git a/ext/test/http/curl_http_test.cc b/ext/test/http/curl_http_test.cc 2 - index 7c66d98b..62d40f49 100644 3 --- a/ext/test/http/curl_http_test.cc 4 +++ b/ext/test/http/curl_http_test.cc 5 - @@ -229,7 +229,7 @@ TEST_F(BasicCurlHttpTests, HttpResponse) 6 ASSERT_EQ(count, 4); 7 } 8 ··· 11 { 12 received_requests_.clear(); 13 auto session_manager = http_client::HttpClientFactory::Create(); 14 - @@ -246,7 +246,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequest) 15 - ASSERT_TRUE(handler->got_response_); 16 } 17 18 -TEST_F(BasicCurlHttpTests, SendPostRequest) ··· 20 { 21 received_requests_.clear(); 22 auto session_manager = http_client::HttpClientFactory::Create(); 23 - @@ -325,7 +325,7 @@ TEST_F(BasicCurlHttpTests, CurlHttpOperations) 24 - delete handler; 25 } 26 27 - -TEST_F(BasicCurlHttpTests, SendGetRequestSync) 28 - +TEST_F(BasicCurlHttpTests, DISABLED_SendGetRequestSync) 29 { 30 received_requests_.clear(); 31 - curl::HttpClientSync http_client; 32 - @@ -336,7 +336,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestSync) 33 - EXPECT_EQ(result.GetSessionState(), http_client::SessionState::Response); 34 } 35 36 - -TEST_F(BasicCurlHttpTests, SendGetRequestSyncTimeout) 37 - +TEST_F(BasicCurlHttpTests, DISABLED_SendGetRequestSyncTimeout) 38 { 39 received_requests_.clear(); 40 curl::HttpClientSync http_client; 41 - @@ -350,7 +350,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestSyncTimeout) 42 result.GetSessionState() == http_client::SessionState::SendFailed); 43 } 44 ··· 47 { 48 received_requests_.clear(); 49 curl::HttpClientSync http_client; 50 - @@ -378,7 +378,7 @@ TEST_F(BasicCurlHttpTests, GetBaseUri) 51 "http://127.0.0.1:31339/"); 52 } 53 ··· 56 { 57 curl::HttpClient http_client; 58 59 - @@ -452,7 +452,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestAsyncTimeout) 60 } 61 } 62 ··· 65 { 66 curl::HttpClient http_client; 67 68 - @@ -491,7 +491,7 @@ TEST_F(BasicCurlHttpTests, SendPostRequestAsync) 69 } 70 } 71 ··· 74 { 75 curl::HttpClient http_client; 76 77 - -- 78 - 2.40.1 79 -
··· 1 diff --git a/ext/test/http/curl_http_test.cc b/ext/test/http/curl_http_test.cc 2 + index e8299202..19dbd7b1 100644 3 --- a/ext/test/http/curl_http_test.cc 4 +++ b/ext/test/http/curl_http_test.cc 5 + @@ -270,7 +270,7 @@ TEST_F(BasicCurlHttpTests, HttpResponse) 6 ASSERT_EQ(count, 4); 7 } 8 ··· 11 { 12 received_requests_.clear(); 13 auto session_manager = http_client::HttpClientFactory::Create(); 14 + @@ -287,7 +287,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequest) 15 + ASSERT_TRUE(handler->got_response_.load(std::memory_order_acquire)); 16 } 17 18 -TEST_F(BasicCurlHttpTests, SendPostRequest) ··· 20 { 21 received_requests_.clear(); 22 auto session_manager = http_client::HttpClientFactory::Create(); 23 + @@ -313,7 +313,7 @@ TEST_F(BasicCurlHttpTests, SendPostRequest) 24 + session_manager->FinishAllSessions(); 25 } 26 27 + -TEST_F(BasicCurlHttpTests, RequestTimeout) 28 + +TEST_F(BasicCurlHttpTests, DISABLED_RequestTimeout) 29 { 30 received_requests_.clear(); 31 + auto session_manager = http_client::HttpClientFactory::Create(); 32 + @@ -442,7 +442,7 @@ TEST_F(BasicCurlHttpTests, ExponentialBackoffRetry) 33 } 34 + #endif // ENABLE_OTLP_RETRY_PREVIEW 35 36 + -TEST_F(BasicCurlHttpTests, SendGetRequestSync) 37 + +TEST_F(BasicCurlHttpTests, DISABLED_SendGetRequestSync) 38 { 39 received_requests_.clear(); 40 curl::HttpClientSync http_client; 41 + @@ -467,7 +467,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestSyncTimeout) 42 result.GetSessionState() == http_client::SessionState::SendFailed); 43 } 44 ··· 47 { 48 received_requests_.clear(); 49 curl::HttpClientSync http_client; 50 + @@ -495,7 +495,7 @@ TEST_F(BasicCurlHttpTests, GetBaseUri) 51 "http://127.0.0.1:31339/"); 52 } 53 ··· 56 { 57 curl::HttpClient http_client; 58 59 + @@ -570,7 +570,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestAsyncTimeout) 60 } 61 } 62 ··· 65 { 66 curl::HttpClient http_client; 67 68 + @@ -609,7 +609,7 @@ TEST_F(BasicCurlHttpTests, SendPostRequestAsync) 69 } 70 } 71 ··· 74 { 75 curl::HttpClient http_client; 76 77 + @@ -647,7 +647,7 @@ TEST_F(BasicCurlHttpTests, FinishInAsyncCallback) 78 + } 79 + } 80 + 81 + -TEST_F(BasicCurlHttpTests, ElegantQuitQuick) 82 + +TEST_F(BasicCurlHttpTests, DISABLED_ElegantQuitQuick) 83 + { 84 + auto http_client = http_client::HttpClientFactory::Create(); 85 + std::static_pointer_cast<curl::HttpClient>(http_client)->MaybeSpawnBackgroundThread();
+36 -21
pkgs/by-name/op/opentelemetry-cpp/package.nix
··· 10 prometheus-cpp, 11 nlohmann_json, 12 nix-update-script, 13 }: 14 - 15 let 16 opentelemetry-proto = fetchFromGitHub { 17 owner = "open-telemetry"; 18 repo = "opentelemetry-proto"; 19 - rev = "v1.3.2"; 20 - hash = "sha256-bkVqPSVhyMHrmFvlI9DTAloZzDozj3sefIEwfW7OVrI="; 21 }; 22 in 23 stdenv.mkDerivation (finalAttrs: { 24 pname = "opentelemetry-cpp"; 25 - version = "1.16.1"; 26 27 src = fetchFromGitHub { 28 owner = "open-telemetry"; 29 repo = "opentelemetry-cpp"; 30 rev = "v${finalAttrs.version}"; 31 - hash = "sha256-31zwIZ4oehhfn+oCyg8VQTurPOmdgp72plH1Pf/9UKQ="; 32 }; 33 34 patches = [ ··· 40 41 buildInputs = [ 42 curl 43 - grpc 44 nlohmann_json 45 - prometheus-cpp 46 - protobuf 47 ]; 48 49 doCheck = true; 50 51 checkInputs = [ ··· 54 55 strictDeps = true; 56 57 - cmakeFlags = [ 58 - "-DBUILD_SHARED_LIBS=ON" 59 - "-DWITH_OTLP_HTTP=ON" 60 - "-DWITH_OTLP_GRPC=ON" 61 - "-DWITH_ABSEIL=ON" 62 - "-DWITH_PROMETHEUS=ON" 63 - "-DWITH_ELASTICSEARCH=ON" 64 - "-DWITH_ZIPKIN=ON" 65 - "-DWITH_BENCHMARK=OFF" 66 - "-DOTELCPP_PROTO_PATH=${opentelemetry-proto}" 67 - ]; 68 69 outputs = [ 70 "out" ··· 72 ]; 73 74 postInstall = '' 75 - substituteInPlace $out/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake \ 76 - --replace-fail "\''${_IMPORT_PREFIX}/include" "$dev/include" 77 ''; 78 79 passthru.updateScript = nix-update-script { };
··· 10 prometheus-cpp, 11 nlohmann_json, 12 nix-update-script, 13 + cxxStandard ? null, 14 + enableHttp ? false, 15 + enableGrpc ? false, 16 + enablePrometheus ? false, 17 + enableElasticSearch ? false, 18 + enableZipkin ? false, 19 }: 20 let 21 opentelemetry-proto = fetchFromGitHub { 22 owner = "open-telemetry"; 23 repo = "opentelemetry-proto"; 24 + rev = "v1.5.0"; 25 + hash = "sha256-PkG0npG3nKQwq6SxWdIliIQ/wrYAOG9qVb26IeVkBfc="; 26 }; 27 in 28 stdenv.mkDerivation (finalAttrs: { 29 pname = "opentelemetry-cpp"; 30 + version = "1.20.0"; 31 32 src = fetchFromGitHub { 33 owner = "open-telemetry"; 34 repo = "opentelemetry-cpp"; 35 rev = "v${finalAttrs.version}"; 36 + hash = "sha256-ibLuHIg01wGYPhLRz+LVYA34WaWzlUlNtg7DSONLe9g="; 37 }; 38 39 patches = [ ··· 45 46 buildInputs = [ 47 curl 48 nlohmann_json 49 ]; 50 51 + propagatedBuildInputs = 52 + lib.optionals (enableGrpc || enableHttp) [ protobuf ] 53 + ++ lib.optionals enableGrpc [ 54 + grpc 55 + ] 56 + ++ lib.optionals enablePrometheus [ 57 + prometheus-cpp 58 + ]; 59 + 60 doCheck = true; 61 62 checkInputs = [ ··· 65 66 strictDeps = true; 67 68 + cmakeFlags = 69 + [ 70 + (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) 71 + (lib.cmakeBool "WITH_BENCHMARK" false) 72 + (lib.cmakeBool "WITH_OTLP_HTTP" enableHttp) 73 + (lib.cmakeBool "WITH_OTLP_GRPC" enableGrpc) 74 + (lib.cmakeBool "WITH_PROMETHEUS" enablePrometheus) 75 + (lib.cmakeBool "WITH_ELASTICSEARCH" enableElasticSearch) 76 + (lib.cmakeBool "WITH_ZIPKIN" enableZipkin) 77 + (lib.cmakeFeature "OTELCPP_PROTO_PATH" "${opentelemetry-proto}") 78 + ] 79 + ++ lib.optionals (cxxStandard != null) [ 80 + (lib.cmakeFeature "CMAKE_CXX_STANDARD" cxxStandard) 81 + (lib.cmakeFeature "WITH_STL" "CXX${cxxStandard}") 82 + ]; 83 84 outputs = [ 85 "out" ··· 87 ]; 88 89 postInstall = '' 90 + substituteInPlace $out/lib/cmake/opentelemetry-cpp/opentelemetry-cpp*-target.cmake \ 91 + --replace-quiet "\''${_IMPORT_PREFIX}/include" "$dev/include" 92 ''; 93 94 passthru.updateScript = nix-update-script { };