lib/hypertrace/instrumentation/http_patch.rb in hypertrace-agent-0.1.0 vs lib/hypertrace/instrumentation/http_patch.rb in hypertrace-agent-0.1.1
- old
+ new
@@ -4,11 +4,11 @@
request_method = req.verb.to_s.upcase
headers = req.headers.to_h
attrs = Hypertrace::Instrumentation::DataCapture.headers_to_attribute_keys(headers,
Hypertrace::Instrumentation::DataCapture::TYPE_REQUEST)
- content_type = headers['Content-Type']
+ content_type = headers.find{|k, v| k.downcase == "content-type"}&.last
if Hypertrace::Instrumentation::DataCapture.can_capture?(content_type, Hypertrace::Instrumentation::DataCapture::TYPE_REQUEST)
body_cap = Hypertrace::Instrumentation::DataCapture.capturable_body(req.body.source)
attrs['http.request.body'] = body_cap if body_cap
end
@@ -27,10 +27,10 @@
response_headers = response.headers.to_h
Hypertrace::Instrumentation::DataCapture.headers_to_attribute_keys(response_headers,
Hypertrace::Instrumentation::DataCapture::TYPE_RESPONSE) do |k, v|
span.set_attribute(k, v)
end
- content_type = response_headers['Content-Type']
+ content_type = response_headers.find{|k, v| k.downcase == "content-type"}&.last
if Hypertrace::Instrumentation::DataCapture.can_capture?(content_type, Hypertrace::Instrumentation::DataCapture::TYPE_RESPONSE)
body_cap = Hypertrace::Instrumentation::DataCapture.capturable_body(response.body.to_s)
span.set_attribute('http.response.body', body_cap) if body_cap
end
annotate_span_with_response!(span, response)
\ No newline at end of file