lib/datadog/tracing/contrib/faraday/middleware.rb in ddtrace-1.12.1 vs lib/datadog/tracing/contrib/faraday/middleware.rb in ddtrace-1.13.0
- old
+ new
@@ -38,20 +38,22 @@
def annotate!(span, env, options)
span.resource = resource_name(env)
span.service = service_name(env[:url].host, options)
span.span_type = Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND
+ if options[:peer_service]
+ span.set_tag(
+ Tracing::Metadata::Ext::TAG_PEER_SERVICE,
+ options[:peer_service]
+ )
+ end
+
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_REQUEST)
- if Contrib::SpanAttributeSchema.default_span_attribute_schema?
- # Tag as an external peer service
- span.set_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE, span.service)
- end
-
span.set_tag(Tracing::Metadata::Ext::TAG_PEER_HOSTNAME, env[:url].host)
# Set analytics sample rate
if Contrib::Analytics.enabled?(options[:analytics_enabled])
Contrib::Analytics.set_sample_rate(span, options[:analytics_sample_rate])
@@ -59,15 +61,24 @@
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_URL, env[:url].path)
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_METHOD, env[:method].to_s.upcase)
span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_HOST, env[:url].host)
span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_PORT, env[:url].port)
+ span.set_tags(
+ Datadog.configuration.tracing.header_tags.request_tags(env[:request_headers])
+ )
+
+ Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
end
def handle_response(span, env, options)
span.set_error(["Error #{env[:status]}", env[:body]]) if options.fetch(:error_handler).call(env)
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, env[:status])
+
+ span.set_tags(
+ Datadog.configuration.tracing.header_tags.response_tags(env[:response_headers])
+ )
end
def propagate!(trace, span, env)
Tracing::Propagation::HTTP.inject!(trace, env[:request_headers])
end