Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3246736
Set the default of DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED to …
wantsui Mar 9, 2026
2508130
Remove the process tags from the remote client payload since it is no…
wantsui Mar 9, 2026
41c5ecc
Adjust DBM tests for the new default true setting
wantsui Mar 10, 2026
cb9f2dc
Adjust telemetry payload in tests due to the new default
wantsui Mar 10, 2026
b9b20f4
Fix another dbm test for the true default for process tag
wantsui Mar 10, 2026
3e5641d
Add the process tags payload to the remote config payload in tests si…
wantsui Mar 10, 2026
29b5fd7
Change supported-configurations.json from A to B
wantsui Mar 10, 2026
53a6b4a
Remove fallback for runtime metrics and update runtime metrics tests …
wantsui Mar 11, 2026
8e5464e
Simplify the settings_spec test per review
wantsui Mar 11, 2026
1831a5b
Bring back tags and process_tags when testing remote client_spec
wantsui Mar 11, 2026
427cd21
Adjust telemetry tests to start off with the assumption that process …
wantsui Mar 11, 2026
f8c3323
Update spec/datadog/core/workers/runtime_metrics_spec.rb
wantsui Mar 11, 2026
9a8649b
Refactor runtime_metrics_spec.rb to use receive syntax
wantsui Mar 12, 2026
ecd5cb5
Add an internal alias for propagate_process_tags_enabled that doesn't…
wantsui Mar 12, 2026
e854814
Add missing test
wantsui Mar 12, 2026
49efe37
Add back the experimental designation so it can be deleted later
wantsui Mar 13, 2026
8e27c3e
Merge branch 'master' into enable-process-tags
wantsui Mar 13, 2026
f362eb8
Remove the unneeded experimental_propagate_process_tags_enabled durin…
wantsui Mar 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/datadog/core/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1057,13 +1057,13 @@ def initialize(*_)
end
end

# Enable experimental process tags propagation such that payloads like spans contain the process tag.
# Enable process tags propagation such that payloads like spans contain the process tag.
#
# @default `DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED` environment variable, otherwise `false`
# @default `DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED` environment variable, otherwise `true`
# @return [Boolean]
option :experimental_propagate_process_tags_enabled do |o|
o.env 'DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED'
o.default false
o.default true
o.type :bool
end

Expand Down
3 changes: 1 addition & 2 deletions lib/datadog/core/runtime/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def initialize(telemetry:, **options)
# Initialize the collection of runtime-id
@runtime_id_enabled = options.fetch(:experimental_runtime_id_enabled, false)

# Initialized process tags support
@process_tags_enabled = options.fetch(:experimental_propagate_process_tags_enabled, false)
@process_tags_enabled = options.fetch(:experimental_propagate_process_tags_enabled)
end

# Associate service with runtime metrics
Expand Down
7 changes: 6 additions & 1 deletion lib/datadog/core/workers/runtime_metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ class RuntimeMetrics < Worker
:metrics

def initialize(telemetry:, **options)
@metrics = options.fetch(:metrics) { Core::Runtime::Metrics.new(logger: options[:logger], telemetry: telemetry) }
@metrics = options.fetch(:metrics) do
Core::Runtime::Metrics.new(
logger: options[:logger],
telemetry: telemetry
Comment on lines 25 to +27
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, my suggestion was to get rid of this whole default, not just passing the flag to Core::Runtime::Metrics.new 👀

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I'll keep refactoring (and now I'm glad I split this out into its own PR).

)
end

# Workers::Async::Thread settings
self.fork_policy = options.fetch(:fork_policy, Workers::Async::Thread::FORK_POLICY_STOP)
Expand Down
34 changes: 6 additions & 28 deletions spec/datadog/core/configuration/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1407,39 +1407,17 @@
describe '#experimental_propagate_process_tags_enabled' do
subject(:experimental_propagate_process_tags_enabled) { settings.experimental_propagate_process_tags_enabled }

context "when #{Datadog::Core::Environment::Ext::ENV_VERSION}" do
around do |example|
ClimateControl.modify('DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED' => environment) do
example.run
end
end

context 'by default' do
let(:environment) { nil }

it { is_expected.to be false }
end

context 'when set to true' do
let(:environment) { 'true' }

it { is_expected.to be true }
end

context 'when set to false' do
let(:environment) { 'false' }

it { is_expected.to be false }
end
end
it_behaves_like 'a binary setting with',
env_variable: 'DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED',
default: true
end

describe '#experimental_propagate_process_tags_enabled=' do
it 'updates the #experimental_propagate_process_tags_enabled setting' do
expect { settings.experimental_propagate_process_tags_enabled = true }
expect { settings.experimental_propagate_process_tags_enabled = false }
.to change { settings.experimental_propagate_process_tags_enabled }
.from(false)
.to(true)
.from(true)
.to(false)
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/datadog/core/crashtracking/tag_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@
end

context 'when process tags propagation is not enabled' do
before do
settings.experimental_propagate_process_tags_enabled = false
end

it 'does not include process tags in the crash tracking payload' do
expect(call.keys).to_not include('process_tags')
end
Expand Down
12 changes: 8 additions & 4 deletions spec/datadog/core/remote/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@
env: settings.env,
}

expect(client_payload[:client_tracer].tap { |h| h.delete(:tags) }).to eq(expected_client_tracer)
expect(client_payload[:client_tracer]).to include(expected_client_tracer)
end
end

Expand All @@ -657,7 +657,7 @@
app_version: settings.version,
}

expect(client_payload[:client_tracer].tap { |h| h.delete(:tags) }).to eq(expected_client_tracer)
expect(client_payload[:client_tracer]).to include(expected_client_tracer)
end
end

Expand All @@ -673,7 +673,7 @@
env: settings.env,
}

expect(client_payload[:client_tracer].tap { |h| h.delete(:tags) }).to eq(expected_client_tracer)
expect(client_payload[:client_tracer]).to include(expected_client_tracer)
end
end
end
Expand All @@ -699,7 +699,11 @@
end

context 'when process tags propagation is not enabled' do
# Currently false by default
before do
# Explicitly disable because the global default is now true.
allow(settings).to receive(:experimental_propagate_process_tags_enabled).and_return(false)
end

it 'does not have process tags in the payload' do
expect(client_payload[:client_tracer]).not_to have_key(:process_tags)
end
Expand Down
14 changes: 13 additions & 1 deletion spec/datadog/core/runtime/metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RSpec.describe Datadog::Core::Runtime::Metrics do
let(:logger) { logger_allowing_debug }
let(:telemetry) { double(Datadog::Core::Telemetry::Component) }
let(:options) { {} }
let(:options) { {experimental_propagate_process_tags_enabled: true} }
subject(:runtime_metrics) { described_class.new(logger: logger, telemetry: telemetry, **options) }

describe '::new' do
Expand Down Expand Up @@ -325,6 +325,18 @@
describe ':tags' do
subject(:default_tags) { default_metric_options[:tags] }

context 'when :experimental_propagate_process_tags_enabled is true' do
before do
allow(Datadog::Core::Environment::Process).to receive(:tags)
.and_return(['entrypoint.workdir:test', 'entrypoint.name:test_script'])
end

it 'includes process tags by default' do
is_expected.to include('entrypoint.workdir:test')
is_expected.to include('entrypoint.name:test_script')
end
end

context 'given :experimental_runtime_id_enabled' do
let(:options) { super().merge(experimental_runtime_id_enabled: runtime_id_enabled) }
let(:runtime_id_enabled) { true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
'env' => nil,
'language_name' => 'ruby',
'language_version' => String,
'process_tags' => String,
'runtime_name' => /\Aj?ruby\z/i,
'runtime_version' => String,
'service_name' => String,
Expand Down
51 changes: 39 additions & 12 deletions spec/datadog/core/telemetry/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
let(:service_name) { 'service' }
let(:service_version) { 'version' }
let(:tracer_version) { Datadog::Core::Environment::Identity.gem_datadog_version_semver2 }
let(:process_tags_enabled) { false }

let(:host) do
{
Expand All @@ -59,21 +60,47 @@
c.env = env
c.service = service_name
c.version = service_version
c.experimental_propagate_process_tags_enabled = process_tags_enabled
end
end

it do
is_expected.to match(
api_version: api_version,
application: application,
debug: debug,
host: host,
payload: payload,
request_type: request_type,
runtime_id: runtime_id,
seq_id: seq_id,
tracer_time: be_between(before_time, after_time),
)
context 'when process tags propagation is disabled' do
it do
is_expected.to match(
api_version: api_version,
application: application,
debug: debug,
host: host,
payload: payload,
request_type: request_type,
runtime_id: runtime_id,
seq_id: seq_id,
tracer_time: be_between(before_time, after_time),
)
end
end

context 'when process tags propagation is enabled' do
let(:process_tags_enabled) { true }
let(:process_tags) { 'entrypoint.workdir:test,entrypoint.name:test_script' }

before do
allow(Datadog::Core::Environment::Process).to receive(:serialized).and_return(process_tags)
end

it do
is_expected.to match(
api_version: api_version,
application: application.merge(process_tags: process_tags),
debug: debug,
host: host,
payload: payload,
request_type: request_type,
runtime_id: runtime_id,
seq_id: seq_id,
tracer_time: be_between(before_time, after_time),
)
end
end

context 'when Datadog::CI is loaded and ci mode is enabled' do
Expand Down
30 changes: 18 additions & 12 deletions spec/datadog/core/workers/runtime_metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,32 @@
RSpec.describe Datadog::Core::Workers::RuntimeMetrics do
subject(:worker) { described_class.new(telemetry: telemetry, **options) }

let(:metrics) { instance_double(Datadog::Core::Runtime::Metrics, close: nil) }
let(:options) { {metrics: metrics, enabled: true} }

let(:runtime_metrics) { instance_double(Datadog::Core::Runtime::Metrics, close: nil) }
let(:options) { {metrics: runtime_metrics, enabled: true} }
let(:logger) { logger_allowing_debug }
let(:telemetry) { double(Datadog::Core::Telemetry::Component) }

before { allow(metrics).to receive(:flush) }
before { allow(runtime_metrics).to receive(:flush) }

after { worker.stop(true, 1) }

describe '#initialize' do
it { expect(worker).to be_a_kind_of(Datadog::Core::Workers::Polling) }

context 'by default' do
subject(:worker) { described_class.new(logger: logger, telemetry: telemetry) }
subject(:worker) do
described_class.new(
logger: logger,
telemetry: telemetry,
metrics: runtime_metrics,
)
end

it { expect(worker.enabled?).to be false }
it { expect(worker.loop_base_interval).to eq 10 }
it { expect(worker.loop_back_off_ratio).to eq 1.2 }
it { expect(worker.loop_back_off_max).to eq 30 }
it { expect(worker.metrics).to be(runtime_metrics) }
end

context 'when :enabled is given' do
Expand Down Expand Up @@ -73,7 +79,7 @@
it 'starts a worker thread' do
perform
expect(worker).to have_attributes(
metrics: metrics,
metrics: runtime_metrics,
run_async?: true,
running?: true,
started?: true,
Expand Down Expand Up @@ -285,7 +291,7 @@

# Metrics are produced once right away
# and again after an interval.
wait_for(metrics).to have_received(:flush).at_least(2).times
wait_for(runtime_metrics).to have_received(:flush).at_least(2).times
end
end

Expand All @@ -294,14 +300,14 @@

let(:options) do
{
metrics: metrics,
metrics: runtime_metrics,
fork_policy: fork_policy,
enabled: true
}
end

context 'when the process forks' do
before { allow(metrics).to receive(:flush) }
before { allow(runtime_metrics).to receive(:flush) }

after { worker.stop }

Expand All @@ -315,7 +321,7 @@
expect_in_fork do
# Capture the flush
@flushed = false
allow(metrics).to receive(:flush) do
allow(runtime_metrics).to receive(:flush) do
@flushed = true
end

Expand All @@ -337,7 +343,7 @@
expect_in_fork do
# Capture the flush
@flushed = false
allow(metrics).to receive(:flush) do
allow(runtime_metrics).to receive(:flush) do
@flushed = true
end

Expand All @@ -347,7 +353,7 @@

# Verify state of the worker
expect(worker.error?).to be false
expect(metrics).to have_received(:flush).at_least(:once)
expect(runtime_metrics).to have_received(:flush).at_least(:once)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def target_method
version: 2,
},
message: nil,
process_tags: String,
service: 'rspec',
timestamp: Integer,
}
Expand Down Expand Up @@ -480,6 +481,7 @@ def assert_received_and_errored
# false is the result of first expression evaluation
# second expression fails evaluation
message: 'hello false[evaluation error]',
process_tags: String,
service: 'rspec',
timestamp: Integer,
}
Expand Down Expand Up @@ -656,6 +658,7 @@ def assert_received_and_errored
},
# No message since we stopped execution at condition evaluation.
message: nil,
process_tags: String,
service: 'rspec',
timestamp: Integer,
}
Expand Down Expand Up @@ -740,6 +743,7 @@ def assert_received_and_errored
version: 2,
},
message: nil,
process_tags: String,
service: 'rspec',
timestamp: Integer,
}
Expand Down
4 changes: 4 additions & 0 deletions spec/datadog/di/probe_notification_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@
end

context 'when process tags propagation is not enabled' do
before do
allow(settings).to receive(:experimental_propagate_process_tags_enabled).and_return(false)
end

it 'excludes process tags in the payload' do
payload = builder.build_executed(context)
expect(payload).not_to include(:process_tags)
Expand Down
Loading
Loading