Compare commits

..

No commits in common. "f98b8d9c108c0f21b3998da9ad79b2f966dc1288" and "c2416788dbb5c07d6eabbadc00f222c2394c5eaa" have entirely different histories.

7 changed files with 20 additions and 86 deletions

View File

@ -1,10 +0,0 @@
# 0.24.6
## dependencies
`http-2-next` last supported version for the 0.x series is the last version before v1. This shoul ensure that older versions of `httpx` won't be affected by any of the recent breaking changes.
## Bugfixes
* `grpc`: setup of rpc calls from camel-cased symbols has been fixed. As an improvement, the GRPC-enabled session will now support both snake-cased, as well as camel-cased calls.
* `datadog` adapter has now been patched to support the most recent breaking changes of `ddtrace` configuration DSL (`env_to_bool` is no longer supported).

View File

@ -32,5 +32,5 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"] gem.require_paths = ["lib"]
gem.add_runtime_dependency "http-2-next", "< 1.0.0" gem.add_runtime_dependency "http-2-next", ">= 0.4.1"
end end

View File

@ -188,39 +188,19 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
option :distributed_tracing, default: true option :distributed_tracing, default: true
option :split_by_domain, default: false option :split_by_domain, default: false
if DDTrace::VERSION::STRING >= "1.13.0" option :enabled do |o|
option :enabled do |o| o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
o.type :bool o.lazy
o.env "DD_TRACE_HTTPX_ENABLED" end
o.default true
end
option :analytics_enabled do |o| option :analytics_enabled do |o|
o.type :bool o.default { env_to_bool(%w[DD_TRACE_HTTPX_ANALYTICS_ENABLED DD_HTTPX_ANALYTICS_ENABLED], false) }
o.env "DD_TRACE_HTTPX_ANALYTICS_ENABLED" o.lazy
o.default false end
end
option :analytics_sample_rate do |o| option :analytics_sample_rate do |o|
o.type :float o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
o.env "DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE" o.lazy
o.default 1.0
end
else
option :enabled do |o|
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
o.lazy
end
option :analytics_enabled do |o|
o.default { env_to_bool(%w[DD_TRACE_HTTPX_ANALYTICS_ENABLED DD_HTTPX_ANALYTICS_ENABLED], false) }
o.lazy
end
option :analytics_sample_rate do |o|
o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
o.lazy
end
end end
if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema) if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
@ -244,19 +224,7 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
option :distributed_tracing, default: true option :distributed_tracing, default: true
if DDTrace::VERSION::STRING >= "1.15.0" option :error_handler, default: DEFAULT_ERROR_HANDLER
option :error_handler do |o|
o.type :proc
o.default_proc(&DEFAULT_ERROR_HANDLER)
end
elsif DDTrace::VERSION::STRING >= "1.13.0"
option :error_handler do |o|
o.type :proc
o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
end
else
option :error_handler, default: DEFAULT_ERROR_HANDLER
end
end end
end end

View File

@ -141,29 +141,17 @@ module HTTPX
deadline: @options.grpc_deadline, deadline: @options.grpc_deadline,
}.merge(opts) }.merge(opts)
local_rpc_name = rpc_name.underscore
session_class = Class.new(self.class) do session_class = Class.new(self.class) do
# define rpc method with ruby style name
class_eval(<<-OUT, __FILE__, __LINE__ + 1) class_eval(<<-OUT, __FILE__, __LINE__ + 1)
def #{local_rpc_name}(input, **opts) # def grpc_action(input, **opts) def #{rpc_name}(input, **opts) # def grpc_action(input, **opts)
rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts) rpc_execute("#{rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
end # end end # end
OUT OUT
# define rpc method with original name
unless local_rpc_name == rpc_name
class_eval(<<-OUT, __FILE__, __LINE__ + 1)
def #{rpc_name}(input, **opts) # def grpcAction(input, **opts)
rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
end # end
OUT
end
end end
session_class.new(@options.merge( session_class.new(@options.merge(
grpc_rpcs: @options.grpc_rpcs.merge( grpc_rpcs: @options.grpc_rpcs.merge(
local_rpc_name => [rpc_name, input, output, rpc_opts] rpc_name.underscore => [rpc_name, input, output, rpc_opts]
).freeze ).freeze
)) ))
end end

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
module HTTPX module HTTPX
VERSION = "0.24.7" VERSION = "0.24.6"
end end

View File

@ -102,7 +102,7 @@ class HTTPXAwsSigv4Test < Minitest::Test
private private
def sigv4_session(**options) def sigv4_session(**options)
HTTPX.plugin(:aws_sigv4).aws_sigv4_authentication(service: "s3", region: "us-east-1", username: "akid", HTTPX.plugin(:aws_sigv4).aws_sigv4_authentication(**{ service: "s3", region: "us-east-1", username: "akid",
password: "secret", **options) password: "secret" }.merge(options))
end end
end end

View File

@ -5,18 +5,6 @@ module Requests
module GRPC module GRPC
include GRPCHelpers include GRPCHelpers
def test_plugin_grpc_stub_rpc_defines_snake_case_methods
server_port = run_rpc(TestService)
grpc = grpc_plugin
# build service
stub = grpc.build_stub("localhost:#{server_port}")
sv = stub.rpc(:aCamelCaseRpc, EchoMsg, EchoMsg, marshal_method: :marshal, unmarshal_method: :unmarshal)
assert sv.respond_to? :a_camel_case_rpc
assert sv.respond_to? :aCamelCaseRpc
end
def test_plugin_grpc_unary_plain_bytestreams def test_plugin_grpc_unary_plain_bytestreams
no_marshal = proc { |x| x } no_marshal = proc { |x| x }