-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ekump/decouple core transport (#3150)
* Move ddtrace/transport to datadog/tracing/transport as it is tracing specific. * Update Datadog::Transport namespace to Datadog::Tracing::Transport * Move datadog/core/transport to datadog/remote/transport * Update Datadog::Core::Transport to Datadog::Core::Remote::Transport * Move commonly used files between Remote and Transport to Datadog::Core::Transport * Create Datadog::Core::Transport::Ext that Datadog::Transport::Ext (ddtrace) references. The file in ddtrace should be replaced in 2.0. * cleanup rubocop TODOs and Steepfile ignores for refactor
- Loading branch information
Showing
212 changed files
with
4,693 additions
and
4,447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# 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 |
Oops, something went wrong.