-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
201 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module Datadog | ||
module Core | ||
# Encoding module that encodes data for the AgentTransport | ||
module Encoding | ||
# Encoder interface that provides the logic to encode traces and service | ||
# @abstract | ||
module Encoder | ||
def content_type: () -> untyped | ||
|
||
# Concatenates a list of elements previously encoded by +#encode+. | ||
def join: (untyped encoded_elements) -> untyped | ||
|
||
# Serializes a single trace into a String suitable for network transmission. | ||
def encode: (untyped _) -> untyped | ||
end | ||
|
||
# Encoder for the JSON format | ||
module JSONEncoder | ||
extend Encoder | ||
|
||
CONTENT_TYPE: "application/json" | ||
|
||
def self?.content_type: () -> untyped | ||
|
||
def self?.encode: (untyped obj) -> untyped | ||
|
||
def self?.join: (untyped encoded_data) -> ::String | ||
end | ||
|
||
# Encoder for the Msgpack format | ||
module MsgpackEncoder | ||
extend Encoder | ||
|
||
CONTENT_TYPE: "application/msgpack" | ||
|
||
def self?.content_type: () -> untyped | ||
|
||
def self?.encode: (untyped obj) -> untyped | ||
|
||
def self?.join: (untyped encoded_data) -> untyped | ||
end | ||
end | ||
end | ||
end |
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,47 @@ | ||
module Datadog | ||
module Core | ||
module Transport | ||
module Config | ||
# Data transfer object for encoded traces | ||
class EncodedParcel | ||
include Datadog::Transport::Parcel | ||
|
||
def count: () -> untyped | ||
end | ||
|
||
# Config request | ||
class Request < Datadog::Transport::Request | ||
end | ||
|
||
# Config response | ||
module Response | ||
attr_reader roots: untyped | ||
|
||
attr_reader targets: untyped | ||
|
||
attr_reader target_files: untyped | ||
|
||
attr_reader client_configs: untyped | ||
end | ||
|
||
# Config transport | ||
class Transport | ||
attr_reader client: untyped | ||
|
||
attr_reader apis: untyped | ||
|
||
attr_reader default_api: untyped | ||
|
||
attr_reader current_api_id: untyped | ||
|
||
def initialize: (untyped apis, untyped default_api) -> void | ||
|
||
# ### there is only one transport! it's negotiation! | ||
def send_config: (untyped payload) -> untyped | ||
|
||
def current_api: () -> untyped | ||
end | ||
end | ||
end | ||
end | ||
end |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ module Datadog | |
module HTTP | ||
module API | ||
ROOT: "root" | ||
V7: "v0.7" | ||
|
||
def self?.defaults: () -> untyped | ||
end | ||
|
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,89 @@ | ||
module Datadog | ||
module Core | ||
module Transport | ||
module HTTP | ||
# HTTP transport behavior for remote configuration | ||
module Config | ||
# Response from HTTP transport for remote configuration | ||
class Response | ||
include Datadog::Transport::HTTP::Response | ||
|
||
include Core::Transport::Config::Response | ||
|
||
def initialize: (untyped http_response, ?::Hash[untyped, untyped] options) -> void | ||
|
||
# When an expected key is missing | ||
class KeyError < StandardError | ||
def initialize: (untyped key) -> void | ||
end | ||
|
||
# When an expected value type is incorrect | ||
class TypeError < StandardError | ||
def initialize: (untyped `type`, untyped value) -> void | ||
end | ||
|
||
# When value decoding fails | ||
class DecodeError < StandardError | ||
def initialize: (untyped key, untyped value) -> void | ||
end | ||
|
||
# When value parsing fails | ||
class ParseError < StandardError | ||
def initialize: (untyped key, untyped value) -> void | ||
end | ||
end | ||
|
||
# Extensions for HTTP client | ||
module Client : HTTP::Client | ||
def send_config_payload: (untyped request) -> untyped | ||
end | ||
|
||
module API | ||
# Extensions for HTTP API Spec | ||
module Spec | ||
attr_reader config: untyped | ||
|
||
def config=: (untyped endpoint) -> untyped | ||
|
||
def send_config: (untyped env) ?{ () -> untyped } -> untyped | ||
|
||
# Raised when traces sent but no traces endpoint is defined | ||
class NoConfigEndpointDefinedError < StandardError | ||
attr_reader spec: untyped | ||
|
||
def initialize: (untyped spec) -> void | ||
|
||
def message: () -> "No config endpoint is defined for API specification!" | ||
end | ||
end | ||
|
||
# Extensions for HTTP API Instance | ||
module Instance : HTTP::API::Instance | ||
def send_config: (untyped env) -> untyped | ||
|
||
# Raised when traces sent to API that does not support traces | ||
class ConfigNotSupportedError < StandardError | ||
attr_reader spec: untyped | ||
|
||
def initialize: (untyped spec) -> void | ||
|
||
def message: () -> "Config not supported for this API!" | ||
end | ||
end | ||
|
||
# Endpoint for remote configuration | ||
class Endpoint < Datadog::Transport::HTTP::API::Endpoint | ||
HEADER_CONTENT_TYPE: "Content-Type" | ||
|
||
attr_reader encoder: untyped | ||
|
||
def initialize: (untyped path, untyped encoder) -> void | ||
|
||
def call: (untyped env) { (untyped) -> untyped } -> untyped | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |