Skip to content

Commit

Permalink
Merge pull request #3008 from DataDog/start-rc-on-demand
Browse files Browse the repository at this point in the history
Start RC on demand
  • Loading branch information
lloeki authored Jul 28, 2023
2 parents b9e5738 + c5c06c0 commit 386d499
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
3 changes: 0 additions & 3 deletions lib/datadog/core/configuration/components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ def startup!(settings)
else
@logger.debug('Profiling is disabled')
end

# Start remote configuration worker
@remote.start if @remote
end

# Shuts down all the components in use.
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/tracing/contrib/rack/middlewares.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def call(env)

return @app.call(env) if previous_request_span

Datadog::Core::Remote.active_remote.barrier(:once) unless Datadog::Core::Remote.active_remote.nil?

# Extract distributed tracing context before creating any spans,
# so that all spans will be added to the distributed trace.
if configuration[:distributed_tracing]
Expand Down
9 changes: 0 additions & 9 deletions spec/datadog/core/configuration/components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1098,15 +1098,6 @@
let(:info_response) { { endpoints: ['/v0.7/config'] }.to_json }
end

context 'enabled' do
before { allow(settings.remote).to receive(:enabled).and_return(true) }

it 'starts the remote manager' do
expect(components.remote).to receive(:start)
startup!
end
end

context 'disabled' do
before { allow(settings.remote).to receive(:enabled).and_return(false) }

Expand Down
6 changes: 6 additions & 0 deletions spec/datadog/tracing/contrib/suite/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def build(*dynamic_configurations)
let(:tracing_header_tags) { [{ 'header' => 'test-header', 'tag_name' => '' }] }

it 'overrides the local values' do
Datadog::Core::Remote.active_remote.barrier(:once)

expect(Datadog.configuration.tracing.sampling.default_rate).to be_nil
expect(Datadog.configuration.tracing.log_injection).to eq(true)
expect(Datadog.configuration.tracing.header_tags.to_s).to be_empty
Expand All @@ -116,6 +118,8 @@ def build(*dynamic_configurations)
let(:empty_data) { { 'lib_config' => {} } }

it 'restore the local values' do
Datadog::Core::Remote.active_remote.barrier(:once)

update_config

wait_for { Datadog.configuration.tracing.sampling.default_rate }.to eq(0.7)
Expand Down Expand Up @@ -205,6 +209,7 @@ def build(*dynamic_configurations)

it 'changes default sampling rate and sampling decision' do
# Before
Datadog::Core::Remote.active_remote.barrier(:once)
tracer.trace('test') {}

expect(trace.rule_sample_rate).to be_nil
Expand Down Expand Up @@ -241,6 +246,7 @@ def build(*dynamic_configurations)

it 'changes disables log injection' do
# Before
Datadog::Core::Remote.active_remote.barrier(:once)
expect(Datadog.configuration.tracing.log_injection).to eq(true)

tracer.trace('test') { logger.error('test-log') }
Expand Down

0 comments on commit 386d499

Please sign in to comment.