Skip to content

Commit

Permalink
Allow enabling legacy profiling transport codepath via setting/env va…
Browse files Browse the repository at this point in the history
…riable

If needed, this will allow customers to toggle the legacy profiling
transport codepath by setting the
`DD_PROFILING_LEGACY_TRANSPORT_ENABLED` environment varaible to `true`
or by using

```ruby
Datadog.configure do |c|
  c.profiling.advanced.legacy_transport_enabled = true
end
```

As described in the previous commit, this is temporary and only being
added just in case we need to debug issues with the newly-added
`HttpTransport` (or to confirm that an issue did not come from it).
  • Loading branch information
ivoanjo committed May 31, 2022
1 parent 3b7126d commit 09d83b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/datadog/core/configuration/components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,18 @@ def build_profiler_collectors(settings, old_recorder, trace_identifiers_helper)

def build_profiler_transport(settings, agent_settings)
settings.profiling.exporter.transport ||
if settings.profiling.advanced.legacy_transport_enabled
require 'datadog/profiling/transport/http'

Datadog.logger.warn('Using legacy profiling transport. Do not use unless instructed to by support.')

Profiling::Transport::HTTP.default(
agent_settings: agent_settings,
site: settings.site,
api_key: settings.api_key,
profiling_upload_timeout_seconds: settings.profiling.upload.timeout_seconds
)
end ||
Profiling::HttpTransport.new(
agent_settings: agent_settings,
site: settings.site,
Expand Down
7 changes: 7 additions & 0 deletions lib/datadog/core/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ def initialize(*_)
# Disable gathering of names and versions of gems in use by the service, used to power grouping and
# categorization of stack traces.
option :code_provenance_enabled, default: true

# Use legacy transport code instead of HttpTransport. Temporarily added for migration to HttpTransport,
# and will be removed soon. Do not use unless instructed to by support.
option :legacy_transport_enabled do |o|
o.default { env_to_bool('DD_PROFILING_LEGACY_TRANSPORT_ENABLED', false) }
o.lazy
end
end

# @public_api
Expand Down

0 comments on commit 09d83b3

Please sign in to comment.