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