Sha256: 4d0e2da4924e49eeb1d375b4db436081da8606a18f01cde8e657b9bf1a9b2774

Contents?: true

Size: 1.42 KB

Versions: 24

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

require_relative '../../../core/transport/request'
require_relative '../../../core/transport/parcel'

module Datadog
  module Core
    module Remote
      module Transport
        module Config
          # Data transfer object for encoded traces
          class EncodedParcel
            include Datadog::Core::Transport::Parcel

            def count
              data.length
            end
          end

          # Config request
          class Request < Datadog::Core::Transport::Request
          end

          # Config response
          module Response
            attr_reader :roots, :targets, :target_files, :client_configs

            def empty?
              @empty
            end
          end

          # Config transport
          class Transport
            attr_reader :client, :apis, :default_api, :current_api_id

            def initialize(apis, default_api)
              @apis = apis

              @client = HTTP::Client.new(current_api)
            end

            ##### there is only one transport! it's negotiation!
            def send_config(payload)
              json = JSON.dump(payload)
              parcel = EncodedParcel.new(json)
              request = Request.new(parcel)

              @client.send_config_payload(request)
            end

            def current_api
              @apis[HTTP::API::V7]
            end
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
datadog-2.7.0 lib/datadog/core/remote/transport/config.rb
datadog-2.6.0 lib/datadog/core/remote/transport/config.rb
datadog-2.5.0 lib/datadog/core/remote/transport/config.rb
datadog-2.4.0 lib/datadog/core/remote/transport/config.rb
datadog-2.3.0 lib/datadog/core/remote/transport/config.rb
datadog-2.2.0 lib/datadog/core/remote/transport/config.rb
ddtrace-1.23.3 lib/datadog/core/remote/transport/config.rb
ddtrace-1.23.2 lib/datadog/core/remote/transport/config.rb
datadog-2.1.0 lib/datadog/core/remote/transport/config.rb
datadog-2.0.0 lib/datadog/core/remote/transport/config.rb
ddtrace-1.23.1 lib/datadog/core/remote/transport/config.rb
datadog-2.0.0.beta2 lib/datadog/core/remote/transport/config.rb
ddtrace-1.22.0 lib/datadog/core/remote/transport/config.rb
datadog-2.0.0.beta1 lib/datadog/core/remote/transport/config.rb
ddtrace-1.21.1 lib/datadog/core/remote/transport/config.rb
ddtrace-1.21.0 lib/datadog/core/remote/transport/config.rb
ddtrace-1.20.0 lib/datadog/core/remote/transport/config.rb
ddtrace-1.19.0 lib/datadog/core/remote/transport/config.rb
ddtrace-1.18.0 lib/datadog/core/remote/transport/config.rb
ddtrace-1.17.0 lib/datadog/core/remote/transport/config.rb