module Datadog::Tracing::Contrib::Httprb::Instrumentation::InstanceMethods

def annotate_span_with_response!(span, response, request_options)

def annotate_span_with_response!(span, response, request_options)
  return unless response && response.code
  span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, response.code)
  if request_options[:error_status_codes].include? response.code.to_i
    # https://github.com/DataDog/dd-trace-rb/issues/1116
    # parsing the response body message will alter downstream application behavior
    span.set_error(["Error #{response.code}", 'Error'])
  end
  span.set_tags(
    Datadog.configuration.tracing.header_tags.response_tags(response.headers)
  )
end