Sha256: 2e5953f2edbfaa0f958315f1e9429d9e6fbd66de89606616395d002f1d6d783c

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 Bytes

Contents

# typed: true

require 'ddtrace/transport/http/client'
require 'datadog/profiling/transport/client'

module Datadog
  module Profiling
    module Transport
      module HTTP
        # Routes, encodes, and sends tracer data to the trace agent via HTTP.
        class Client < Datadog::Transport::HTTP::Client
          include Transport::Client

          def send_profiling_flush(flush)
            # Build a request
            request = Profiling::Transport::Request.new(flush)
            send_payload(request).tap do |response|
              if response.ok?
                Datadog.logger.debug('Successfully reported profiling data')
              else
                Datadog.logger.debug { "Failed to report profiling data -- #{response.inspect}" }
              end
            end
          end

          def send_payload(request)
            send_request(request) do |api, env|
              api.send_profiling_flush(env)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-1.1.0 lib/datadog/profiling/transport/http/client.rb
ddtrace-1.0.0 lib/datadog/profiling/transport/http/client.rb
ddtrace-1.0.0.beta2 lib/datadog/profiling/transport/http/client.rb