Skip to content

Commit

Permalink
ekump/add config gaps from transport proc (#3350)
Browse files Browse the repository at this point in the history
Remove support for configuring agent transport via a custom proc. Add ability to set SSL, timeout, and UDS path for agent transport programatically. 
---------

Co-authored-by: Austin Lai <76412946+alai97@users.noreply.github.com>
Co-authored-by: ekump <ekump@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 12, 2024
1 parent 83a4ec0 commit ab5e35e
Show file tree
Hide file tree
Showing 357 changed files with 637 additions and 1,817 deletions.
3 changes: 1 addition & 2 deletions benchmarks/profiler_http_transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ def initialize

@transport = Datadog::Profiling::HttpTransport.new(
agent_settings: Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings.new(
adapter: Datadog::Core::Transport::Ext::HTTP::ADAPTER,
adapter: Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER,
uds_path: nil,
ssl: false,
hostname: '127.0.0.1',
port: @port,
deprecated_for_removal_transport_configuration_proc: nil,
timeout_seconds: nil,
),
site: nil,
Expand Down
62 changes: 21 additions & 41 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ If your Datadog Agent is listening at any of these locations, no further configu
If your Agent runs on a different host or container than your application, or you would like to send traces via a different protocol, you will need to configure your application accordingly.

- [How to send trace data via HTTP over TCP to Agent](#changing-default-agent-hostname-and-port)
- [How to send trace data via Unix Domain Socket (UDS) to Agent](#using-the-unix-domain-socket-uds-adapter)
- [How to send trace data via Unix Domain Socket (UDS) to Agent](#unix-domain-socket-uds)

### Final steps for installation

Expand Down Expand Up @@ -2470,62 +2470,42 @@ end

See [Additional Configuration](#additional-configuration) for more details.

#### Using the Net::HTTP adapter
#### Agent connection methods
The agent supports communication via TCP or Unix Domain Socket (UDS). The tracer will automatically detect the agent's
connection method based on the configuration provided.

The `Net` adapter submits traces using `Net::HTTP` over TCP. It is the default transport adapter.

```ruby
Datadog.configure do |c|
c.tracing.transport_options = proc { |t|
# Hostname, port, and additional options. :timeout is in seconds.
t.adapter :net_http, '127.0.0.1', 8126, timeout: 30
}
end
```

#### Using the Unix Domain Socket (UDS) adapter

The `UnixSocket` adapter submits traces using `Net::HTTP` over Unix socket.
##### TCP
The tracer will connect to the agent via TCP if the `host` and `port` are set, or if `HTTP/HTTPS` is specified as the
protocol in `DD_TRACE_AGENT_URL`. TCP is the default connection method.

##### Unix Domain Socket (UDS)
To use, first configure your trace Agent to listen by Unix socket, then configure the tracer with:

```ruby
Datadog.configure do |c|
c.tracing.transport_options = proc { |t|
# Provide local path to trace Agent Unix socket
t.adapter :unix, '/tmp/ddagent/trace.sock'
}
# Provide local path to trace Agent Unix socket
c.agent.uds_path = '/tmp/ddagent/trace.sock'
end
```

#### Using the transport test adapter
You can also define the UDS path using the `DD_TRACE_AGENT_URL` environment variable by setting the protocol to `unix`:

The `Test` adapter is a no-op transport that can optionally buffer requests. For use in test suites or other non-production environments.

```ruby
Datadog.configure do |c|
c.tracing.transport_options = proc { |t|
# Set transport to no-op mode. Does not retain traces.
t.adapter :test

# Alternatively, you can provide a buffer to examine trace output.
# The buffer must respond to '<<'.
t.adapter :test, []
}
end
```bash
DD_TRACE_AGENT_URL=unix:///tmp/ddagent/trace.sock
```

#### Using a custom transport adapter
Note: You cannot mix UDS and TCP configurations. If you set `c.agent.uds_path`, you must not set `c.agent.host`
or `c.agent.port`.

#### Transporting in Test Mode

Custom adapters can be configured with:
When test mode is enabled, the tracer uses a `Test` adapter for no-op transport that can optionally buffer requests in
test suites or other non-production environments. It is configured by setting `c.tracing.test_mode.enabled` to true.
This mode only works for tracing.

```ruby
Datadog.configure do |c|
c.tracing.transport_options = proc { |t|
# Initialize and pass an instance of the adapter
custom_adapter = CustomAdapter.new
t.adapter custom_adapter
}
c.tracing.test_mode.enabled = true
end
```

Expand Down
5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_activesupport.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_aws.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_contrib_old.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_core_old.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_elasticsearch_7.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_elasticsearch_8.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_hanami_1.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_http.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_opensearch_2.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_opensearch_3.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_opentracing.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_rack_1.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_rack_2.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions gemfiles/jruby_9.2_rack_3.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ab5e35e

Please sign in to comment.