lib/httpx/adapters/datadog.rb in httpx-0.24.0 vs lib/httpx/adapters/datadog.rb in httpx-0.24.1
- old
+ new
@@ -158,11 +158,11 @@
end
end
module RequestMethods
def __datadog_enable_trace!
- return super if @__datadog_enable_trace
+ return if @__datadog_enable_trace
RequestTracer.new(self).call
@__datadog_enable_trace = true
end
end
@@ -200,9 +200,30 @@
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
+
+ if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
+ option :service_name do |o|
+ o.default do
+ TRACING_MODULE::Contrib::SpanAttributeSchema.fetch_service_name(
+ "DD_TRACE_HTTPX_SERVICE_NAME",
+ "httpx"
+ )
+ end
+ o.lazy
+ end
+ else
+ option :service_name do |o|
+ o.default do
+ ENV.fetch("DD_TRACE_HTTPX_SERVICE_NAME", "httpx")
+ end
+ o.lazy
+ end
+ end
+
+ option :distributed_tracing, default: true
option :error_handler, default: DEFAULT_ERROR_HANDLER
end
end