Module: Datadog::Tracing::Transport::IO::Traces::Client

Included in:
Client
Defined in:
lib/datadog/tracing/transport/io/traces.rb

Overview

Extensions for HTTP client

Instance Method Summary collapse

Instance Method Details

#send_traces(traces) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/datadog/tracing/transport/io/traces.rb', line 26

def send_traces(traces)
  # Build a request
  req = Transport::Traces::Request.new(Parcel.new(traces))

  [send_request(req) do |out, request|
    # Encode trace data
    data = encode_data(encoder, request)

    # Write to IO
    result = if block_given?
               yield(out, data)
             else
               write_data(out, data)
             end

    # Generate response
    Traces::Response.new(result)
  end]
end