mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-07-21 00:00:40 -04:00
Compare commits
No commits in common. "834873638d01169c4987c0611cd978ed35683400" and "a3ac1993e95cccbcb61ead3fecdd047317729d79" have entirely different histories.
834873638d
...
a3ac1993e9
@ -127,21 +127,18 @@ module Datadog::Tracing
|
|||||||
option :split_by_domain, default: false
|
option :split_by_domain, default: false
|
||||||
|
|
||||||
option :enabled do |o|
|
option :enabled do |o|
|
||||||
o.type :bool
|
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
|
||||||
o.env "DD_TRACE_HTTPX_ENABLED"
|
o.lazy
|
||||||
o.default true
|
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
if defined?(Datadog::Tracing::Contrib::SpanAttributeSchema)
|
if defined?(Datadog::Tracing::Contrib::SpanAttributeSchema)
|
||||||
@ -165,17 +162,7 @@ module Datadog::Tracing
|
|||||||
|
|
||||||
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
|
|
||||||
else
|
|
||||||
option :error_handler do |o|
|
|
||||||
o.type :proc
|
|
||||||
o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -205,7 +192,7 @@ module Datadog::Tracing
|
|||||||
class Integration
|
class Integration
|
||||||
include Contrib::Integration
|
include Contrib::Integration
|
||||||
|
|
||||||
MINIMUM_VERSION = Gem::Version.new("1.0.1")
|
MINIMUM_VERSION = Gem::Version.new("0.10.2")
|
||||||
|
|
||||||
register_as :httpx
|
register_as :httpx
|
||||||
|
|
||||||
|
@ -149,29 +149,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
|
||||||
|
@ -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
|
||||||
|
@ -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 }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user