diff --git a/pkgs/by-name/op/opentelemetry-cpp/0001-Disable-tests-requiring-network-access.patch b/pkgs/by-name/op/opentelemetry-cpp/0001-Disable-tests-requiring-network-access.patch index 067fb7f23878..5d8b4be59b5d 100644 --- a/pkgs/by-name/op/opentelemetry-cpp/0001-Disable-tests-requiring-network-access.patch +++ b/pkgs/by-name/op/opentelemetry-cpp/0001-Disable-tests-requiring-network-access.patch @@ -1,8 +1,8 @@ diff --git a/ext/test/http/curl_http_test.cc b/ext/test/http/curl_http_test.cc -index 7c66d98b..62d40f49 100644 +index e8299202..19dbd7b1 100644 --- a/ext/test/http/curl_http_test.cc +++ b/ext/test/http/curl_http_test.cc -@@ -229,7 +229,7 @@ TEST_F(BasicCurlHttpTests, HttpResponse) +@@ -270,7 +270,7 @@ TEST_F(BasicCurlHttpTests, HttpResponse) ASSERT_EQ(count, 4); } @@ -11,8 +11,8 @@ index 7c66d98b..62d40f49 100644 { received_requests_.clear(); auto session_manager = http_client::HttpClientFactory::Create(); -@@ -246,7 +246,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequest) - ASSERT_TRUE(handler->got_response_); +@@ -287,7 +287,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequest) + ASSERT_TRUE(handler->got_response_.load(std::memory_order_acquire)); } -TEST_F(BasicCurlHttpTests, SendPostRequest) @@ -20,25 +20,25 @@ index 7c66d98b..62d40f49 100644 { received_requests_.clear(); auto session_manager = http_client::HttpClientFactory::Create(); -@@ -325,7 +325,7 @@ TEST_F(BasicCurlHttpTests, CurlHttpOperations) - delete handler; +@@ -313,7 +313,7 @@ TEST_F(BasicCurlHttpTests, SendPostRequest) + session_manager->FinishAllSessions(); } +-TEST_F(BasicCurlHttpTests, RequestTimeout) ++TEST_F(BasicCurlHttpTests, DISABLED_RequestTimeout) + { + received_requests_.clear(); + auto session_manager = http_client::HttpClientFactory::Create(); +@@ -442,7 +442,7 @@ TEST_F(BasicCurlHttpTests, ExponentialBackoffRetry) + } + #endif // ENABLE_OTLP_RETRY_PREVIEW + -TEST_F(BasicCurlHttpTests, SendGetRequestSync) +TEST_F(BasicCurlHttpTests, DISABLED_SendGetRequestSync) { received_requests_.clear(); curl::HttpClientSync http_client; -@@ -336,7 +336,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestSync) - EXPECT_EQ(result.GetSessionState(), http_client::SessionState::Response); - } - --TEST_F(BasicCurlHttpTests, SendGetRequestSyncTimeout) -+TEST_F(BasicCurlHttpTests, DISABLED_SendGetRequestSyncTimeout) - { - received_requests_.clear(); - curl::HttpClientSync http_client; -@@ -350,7 +350,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestSyncTimeout) +@@ -467,7 +467,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestSyncTimeout) result.GetSessionState() == http_client::SessionState::SendFailed); } @@ -47,7 +47,7 @@ index 7c66d98b..62d40f49 100644 { received_requests_.clear(); curl::HttpClientSync http_client; -@@ -378,7 +378,7 @@ TEST_F(BasicCurlHttpTests, GetBaseUri) +@@ -495,7 +495,7 @@ TEST_F(BasicCurlHttpTests, GetBaseUri) "http://127.0.0.1:31339/"); } @@ -56,7 +56,7 @@ index 7c66d98b..62d40f49 100644 { curl::HttpClient http_client; -@@ -452,7 +452,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestAsyncTimeout) +@@ -570,7 +570,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestAsyncTimeout) } } @@ -65,7 +65,7 @@ index 7c66d98b..62d40f49 100644 { curl::HttpClient http_client; -@@ -491,7 +491,7 @@ TEST_F(BasicCurlHttpTests, SendPostRequestAsync) +@@ -609,7 +609,7 @@ TEST_F(BasicCurlHttpTests, SendPostRequestAsync) } } @@ -74,6 +74,12 @@ index 7c66d98b..62d40f49 100644 { curl::HttpClient http_client; --- -2.40.1 - +@@ -647,7 +647,7 @@ TEST_F(BasicCurlHttpTests, FinishInAsyncCallback) + } + } + +-TEST_F(BasicCurlHttpTests, ElegantQuitQuick) ++TEST_F(BasicCurlHttpTests, DISABLED_ElegantQuitQuick) + { + auto http_client = http_client::HttpClientFactory::Create(); + std::static_pointer_cast(http_client)->MaybeSpawnBackgroundThread(); diff --git a/pkgs/by-name/op/opentelemetry-cpp/package.nix b/pkgs/by-name/op/opentelemetry-cpp/package.nix index 000208061581..5e0db1298d1f 100644 --- a/pkgs/by-name/op/opentelemetry-cpp/package.nix +++ b/pkgs/by-name/op/opentelemetry-cpp/package.nix @@ -10,25 +10,30 @@ prometheus-cpp, nlohmann_json, nix-update-script, + cxxStandard ? null, + enableHttp ? false, + enableGrpc ? false, + enablePrometheus ? false, + enableElasticSearch ? false, + enableZipkin ? false, }: - let opentelemetry-proto = fetchFromGitHub { owner = "open-telemetry"; repo = "opentelemetry-proto"; - rev = "v1.3.2"; - hash = "sha256-bkVqPSVhyMHrmFvlI9DTAloZzDozj3sefIEwfW7OVrI="; + rev = "v1.5.0"; + hash = "sha256-PkG0npG3nKQwq6SxWdIliIQ/wrYAOG9qVb26IeVkBfc="; }; in stdenv.mkDerivation (finalAttrs: { pname = "opentelemetry-cpp"; - version = "1.16.1"; + version = "1.20.0"; src = fetchFromGitHub { owner = "open-telemetry"; repo = "opentelemetry-cpp"; rev = "v${finalAttrs.version}"; - hash = "sha256-31zwIZ4oehhfn+oCyg8VQTurPOmdgp72plH1Pf/9UKQ="; + hash = "sha256-ibLuHIg01wGYPhLRz+LVYA34WaWzlUlNtg7DSONLe9g="; }; patches = [ @@ -40,12 +45,18 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ curl - grpc nlohmann_json - prometheus-cpp - protobuf ]; + propagatedBuildInputs = + lib.optionals (enableGrpc || enableHttp) [ protobuf ] + ++ lib.optionals enableGrpc [ + grpc + ] + ++ lib.optionals enablePrometheus [ + prometheus-cpp + ]; + doCheck = true; checkInputs = [ @@ -54,17 +65,21 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; - cmakeFlags = [ - "-DBUILD_SHARED_LIBS=ON" - "-DWITH_OTLP_HTTP=ON" - "-DWITH_OTLP_GRPC=ON" - "-DWITH_ABSEIL=ON" - "-DWITH_PROMETHEUS=ON" - "-DWITH_ELASTICSEARCH=ON" - "-DWITH_ZIPKIN=ON" - "-DWITH_BENCHMARK=OFF" - "-DOTELCPP_PROTO_PATH=${opentelemetry-proto}" - ]; + cmakeFlags = + [ + (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) + (lib.cmakeBool "WITH_BENCHMARK" false) + (lib.cmakeBool "WITH_OTLP_HTTP" enableHttp) + (lib.cmakeBool "WITH_OTLP_GRPC" enableGrpc) + (lib.cmakeBool "WITH_PROMETHEUS" enablePrometheus) + (lib.cmakeBool "WITH_ELASTICSEARCH" enableElasticSearch) + (lib.cmakeBool "WITH_ZIPKIN" enableZipkin) + (lib.cmakeFeature "OTELCPP_PROTO_PATH" "${opentelemetry-proto}") + ] + ++ lib.optionals (cxxStandard != null) [ + (lib.cmakeFeature "CMAKE_CXX_STANDARD" cxxStandard) + (lib.cmakeFeature "WITH_STL" "CXX${cxxStandard}") + ]; outputs = [ "out" @@ -72,8 +87,8 @@ stdenv.mkDerivation (finalAttrs: { ]; postInstall = '' - substituteInPlace $out/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake \ - --replace-fail "\''${_IMPORT_PREFIX}/include" "$dev/include" + substituteInPlace $out/lib/cmake/opentelemetry-cpp/opentelemetry-cpp*-target.cmake \ + --replace-quiet "\''${_IMPORT_PREFIX}/include" "$dev/include" ''; passthru.updateScript = nix-update-script { };