Compare commits

..

No commits in common. "834873638d01169c4987c0611cd978ed35683400" and "a3ac1993e95cccbcb61ead3fecdd047317729d79" have entirely different histories.

4 changed files with 14 additions and 51 deletions

View File

@ -127,21 +127,18 @@ module Datadog::Tracing
option :split_by_domain, default: false
option :enabled do |o|
o.type :bool
o.env "DD_TRACE_HTTPX_ENABLED"
o.default true
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
o.lazy
end
option :analytics_enabled do |o|
o.type :bool
o.env "DD_TRACE_HTTPX_ANALYTICS_ENABLED"
o.default false
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.type :float
o.env "DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE"
o.default 1.0
o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
o.lazy
end
if defined?(Datadog::Tracing::Contrib::SpanAttributeSchema)
@ -165,17 +162,7 @@ module Datadog::Tracing
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
else
option :error_handler do |o|
o.type :proc
o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
end
end
option :error_handler, default: DEFAULT_ERROR_HANDLER
end
end
@ -205,7 +192,7 @@ module Datadog::Tracing
class Integration
include Contrib::Integration
MINIMUM_VERSION = Gem::Version.new("1.0.1")
MINIMUM_VERSION = Gem::Version.new("0.10.2")
register_as :httpx

View File

@ -149,29 +149,17 @@ module HTTPX
deadline: @options.grpc_deadline,
}.merge(opts)
local_rpc_name = rpc_name.underscore
session_class = Class.new(self.class) do
# define rpc method with ruby style name
class_eval(<<-OUT, __FILE__, __LINE__ + 1)
def #{local_rpc_name}(input, **opts) # def grpc_action(input, **opts)
rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
end # end
def #{rpc_name}(input, **opts) # def grpc_action(input, **opts)
rpc_execute("#{rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
end # end
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
session_class.new(@options.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
))
end

View File

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

View File

@ -5,18 +5,6 @@ module Requests
module GRPC
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
no_marshal = proc { |x| x }