mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-07-21 00:00:40 -04:00
Compare commits
7 Commits
c2416788db
...
f98b8d9c10
Author | SHA1 | Date | |
---|---|---|---|
|
f98b8d9c10 | ||
|
1e9fa3e38c | ||
|
efcadf7d2b | ||
|
71dee0c6e7 | ||
|
d0182eabab | ||
|
7fc8d70c53 | ||
|
e942b34a1f |
10
doc/release_notes/0_24_7.md
Normal file
10
doc/release_notes/0_24_7.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# 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).
|
@ -32,5 +32,5 @@ Gem::Specification.new do |gem|
|
|||||||
|
|
||||||
gem.require_paths = ["lib"]
|
gem.require_paths = ["lib"]
|
||||||
|
|
||||||
gem.add_runtime_dependency "http-2-next", ">= 0.4.1"
|
gem.add_runtime_dependency "http-2-next", "< 1.0.0"
|
||||||
end
|
end
|
||||||
|
@ -188,6 +188,25 @@ 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|
|
||||||
|
o.type :bool
|
||||||
|
o.env "DD_TRACE_HTTPX_ENABLED"
|
||||||
|
o.default true
|
||||||
|
end
|
||||||
|
|
||||||
|
option :analytics_enabled do |o|
|
||||||
|
o.type :bool
|
||||||
|
o.env "DD_TRACE_HTTPX_ANALYTICS_ENABLED"
|
||||||
|
o.default false
|
||||||
|
end
|
||||||
|
|
||||||
|
option :analytics_sample_rate do |o|
|
||||||
|
o.type :float
|
||||||
|
o.env "DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE"
|
||||||
|
o.default 1.0
|
||||||
|
end
|
||||||
|
else
|
||||||
option :enabled do |o|
|
option :enabled do |o|
|
||||||
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
|
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
|
||||||
o.lazy
|
o.lazy
|
||||||
@ -202,6 +221,7 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
|
|||||||
o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
|
o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
|
||||||
o.lazy
|
o.lazy
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
|
if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
|
||||||
option :service_name do |o|
|
option :service_name do |o|
|
||||||
@ -224,9 +244,21 @@ 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 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
|
option :error_handler, default: DEFAULT_ERROR_HANDLER
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Patcher enables patching of 'httpx' with datadog components.
|
# Patcher enables patching of 'httpx' with datadog components.
|
||||||
#
|
#
|
||||||
|
@ -141,17 +141,29 @@ 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 #{rpc_name}(input, **opts) # def grpc_action(input, **opts)
|
def #{local_rpc_name}(input, **opts) # def grpc_action(input, **opts)
|
||||||
rpc_execute("#{rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
|
rpc_execute("#{local_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(
|
||||||
rpc_name.underscore => [rpc_name, input, output, rpc_opts]
|
local_rpc_name => [rpc_name, input, output, rpc_opts]
|
||||||
).freeze
|
).freeze
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module HTTPX
|
module HTTPX
|
||||||
VERSION = "0.24.6"
|
VERSION = "0.24.7"
|
||||||
end
|
end
|
||||||
|
@ -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" }.merge(options))
|
password: "secret", **options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,6 +5,18 @@ 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 }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user