class Datadog::Tracing::Transport::HTTP::Traces::API::Endpoint

Endpoint for submitting trace data

def call(env, &block)

def call(env, &block)
  # Add trace count header
  env.headers[HEADER_TRACE_COUNT] = env.request.parcel.trace_count.to_s
  # Encode body & type
  env.headers[HEADER_CONTENT_TYPE] = encoder.content_type
  env.body = env.request.parcel.data
  # Query for response
  http_response = super(env, &block)
  # Process the response
  response_options = { trace_count: env.request.parcel.trace_count }.tap do |options|
    # Parse service rates, if configured to do so.
    if service_rates? && !http_response.payload.to_s.empty?
      body = JSON.parse(http_response.payload)
      options[:service_rates] = body[SERVICE_RATE_KEY] if body.is_a?(Hash) && body.key?(SERVICE_RATE_KEY)
    end
  end
  # Build and return a trace response
  Traces::Response.new(http_response, response_options)
end

def initialize(path, encoder, options = {})

def initialize(path, encoder, options = {})
  super(:post, path)
  @encoder = encoder
  @service_rates = options.fetch(:service_rates, false)
end

def service_rates?

def service_rates?
  @service_rates == true
end