From d95029599908a4c9201e4a921cdfbea8af531146 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 22 Jul 2026 12:35:43 +1200 Subject: [PATCH 1/5] Make traces and metrics optional --- async-http.gemspec | 2 -- gems.rb | 2 ++ lib/traces/provider/async/http/client.rb | 1 + lib/traces/provider/async/http/protocol/http1/client.rb | 1 + lib/traces/provider/async/http/protocol/http2/client.rb | 1 + lib/traces/provider/async/http/server.rb | 1 + releases.md | 4 ++++ 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/async-http.gemspec b/async-http.gemspec index db7b8429..41caf1d9 100644 --- a/async-http.gemspec +++ b/async-http.gemspec @@ -28,10 +28,8 @@ Gem::Specification.new do |spec| spec.add_dependency "async-pool", "~> 0.11" spec.add_dependency "io-endpoint", "~> 0.14" spec.add_dependency "io-stream", "~> 0.6" - spec.add_dependency "metrics", "~> 0.12" spec.add_dependency "protocol-http", "~> 0.62" spec.add_dependency "protocol-http1", "~> 0.39" spec.add_dependency "protocol-http2", "~> 0.26" spec.add_dependency "protocol-url", "~> 0.2" - spec.add_dependency "traces", "~> 0.10" end diff --git a/gems.rb b/gems.rb index 6fd63eee..3cec837f 100644 --- a/gems.rb +++ b/gems.rb @@ -37,6 +37,8 @@ gem "rubocop" gem "rubocop-md" gem "rubocop-socketry" + gem "metrics", "~> 0.12" + gem "traces", "~> 0.10" gem "sus-fixtures-async" gem "sus-fixtures-async-http", "~> 0.8" diff --git a/lib/traces/provider/async/http/client.rb b/lib/traces/provider/async/http/client.rb index 3a7c586d..6168d4ab 100644 --- a/lib/traces/provider/async/http/client.rb +++ b/lib/traces/provider/async/http/client.rb @@ -4,6 +4,7 @@ # Copyright, 2025, by Samuel Williams. require_relative "../../../../async/http/client" +require "traces/provider" Traces::Provider(Async::HTTP::Client) do def call(request) diff --git a/lib/traces/provider/async/http/protocol/http1/client.rb b/lib/traces/provider/async/http/protocol/http1/client.rb index 27f71b3b..da6c8709 100644 --- a/lib/traces/provider/async/http/protocol/http1/client.rb +++ b/lib/traces/provider/async/http/protocol/http1/client.rb @@ -4,6 +4,7 @@ # Copyright, 2025, by Samuel Williams. require_relative "../../../../../../async/http/protocol/http1/client" +require "traces/provider" Traces::Provider(Async::HTTP::Protocol::HTTP1::Client) do def write_request(...) diff --git a/lib/traces/provider/async/http/protocol/http2/client.rb b/lib/traces/provider/async/http/protocol/http2/client.rb index 68fa0d58..960cd685 100644 --- a/lib/traces/provider/async/http/protocol/http2/client.rb +++ b/lib/traces/provider/async/http/protocol/http2/client.rb @@ -4,6 +4,7 @@ # Copyright, 2025, by Samuel Williams. require_relative "../../../../../../async/http/protocol/http2/client" +require "traces/provider" Traces::Provider(Async::HTTP::Protocol::HTTP2::Client) do def write_request(...) diff --git a/lib/traces/provider/async/http/server.rb b/lib/traces/provider/async/http/server.rb index 0aa4119b..2d8db103 100644 --- a/lib/traces/provider/async/http/server.rb +++ b/lib/traces/provider/async/http/server.rb @@ -4,6 +4,7 @@ # Copyright, 2025, by Samuel Williams. require_relative "../../../../async/http/server" +require "traces/provider" Traces::Provider(Async::HTTP::Server) do def call(request) diff --git a/releases.md b/releases.md index fd61c232..70f7a446 100644 --- a/releases.md +++ b/releases.md @@ -1,5 +1,9 @@ # Releases +## Unreleased + + - Made `metrics` and `traces` optional runtime dependencies. Applications that use the providers should depend on the corresponding gem and require the provider explicitly. + ## v0.95.1 - Fix handling of reset stream causing complete connection failure. From 5215baecf42198dd71abcf49a7f08cf19b685057 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 22 Jul 2026 12:51:35 +1200 Subject: [PATCH 2/5] Cover traced client protocol requests --- test/async/http/client.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/async/http/client.rb b/test/async/http/client.rb index 5091ed26..c467707a 100644 --- a/test/async/http/client.rb +++ b/test/async/http/client.rb @@ -23,6 +23,12 @@ expect(response).to be(:success?) end + it "client can get resource with protocol" do + response = client.get("/", protocol: "test") + response.read + expect(response).to be(:success?) + end + with "client" do with "#as_json" do it "generates a JSON representation" do From 0026b4da0bc16f8c2c8958f165e16b4d78637b78 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 22 Jul 2026 13:59:39 +1200 Subject: [PATCH 3/5] Cover HTTP2 protocol pseudo-header --- test/async/http/protocol/http2.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/async/http/protocol/http2.rb b/test/async/http/protocol/http2.rb index b33cbd8a..c244eb43 100644 --- a/test/async/http/protocol/http2.rb +++ b/test/async/http/protocol/http2.rb @@ -79,6 +79,20 @@ def make_client(endpoint, **options) end end + with "protocol pseudo-header" do + let(:app) do + Protocol::HTTP::Middleware.for do |request| + Protocol::HTTP::Response[200, {}, ["Protocol: #{request.protocol.inspect}"]] + end + end + + it "sends and receives protocol" do + response = client.get("/", protocol: "test") + + expect(response.read).to be == "Protocol: \"test\"" + end + end + with "stopping requests" do let(:notification) {Async::Notification.new} From 7d16f68eb9f159b2d9fc1b69694e131e50082388 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 22 Jul 2026 14:12:17 +1200 Subject: [PATCH 4/5] Revert "Cover HTTP2 protocol pseudo-header" This reverts commit 0026b4da0bc16f8c2c8958f165e16b4d78637b78. --- test/async/http/protocol/http2.rb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/test/async/http/protocol/http2.rb b/test/async/http/protocol/http2.rb index c244eb43..b33cbd8a 100644 --- a/test/async/http/protocol/http2.rb +++ b/test/async/http/protocol/http2.rb @@ -79,20 +79,6 @@ def make_client(endpoint, **options) end end - with "protocol pseudo-header" do - let(:app) do - Protocol::HTTP::Middleware.for do |request| - Protocol::HTTP::Response[200, {}, ["Protocol: #{request.protocol.inspect}"]] - end - end - - it "sends and receives protocol" do - response = client.get("/", protocol: "test") - - expect(response.read).to be == "Protocol: \"test\"" - end - end - with "stopping requests" do let(:notification) {Async::Notification.new} From 20ae0b321ac69bd92e7a67a86a6723b1c657fce4 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 22 Jul 2026 14:12:18 +1200 Subject: [PATCH 5/5] Revert "Cover traced client protocol requests" This reverts commit 5215baecf42198dd71abcf49a7f08cf19b685057. --- test/async/http/client.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/async/http/client.rb b/test/async/http/client.rb index c467707a..5091ed26 100644 --- a/test/async/http/client.rb +++ b/test/async/http/client.rb @@ -23,12 +23,6 @@ expect(response).to be(:success?) end - it "client can get resource with protocol" do - response = client.get("/", protocol: "test") - response.read - expect(response).to be(:success?) - end - with "client" do with "#as_json" do it "generates a JSON representation" do